Skip to content

fix(mcp): block config_ci in read-only mode - #4134

Open
divyani-22 wants to merge 1 commit into
knative:mainfrom
divyani-22:fix/mcp-config-ci-readonly
Open

divyani-22 wants to merge 1 commit into
knative:mainfrom
divyani-22:fix/mcp-config-ci-readonly

Conversation

@divyani-22

Copy link
Copy Markdown

Description

The config_ci tool generates GitHub Actions CI workflow files on disk, but lacked a read-only check. When the Functions MCP server operates in default read-only mode (FUNC_ENABLE_MCP_WRITE not set), executing config_ci bypassed policy and allowed writing workflow files to the local repository.

This change adds the s.readonly.Load() guard to configCIHandler, updates instructions_warning.md, and adds a corresponding unit test following the pattern established in #4116 and #3708.

Changes

  • Check s.readonly.Load() at the start of configCIHandler in pkg/mcp/tools_config_ci.go.
  • Document config_ci under disabled operations in pkg/mcp/instructions_warning.md.
  • Add TestTool_ConfigCI_Readonly in pkg/mcp/tools_config_ci_test.go.

Testing

  • TestTool_ConfigCI_Readonly verifies that config_ci returns an error in read-only mode and the executor is not invoked.

The config_ci tool generates GitHub Actions CI workflow files on disk, but lacked a readonly check. When the MCP server is operating in read-only mode, executing config_ci bypassed policy and allowed writing workflow files.

Reject config_ci before execution when readonly mode is active, matching the readonly enforcement on other mutating MCP config tools.

Signed-off-by: Divyani <divyanipapalkar22@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 04:38
@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: divyani-22
Once this PR has been reviewed and has the lgtm label, please assign gauron99 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: divyani-22 / name: Divyani (3785270)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

Welcome @divyani-22! It looks like this is your first PR to knative/func 🎉

@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 6, 2026
@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

Hi @divyani-22. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants