mcp: config add/remove handlers bypass readonly guard

Open Beginner friendly
#3,704 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
api

Research direction

Start at the six named config mutation handlers and compare their control flow with the existing deploy and delete handlers. Add consistent readonly behavior to each config add/remove entry point, then verify that all six refuse changes when s.readonly is enabled and continue to allow them otherwise.

Written by the indexing model from the issue text.

Description

kind/bug
Bug

The deploy and delete handlers check s.readonly and refuse to act when the server is in readonly mode:

if s.readonly {
    err = fmt.Errorf("the server is currently in readonly mode...")
    return
}

However, the six config mutation handlers have no such guard:

  • configEnvsAddHandler
  • configEnvsRemoveHandler
  • configLabelsAddHandler
  • configLabelsRemoveHandler
  • configVolumesAddHandler
  • configVolumesRemoveHandler

These tools are annotated with ReadOnlyHint: false and some with DestructiveHint: ptr(true), correctly declaring them as mutative, but the handlers execute unconditionally regardless of s.readonly.

Impact

In readonly mode, an AI agent can freely modify func.yaml by adding or removing environment variables, labels, and volumes. This directly contradicts the purpose of readonly mode.

Fix

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

Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knative/func

All issues in knative/func

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.