Repository navigation
fix: keep the owner-only switches sealed after a save on linux - #31833
Conversation
|
[operator: bolichen97] |
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only touches backend writers, tests and docs. It adds or changes no dashboard control, label or string. The new refusal messages are written to the gateway log, and the routes keep their existing failed-save reporting. [UX-REVIEWED] 0416471 Description read[DESCRIPTION-READ] dc9fb44abe35ff7fcc5584391eabd7bc9e35a168e202ddc368008e680bf12ba3 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The change moves the in-place writer that Notes
[DESIGN-REVIEWED] 0416471 Description read[DESCRIPTION-READ] 0eae31872803ffc4e6b199a3a67893e4e060499402e729c589b670f47eb95425 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: the writer that keeps the inode already existed in Not checked: whether a Linux bind mount stays sealed across an in-place Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: on Linux, a sandbox that is already running can no longer change the consent or redaction switch after the owner saves it. This is a FIX.
(The chat-panel hunks in the patch are #34110, which is already on base, and are not part of this PR.) [FIRST-PRINCIPLES-REVIEWED] 0416471 Description read[DESCRIPTION-READ] 33ca595d1184970fe89383e9e5dec4b0e321ce5f22d8cf6cfd4d9a6c2da59c89 That sha256 names the PR description this verdict read. Recompute it with |
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: |
246db7b to
6367ba1
Compare
|
Security Scope Review -- ✅ human override accepted@bolichen97 overrode this lane for [SCOPE-REVIEWED] 0416471 |
6367ba1 to
09cb54a
Compare
|
self-added: yes
|
09cb54a to
e375e1c
Compare
|
self-added: yes
|
|
[operator: bolichen97] Rebased: main moved in the line-budget and platform collect-ignore tests (fixed on main by #32252 and #32209) since this head went red (b65af1a -> f58c3cf); CI re-running. The patch is unchanged (git range-diff shows the same commit); local scoped tests, flake8, isort and mypy pass, and local GPT and Opus reviews of 6e6162e passed. AI-assisted, posted on behalf of bolichen97 |
6e6162e to
a183500
Compare
|
Rebased: main moved in Main now holds [operator: bolichen97] |
buluoray
left a comment
There was a problem hiding this comment.
Approving. Consent and credential-redaction saves now rewrite the record in place (same inode), so a running Linux sandbox's read-only bind mount stays sealed after an owner save (atomic_write.py:1748, decisions/consent.py:589, 610, security/redaction_switch.py:311). The preview switch's existing in-place writer moves into the shared helper with the same behavior, plus a rollback on a failed write (shared_crew/preview.py:85). Sensitive Change Review still needs the author's template.
|
[operator: bolichen97] The red Fast Gate on a183500 comes from main, not from this change: The next push rebases this branch onto a main that carries #33695. The Sensitive Change sign-off belongs on that new head, because a push dismisses the current approval. |
A save of an owner-only switch could leave a running sandbox able to change that switch until the sandbox restarted. The record now keeps its identity across a save, so the read-only protection a running sandbox holds over it stays in force. Part of #15143
a183500 to
0416471
Compare
|
Rebased: main moved in The patch is unchanged: [operator: bolichen97] |
|
|
/ai-review override scope 0416471 not-applicable: agent: not a finding. This head's lane comment reads PASS, 0 newly refused on every leg; the red is the same-repo per-head floor holding attempt 1 of run 42841935159, which produced no verdict while the API rate limit was spent. Attempt 3 measured success and was held at it; a re-run cannot clear it. Widens no restriction. [operator: bolichen97] |
Human judgment recorded@bolichen97 recorded a not-applicable release (class
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: On Linux, a running sandbox can no longer change the owner-only computer use, decision consent and credential redaction switches after the owner saves one of them.
On Linux, once the owner saved one of these three switches, a sandbox that was already running could change that switch itself until the sandbox was restarted.
Why it matters
Each switch is a permission the agent must never grant itself: control of the desktop, sending message text to an outside provider, or showing raw credentials in the owner's file view. Each owner save reopened that for every running sandbox on the host.
Not a goal
What changed (motivation → approach → change)
After the owner saves the decision consent or credential redaction switch, a running Linux sandbox still cannot change it. The save rewrites the existing record in place, as the Shared Crew preview switch already does, so the read-only protection the sandbox holds over it stays in force. One shared writer (
src/kiro_crew/atomic_write.py) serves these three switches (src/kiro_crew/decisions,src/kiro_crew/security,src/kiro_crew/shared_crew). The preview switch writes the same bytes as before and gains what the shared writer adds: the failed-write rollback below, and creating a missing data folder.The computer use switch keeps the save main gives it. Main already ignores a change made to that record from inside a sandbox and holds the change for the owner to review (#31066), so this PR leaves that record alone.
An in-place save is not all-or-nothing on a crash, so two edges are handled. A save whose write fails puts the previous record back before it reports the error. A record that save created goes back to
{}, the document a sandbox spawn pre-creates, and no record is ever removed, since a sandbox spawned meanwhile may already hold it sealed. If both writes fail (a full disk) or the gateway crashes inside the rewrite, the record can be left empty. An empty record reads as the switch's safe default: not consented, redaction on, preview off. The consent save reads the record before it writes, so it refuses an empty one as corrupt, as main does, and never drops the browser opt-outs a crash erased. The owner then removes the record to save again and restarts running agent sessions, because on Linux removing the record lifts its seal in them, as it does on main. The security spec in docs and the sandbox notes (src/kiro_crew/sandbox_precreate.py) describe the new behaviour.Backwards compatibility
Breaking: a decision consent or credential redaction save now fails when the record is a link or has a second hard link (a hard-link backup of the data home makes one); the owner sees the save fail, and the gateway log names the record and the cause; the provider route, which carries a standing consent over to a new endpoint, reports that consent as not carried instead. Main replaced the record with a fresh file. The Shared Crew preview save already refused both on main. The in-place save and these refusals apply on every platform; only the seal it keeps is Linux's. Writer sweep on origin/main @ ed833a5: the redaction and preview switches each have one writer, their owner-only dashboard route; the consent record has two, the owner-only consent route and the owner-only provider route that carries a standing consent over to a local model; each route already reports a failed save to the owner, and nothing else writes these records.
Removes nothing: every switch keeps its location, its format and its readers. An empty record reads as the default and is refused by the consent save, which reads before writing, both as on main.
Tests
{}, which reads as not consented and does not block the next save.test/test_decisions_consent_in_place.py, which keepstest/test_decisions_consent.pyunder the file line cap. Existing tests that intercept the consent write follow it to the shared writer; no assertion changed.Proof: PROVEN test/test_credential_redaction_switch.py::TestSwitchedOffInsideOwnerView::test_a_save_rewrites_the_existing_record_in_place, test/test_decisions_consent_in_place.py::TestInPlaceSave::test_a_save_rewrites_the_existing_record_in_place (head 0416471)
Determinism: the five added tests ran 20/20 at
-n0, 10/10 for their four files at-n 4 --dist loadgroup --max-worker-restart=2, and green together with every test of those files in a shuffled order (seed 23562).Manual verification
N/A — unit coverage sufficient: the tests drive the real writer on the real file, and the Linux protection it keeps is the one the Shared Crew preview switch already relies on. Not run against a live Linux sandbox.
Related Issues
Part of #15143
Sibling sweep
Swept: every writer of the protected records #15143 names that still exist on main (
git grep -n "atomic_write(" -- src/kiro_crewbeside each record's path function).Sibling: src/kiro_crew/computer_use/enable_state.py -- not affected -- main holds this record by its endorsed copy (#31066)
Sibling: src/kiro_crew/config -- tracked in #15143
Pattern harvest
Not generalizable: each remaining protected record needs its own placement decision, and the one #15143 still tracks needs a reviewed design of its own.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.