Skip to content

feat: add owner-only mcp safety switches in security settings - #37410

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/safety-switches
Nov 15, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/safety-switches

Conversation

@buluoray

@buluoray buluoray commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The dashboard owner can turn mcp.protect_kiro_permission_rules and mcp.honour_auto_approve on 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 autoApprove list honoured, has to find and hand-edit config.json. A safety setting that only a file edit can change is easy to miss and easy to get wrong.

Not a goal

  • Letting anyone but the dashboard owner change these switches.
  • Making either key writable again from the Advanced page or through a change card.
  • Changing what either switch does, or its default.
  • Adding other safety settings to the new section.

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.

  • Backend: dashboard/handlers/safety_switches.py adds GET and PUT /api/security/safety-switches, both owner-only.
    • GET returns {degraded, switches:[{key, enabled, in_force}]}. in_force comes from the same functions the gates call (_permission_rule_rows, _auto_approve_is_honoured).
    • PUT takes {key, enabled}. Any other key, or a non-boolean enabled, gets a 400. A key set in config.local.json, or locked by this build, gets a 409. A non-owner gets a 403 dashboard_owner_required, recorded in the SEL.
    • Each change is written to the SEL first, synchronously (critical=True). Only then is the config written, through update_config_locked under 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 to config.json is 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.
  • Frontend: SecurityPanelSafetySwitches.tsx adds a "Safety switches" entry to the Security rail with one toggle per key, worded so that on always means safer:
    • "Stop the agent from editing its own permission rules" (checked = mcp.protect_kiro_permission_rules on). 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."
    • "Ask me before running tools an MCP server pre-approves" (checked = mcp.honour_auto_approve off; 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.py strip_ungoverned_auto_approve; the field is restart=True). The protect fence reads the live config on every edit, so it has no such line.
    • Each toggle draws the state in force. When the config could not be read in full, each row says what a click saves ("On right now. Clicking saves Off."), and one notice says the switches show what is in force, with Retry and the ask-agent link.
    • A non-owner sees both toggles disabled, a neutral lock line ("Only the dashboard owner can change these switches") and "Saved: on/off" text per row, built from the saved config, so it never claims the state in force. If the non-owner's config read fails, the card shows an error notice with Retry instead of stale rows.
    • A failed save, or a save refused because an outside edit waits for review, shows under the row that was flipped.
    • The ['safety-switches'] query refreshes on the config push frame and on reconnect (hooks/websocket/serverState.ts), so other open tabs do not keep a stale state.
    • The Advanced page rows for both keys stay read-only and link to the new toggles (settingsManual.ts). Earlier labels and terms stay as search keywords.
  • i18n: new safetySwitches keys in all 12 locales.
  • Docs: security.md ("Owner's MCP safety switches"), governance.md, config.md, and the security row of docs/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, ConfigWriteRefused arm) 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.rail and ApiClient.refactor.surface tests 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_ui tests: 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 in apps/builtins/file_explorer and apps/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:

Component render, not the live page: Owner, dark

Owner, light:

Component render, not the live page: Owner, light

Non-owner, dark: saved values:

Component render, not the live page: Non-owner, dark: saved values

Config not read in full:

Component render, not the live page: Config not read in full

Non-owner config read failed:

Component render, not the live page: Non-owner config read failed

Save failed, under its row:

Component render, not the live page: Save failed, under its row

Save refused: outside edit waits for review:

Component render, not the live page: Save refused: outside edit waits for review

Security rail with the new Safety switches entry selected:

Component render, not the live page: Security rail, Safety switches selected

Advanced page: both keys have no control and link to the Safety switches section:

Component render, not the live page: Advanced page link rows

Related Issues

Closes #37251. Follow-up to #36083, which made both keys read-only on the Advanced page.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 14, 2026 23:33
@buluoray
buluoray enabled auto-merge (squash) November 14, 2026 23:33
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 737d763875c376914a1b65e81b1305788a8f6281 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The help text says the protect fence does not stop shell writes to the rule files. That limit already exists and is not new here. Keep it worded as a limit and not as a gap to harden, since the sandbox's scope is the operator's to widen.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 737d763875c376914a1b65e81b1305788a8f6281 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 2 — symptom-level: the stated premise is "Every setting needs a UI path". READONLY_REASONS has 16 ": WHY_SAFETY," rows (60 read-only rows in all). This PR gives a writer to 2 of them through a two-entry SWITCH_KEYS allowlist, so 14 safety rows are still file-edit-only. A general writer is bigger than this PR, so this is deferred, not demanded. Subtraction: delete the sentence "Every setting needs a UI path" from the rationale, or narrow it to these two keys, so the fix doesn't claim the general case.

What this change ships

Inventory (7 items) — 6 justified

Intent: let the dashboard owner turn the two MCP approval-safety keys on and off from Settings → Security instead of editing config.json. ADDITION.

  1. New "Safety switches" section in the Security rail with two toggles — justified
  2. Owner-only GET/PUT /api/security/safety-switches, written to the security event log (SEL) before the config is saved — symptom-level: 14 sibling safety rows have no writer
  3. The "ask before pre-approved tools" toggle is inverted, so checked always means safer — justified
  4. The Advanced rows for both keys now link to the new toggles instead of only showing why they are read-only — justified
  5. A non-owner sees the toggles disabled, with a lock line and the saved On/Off value — justified
  6. Other open tabs refresh the switches on a config push frame and on reconnect — justified
  7. Both keys are now search entries in the settings command palette, in all 12 locales — justified

[FIRST-PRINCIPLES-REVIEWED] 737d763

Description read

[DESCRIPTION-READ] e1786ba821a44a2b7fb4aa8abd1f4ed9628867564fe9c6877ac3f2b6f73a4db4

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ human override accepted

@buluoray overrode this lane for 737d763875c376914a1b65e81b1305788a8f6281 via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 737d763875c376914a1b65e81b1305788a8f6281 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 737d763

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 737d763875c376914a1b65e81b1305788a8f6281 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 737d763875c376914a1b65e81b1305788a8f6281 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 737d763

Verdict parsed from the review's SHA-scoped output markers for commit 737d763875c376914a1b65e81b1305788a8f6281.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 737d763875c376914a1b65e81b1305788a8f6281 false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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 737d763875 · 1485 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@buluoray
buluoray force-pushed the crew/slack/safety-switches branch from b4aaf25 to 6989bbf Compare November 15, 2026 00:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 15, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@buluoray
buluoray force-pushed the crew/slack/safety-switches branch from 6989bbf to 5f868fc Compare November 15, 2026 01:54
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

span=44cc78bbead5
self-added: yes
mechanism: the ['safety-switches'] query is now a target of the config refresh frame and of the reconnect re-read, so every open tab re-reads it after a write

  • Other dashboard tabs retain stale safety states

fixed in 5f868fc: website/src/hooks/websocket/serverState.ts adds ['safety-switches'] to the targets of the config refresh frame, which config_watch.py pushes after a config write applies, and to the reconnect re-read list.
new test website/src/hooks/websocket/serverState.safetySwitches.test.ts (2 tests) covers both paths; removing the two serverState lines turns both red.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=44cc78bbead5
self-added: yes
mechanism: the restart line on the ask row is static (the field is restart=True) and no longer reads the shared mutation state

  • Changing the other switch clears the pending restart warning

fixed in 5f868fc: in website/src/pages/settings/SecurityPanelSafetySwitches.tsx the ask row always shows "Takes effect after {{productName}} restarts."; flipping the protect switch or remounting the section no longer hides it.
SecurityPanel.safetySwitches.test.tsx checks the line is present before and after a protect flip; dropping the line turns the test red.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=44cc78bbead5
self-added: yes
mechanism: the non-owner fallback config query's error now renders through ErrorNotice and its stale values are hidden while it is errored

  • Non-owner fallback read failures are silently hidden

fixed in 5f868fc: in website/src/pages/settings/SecurityPanelSafetySwitches.tsx (cfgFailed) a failed /api/config/kirocrew read for a non-owner shows an ErrorNotice with Retry instead of the rows.
SecurityPanel.safetySwitches.test.tsx has a non-owner read-failed case; ignoring the query error turns it red. Capture r2-dark-read-failed.png is in the PR description.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=3acc90554989
self-added: yes
mechanism: the PUT checks refuse_save_if_pending(LEAF_CONFIG) before the change is audited, and catches ConfigWriteRefused ahead of the ValueError arm with the refusal's own code and a 409

  • Pending outside edit makes every safety-switch save a generic 500 with a false SEL change record

fixed in 5f868fc: src/kiro_crew/dashboard/handlers/safety_switches.py runs the pending check before the critical audit, so a refused save writes no enabled/disabled record; a ConfigWriteRefused raised inside the write answers 409 {error, code: exc.code} and logs a denied record. The card shows the shared filePendingReviewMessage() with its Review link under the flipped row.
two new tests in test/test_safety_switches_routes.py; removing the pending check turns 1 red, removing the ConfigWriteRefused arm turns 2 red. Capture r2-dark-pending-refused.png is in the PR description.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=4da127e4bc87
self-added: yes
mechanism: each toggle now draws the state in force, and the row note names what is saved and what a click saves

  • Degraded state: switch and warning disagree

fixed in 5f868fc: in website/src/pages/settings/SecurityPanelSafetySwitches.tsx (shownFor) the toggle position comes from in_force; the row note reads "On right now, but saved as off. Switching saves the position you pick." The inverted ask toggle follows the same rule.
SecurityPanel.safetySwitches.test.tsx checks the toggle is drawn from in_force; drawing it from the saved value turns it red. Capture r2-dark-degraded.png is in the PR description.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=11c75f49a673
self-added: yes
mechanism: the degraded notice drops the hedge, no longer repeats the row notes, and names the fix with Retry and the ask-agent link

  • Degraded notice hedges about state the code holds

fixed in 5f868fc: in website/src/pages/settings/SecurityPanelSafetySwitches.tsx the partial ErrorNotice reads "{{productName}} could not read config.json in full, so these switches show what is in force. Fix config.json, then press Retry." with Retry and the ask-agent link.
Capture r2-dark-degraded.png in the PR description shows the notice.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=f5d116849da3
self-added: yes
mechanism: the label names the narrower set itself, and the help text is one sentence about what the switch does not cover; wording chosen by the PR owner

  • The ask toggle's label misleads people about what it covers

fixed in 493b69d: the label is now "Ask me before running tools a server marks as safe" and ask_desc is "Tools you set to Always allow still run without asking." Both match the code: the switch drops only a tool server's autoApprove list; the owner's Always allow grants keep running. Same change in all 12 locales; the earlier phrases stay as search keywords.
SecurityPanel.safetySwitches.test.tsx pins the new label and help text (red before the change, green after). Capture r6-dark-owner.png is in the PR description.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=54c480a5c150
self-added: yes
mechanism: the help text now says what both positions do in plain words and drops "terminal commands" as an unexplained term; wording chosen by the PR owner

  • The reader would not use the protect toggle and was missing the words to understand it

fixed in 493b69d: the label is "Stop the agent from editing its own permission rules" and protect_desc is "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." It states the off position and stays true to the code (the fence covers file-edit tools only). The three notes are also in: the degraded row note names what a click saves, the restart line uses an info icon, and the degraded notice points to the ask-agent link.
SecurityPanel.safetySwitches.test.tsx pins the new text, the in-force note, the degraded notice and the info icon (red before, green after). Captures r6-dark-owner.png and r6-dark-degraded.png are in the PR description.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@buluoray
buluoray force-pushed the crew/slack/safety-switches branch from 493b69d to 5bebd59 Compare November 15, 2026 04:30
@buluoray

Copy link
Copy Markdown
Contributor Author

span=44cc78bbead5
self-added: yes
mechanism: non-owner rows are built from the saved config and labelled "Saved: on/off"; they no longer pass the saved value through shownFor as if it were the state in force

  • Non-owner fallback reports protection off while the fence is on

fixed in 5bebd59: in website/src/pages/settings/SecurityPanelSafetySwitches.tsx the non-owner rows read the saved config directly (protect = saved value, ask = inverse of saved honour) and show "Saved: on" / "Saved: off" (new keys saved_on/saved_off in all 12 locales; state_on/state_off removed). A non-owner row never says "Currently" or "right now", so it no longer claims the in-force state; no endpoint was added and a non-owner reads nothing new. The owner view still reads in_force and degraded from the owner-only GET.
SecurityPanel.safetySwitches.test.tsx asserts the non-owner row reads "Saved: off" with no "Currently off" and no "right now" text; it was red before the change, and restoring the old string turns it red again.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=f5c53224d618
self-added: yes
mechanism: the label takes the review's suggested wording and names MCP servers as the source of the pre-approval

  • Primary toggle "Ask me before running tools a server marks as safe" is not understood

fixed in 5bebd59: the label is now "Ask me before running tools an MCP server pre-approves" in all 12 locales (earlier labels stay as search keywords). The help text stays "Tools you set to Always allow still run without asking." The suggested pointer to a list on the MCP Servers page was not added because that page does not show a server's autoApprove list today (it shows only the owner's own Always allow grants, website/src/pages/overview/McpToolAlwaysAllow.tsx, read from /api/security/tool-grants), so the sentence would not be true.
The write-failed and pending-review captures are re-shot with the current strings (r7-dark-write-failed.png, r7-dark-pending-refused.png), with new owner and non-owner frames, in the PR description.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 15, 2026
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
@buluoray
buluoray force-pushed the crew/slack/safety-switches branch from 5bebd59 to 737d763 Compare November 15, 2026 05:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 15, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

Owner decision on the Safety switches copy (PR #37410): ship the current wording.

  • Protect: "Stop the agent from editing its own permission rules". 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."
  • Ask: "Ask me before running tools an MCP server pre-approves" (the label the UX review proposed on 493b69d). Help: "Tools you set to Always allow still run without asking."

Why: every string says only what the code does. The ask switch drops only a tool server's autoApprove list, and the owner's own Always allow grants still run. The protect switch fences only the agent's file-edit tools. The UX lane's remaining copy ideas are tracked in a follow-up issue, so the switches can land now.

@buluoray

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray recorded a owner-decision release (class owner-decision) for the ux AI finding on 737d763875c376914a1b65e81b1305788a8f6281.

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.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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_locked cannot 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:21 says 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.

@buluoray
buluoray merged commit 2e56b3b into main Nov 15, 2026
161 of 164 checks passed
@buluoray
buluoray deleted the crew/slack/safety-switches branch November 15, 2026 08:27
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings: owner-only Safety switches toggles for mcp.honour_auto_approve and mcp.protect_kiro_permission_rules

2 participants