Skip to content

mcp: add readonly guard to config add/remove handlers#3708

Open
Elvand-Lie wants to merge 2 commits into
knative:mainfrom
Elvand-Lie:fix/mcp-config-readonly-guard
Open

mcp: add readonly guard to config add/remove handlers#3708
Elvand-Lie wants to merge 2 commits into
knative:mainfrom
Elvand-Lie:fix/mcp-config-readonly-guard

Conversation

@Elvand-Lie
Copy link
Copy Markdown
Contributor

@Elvand-Lie Elvand-Lie commented May 12, 2026

The deploy and delete handlers check s.readonly and refuse to act in readonly mode. However, the six config mutation handlers (configEnvsAdd, configEnvsRemove, configLabelsAdd, configLabelsRemove, configVolumesAdd, configVolumesRemove) execute unconditionally, allowing an AI agent to modify func.yaml even when readonly mode is active.

Add the same readonly guard to all six config mutation handlers, consistent with deploy and delete.

Changes

  • Add s.readonly guard to configEnvsAddHandler and configEnvsRemoveHandler
  • Add s.readonly guard to configLabelsAddHandler and configLabelsRemoveHandler
  • Add s.readonly guard to configVolumesAddHandler and configVolumesRemoveHandler

Fixes #3704

Release Note

NONE

Docs

NONE

The deploy and delete handlers check s.readonly and refuse to act in readonly mode. However, the six config mutation handlers (envs add/remove, labels add/remove, volumes add/remove) execute unconditionally, allowing an AI agent to modify func.yaml even in readonly mode.

Add the same readonly guard to all six config mutation handlers.

Signed-off-by: elvandlie@gmail.com <elvandlie@gmail.com>
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 12, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Elvand-Lie
Once this PR has been reviewed and has the lgtm label, please assign matzew 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

@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 12, 2026 14:15
@knative-prow knative-prow Bot added size/S 🤖 PR changes 10-29 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 12, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 12, 2026

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.29%. Comparing base (2b6fb02) to head (762cc09).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3708      +/-   ##
==========================================
- Coverage   56.91%   56.29%   -0.63%     
==========================================
  Files         181      181              
  Lines       20928    20952      +24     
==========================================
- Hits        11912    11794     -118     
- Misses       7808     7991     +183     
+ Partials     1208     1167      -41     
Flag Coverage Δ
e2e 36.10% <0.00%> (-0.06%) ⬇️
e2e go ?
e2e node 28.45% <0.00%> (-0.04%) ⬇️
e2e python ?
e2e quarkus ?
e2e rust ?
e2e springboot 26.49% <0.00%> (-0.02%) ⬇️
e2e typescript ?
e2e-config-ci 17.86% <0.00%> (-0.03%) ⬇️
integration 17.40% <0.00%> (-0.04%) ⬇️
unit macos-14 45.05% <100.00%> (+0.06%) ⬆️
unit macos-latest 45.05% <100.00%> (+0.06%) ⬆️
unit ubuntu-24.04-arm 45.22% <100.00%> (+0.06%) ⬆️
unit ubuntu-latest 45.90% <100.00%> (+0.06%) ⬆️
unit windows-latest 45.03% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: elvandlie@gmail.com <elvandlie@gmail.com>
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/S 🤖 PR changes 10-29 lines, ignoring generated files. labels May 12, 2026
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/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: config add/remove handlers bypass readonly guard

1 participant