Repository navigation
feat: add owner-only mcp safety switches in security settings - #37410
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is an owner-only, audit-first writer in the same shape as the credential-redaction switch, and the generic write path stays closed to both keys. Notes
[DESIGN-REVIEWED] 737d763 Description read[DESCRIPTION-READ] a1a02461913f996d2e8ae731af13944035a591ca4d1af45c8a7a3b2be5e31f46 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Defaults are unchanged, the new writer sits beside the read-only rows, and #37251 is the provenance. The note is a counted sibling gap. Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: let the dashboard owner turn the two MCP approval-safety keys on and off from Settings → Security instead of editing
[FIRST-PRINCIPLES-REVIEWED] 737d763 Description read[DESCRIPTION-READ] e1786ba821a44a2b7fb4aa8abd1f4ed9628867564fe9c6877ac3f2b6f73a4db4 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ human override accepted@buluoray overrode this lane for |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 30% chance that this change introduces a defect, above the 12% limit for approving on its own. Adds owner-only GET/PUT /api/security/safety-switches and a Security → Safety switches section for mcp.protect_kiro_permission_rules and mcp.honour_auto_approve. The handler copies the credential-redaction pattern closely and checked out against the code: owner gate on both verbs, a two-key allowlist, a boolean check, overlay and edition-lock 409s, a pending-edit refusal before any change record, a synchronous audit before the write with 503 and no write if the audit fails, the write through update_config_locked under the config lock, and a hot-apply before the reply. The generic PATCH and the Advanced rows stay read-only, and the tests cover the new paths. The UX lane's BLOCK is about label wording only, not behaviour, so it goes in the notes rather than as a blocking finding, though repo process needs it answered or overridden. One small test gap: there is no test for the lock 409. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
b4aaf25 to
6989bbf
Compare
6989bbf to
5f868fc
Compare
|
span=44cc78bbead5
|
|
span=44cc78bbead5
|
|
span=44cc78bbead5
|
|
span=3acc90554989
|
|
span=4da127e4bc87
|
|
span=11c75f49a673
|
|
span=f5d116849da3
|
|
span=54c480a5c150
|
493b69d to
5bebd59
Compare
|
span=44cc78bbead5
|
|
span=f5c53224d618
|
Settings -> Security gains a Safety switches section where the dashboard owner can turn mcp.protect_kiro_permission_rules and mcp.honour_auto_approve on and off. Both keys stay read-only on the Advanced page and link to the new section. The new owner-only route writes an SEL record before each change and refuses the change when the record cannot be written. Closes #37251
5bebd59 to
737d763
Compare
|
Owner decision on the Safety switches copy (PR #37410): ship the current wording.
Why: every string says only what the code does. The ask switch drops only a tool server's |
|
/ai-review override ux 737d763 owner-decision: The owner chose the shipped Safety switches wording after seven UX rounds: #37410 (comment) . The ask label is the one the UX review proposed on 493b69d, and every string stays true to the code. Further copy work moves to follow-up issue #37552. |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
This review read the full diff on head 737d763 and checked the new PUT /api/security/safety-switches against the main helpers it calls. Non-owners and app tokens are refused on both verbs. Only the two keys are accepted, and only with a JSON boolean. An overlay or a pending outside edit gets a 409. A critical audit record is written before the save, and a failed audit gets a 503 with no write. The save goes through update_config_locked and hot-apply. The generic PATCH still refuses both keys, defaults are unchanged, and the route tests cover each refusal path and check that config.json stays unchanged.
Done well: the pending-edit check runs before the audit record is written, so a refused save leaves no false enabled or disabled record.
Security: this adds an owner-only writer for two approval-safety keys. A non-owner or an app token cannot use it, because is_owner_dashboard_request refuses them on GET and PUT. Every change writes a synchronous security event log record first, and nothing is saved without that record. The protect fence covers only the file-editing tools, and a shell command can already reach the rule files on main. The auto-approve switch takes effect at restart. So an owner gate that checks identity only adds little reach. No sandbox seal or fence is added or removed.
The design is signed off under the standing maintainer sign-off for changes by team members.
Optional:
- The Tests section says the lock 409 is covered, but no test runs it.
config_path_lockedcannot be True for these two keys on main today. Drop "and lock" from the body, or add one test that patches the lock table. safety_switches.py:21says the owner gate has "the same one the redaction switch states" as its known limit. One sentence on what a flip changes here (file-edit fence only, auto-approve at restart) would carry over the bound that made that limit acceptable.- The non-owner fallback view goes further than the redaction precedent, which shows only the owner-only notice. That view adds a second config read, "Saved" rows and strings in 12 locales. Cutting it would leave the Goal intact.
Problem / Motivation
Goal: The dashboard owner can turn
mcp.protect_kiro_permission_rulesandmcp.honour_auto_approveon and off from Settings → Security, without editing a config file.Both keys decide whether the agent can skip or change the owner's tool approvals. #36083 made them read-only on the Advanced settings page, so a generic config write cannot flip them. That left a config-file edit as the only way to change them. Every setting needs a UI path.
Why it matters
An owner who wants the permission-rule fence on, or wants an MCP server's
autoApprovelist honoured, has to find and hand-editconfig.json. A safety setting that only a file edit can change is easy to miss and easy to get wrong.Not a goal
What changed (motivation → approach → change)
Gap → the Advanced rows are read-only on purpose, so the switches need their own owner-only writer → a new section and route modelled on the credential-redaction switch.
dashboard/handlers/safety_switches.pyaddsGETandPUT /api/security/safety-switches, both owner-only.{degraded, switches:[{key, enabled, in_force}]}.in_forcecomes from the same functions the gates call (_permission_rule_rows,_auto_approve_is_honoured).{key, enabled}. Any other key, or a non-booleanenabled, gets a 400. A key set inconfig.local.json, or locked by this build, gets a 409. A non-owner gets a 403dashboard_owner_required, recorded in the SEL.critical=True). Only then is the config written, throughupdate_config_lockedunder the dashboard config lock. If the audit record cannot be written, the PUT returns 503 and the file is not touched. If an outside edit toconfig.jsonis waiting for review, the PUT checks that first (refuse_save_if_pending) and answers 409 with that refusal's own code, before any change is audited. The live config reloads before the reply.SecurityPanelSafetySwitches.tsxadds a "Safety switches" entry to the Security rail with one toggle per key, worded so that on always means safer:mcp.protect_kiro_permission_ruleson). Help: "On: the agent's file-editing tools can't change the rules that let tools run without asking you. Off: they can. Commands the agent runs in a terminal can change these rules either way."mcp.honour_auto_approveoff; a flip sends the inverse to the PUT). Help: "Tools you set to Always allow still run without asking." The row always shows a "Takes effect after restart" line with an info icon, because that key is read only when the agent config is written (platform/governance.pystrip_ungoverned_auto_approve; the field isrestart=True). The protect fence reads the live config on every edit, so it has no such line.['safety-switches']query refreshes on theconfigpush frame and on reconnect (hooks/websocket/serverState.ts), so other open tabs do not keep a stale state.settingsManual.ts). Earlier labels and terms stay as search keywords.safetySwitcheskeys in all 12 locales.security.md("Owner's MCP safety switches"),governance.md,config.md, and the security row ofdocs/feature-map/README.md.Backwards compatibility
Compatible: both keys keep their defaults and their read-only Advanced rows; the new route is an added writer.
Removes nothing: the diff adds a route, a section and two link rows, and takes no path, key or reader away.
Tests
test/test_safety_switches_routes.py(19 tests): owner gate on both verbs, the key allowlist, the boolean check, the overlay and lock 409s, the pending-edit 409 with no change record, the 503 when the audit record fails (both directions, file untouched), the synchronous audit, degraded state, route registration. Source mutations (owner gate, key check, audit failure, critical audit, overlay check, degraded state, registration, pending check,ConfigWriteRefusedarm) each turn it red.test/test_config_all_settings.py: both keys link to the new section and the generic PATCH still refuses them. 2 of the new tests fail against main's registry.SecurityPanel.safetySwitches.test.tsx(10 tests): owner toggles, the inverted ask toggle (checked state and PUT body), the neutral owner notice, the always-on restart line, the toggle drawn from the state in force, the non-owner read error, the non-owner On/Off text, the failure under its own row, the pending-edit message. Each of 7 mutations turns it red.hooks/websocket/serverState.safetySwitches.test.ts(2 tests): the query refreshes on the config frame and on reconnect.SecurityPanel.owners,SecurityPanel.railandApiClient.refactor.surfacetests list the new section and endpoints.Local runs: vitest on i18n, settings, commandPalette, hooks, settingsCoverage and the API surface: 3672 passed. Backend route, config-all-settings and
find_uitests: 291 passed. isort, flake8, black,mypy --platform linux, docs-lint, comment-history and brand gates are clean. Earlier, the wider backend run had 54 failures inapps/builtins/file_explorerandapps/builtins/auto_improvement; they fail the same way on a branch that does not touch them (host environment).Manual verification
Component renders with mocked data (below). No gateway was run on this host.
Screenshots / video
Component render, not the live page. Mocked data.
Owner, dark:
Owner, light:
Non-owner, dark: saved values:
Config not read in full:
Non-owner config read failed:
Save failed, under its row:
Save refused: outside edit waits for review:
Security rail with the new Safety switches entry selected:
Advanced page: both keys have no control and link to the Safety switches section:
Related Issues
Closes #37251. Follow-up to #36083, which made both keys read-only on the Advanced page.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.