Repository navigation
fix(mcp): block config_git_set and config_git_remove in read-only mode - #4116
Elvand-Lie wants to merge 1 commit into
Conversation
Git configuration tools bypassed the MCP readonly policy and could modify Function settings, pipeline resources and remote webhooks. Reject both tools before validation or command execution in readonly mode. Assisted-by: Codex (gpt-6.1-sol) Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Elvand-Lie The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Elvand-Lie. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
config_git_setandconfig_git_removenever checked the read-only flag, so they still ran when the MCP server was started withoutFUNC_ENABLE_MCP_WRITE. This meant a client in read-only mode could rewritefunc.yamland create cluster resources and a GitHub webhook withconfig_git_set, or delete cluster pipeline resources withconfig_git_removeanddelete_cluster: true. The tools were added in #3818 without the read-only check.Add the same read-only check the config envs, labels and volumes handlers use (#3708) as the first check in each handler, so nothing reaches the executor.
Changes
configGitSetHandlerandconfigGitRemoveHandlerinpkg/mcp/tools_config_git.goinstructions_warning.mdTestTool_ConfigGitSet_ReadonlyandTestTool_ConfigGitRemove_Readonlyconfig_ciis unchanged; it only generates a local workflow file./kind bug
Testing
Both new tests fail without the guards (the executor still runs) and pass with the fix. The existing
TestTool_ConfigGitSet_ArgsandTestTool_ConfigGitRemove_Argstests still cover the writable path.Release Note
Docs