Repository navigation
fix(sandbox): name the min_level floor when it refuses a backendless spawn - #33447
Conversation
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix fully addresses the dead-end remedy. One part goes unmentioned in the description: the diff reverses the old "replace the remedy" decision and now appends a note instead. Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: on a governed host, a refused backendless spawn tells the operator that the
[FIRST-PRINCIPLES-REVIEWED] d778120 Description read[DESCRIPTION-READ] b5e0ad575d4ea6468ce681a95ea69a3e31d4addbad48a3755845254dbcffc90d That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the refusal and its audit reason now name the authority that actually refuses, and the refuse/allow gate is untouched. Notes
[DESIGN-REVIEWED] d778120 Description read[DESCRIPTION-READ] 3d9c7c6451be6c910d1fc08838a6e4764f0e2ca9bad4fd1484d0929bb7ba6fec 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 |
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: |
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: |
83f5370 to
a7d6233
Compare
Sensitive change review
|
a7d6233 to
300c6c5
Compare
|
Addressed in 300c6c5. Under a mandating floor, the refusal no longer replaces the class-specific guidance wholesale. For a transient probe failure, a foreign macOS Seatbelt, or a container seccomp/AppArmor policy, the host-level fix is kept (those remedies work under the floor) and a note naming the floor is prepended; only the two unsandboxed-consent options in the container guidance (KIROCREW_ALLOW_UNSANDBOXED and agent.sandbox_allow_unsandboxed_exec=true) are dropped, since the floor makes them powerless. The full governed replacement is used only for the plain no_backend class with no container remedy, whose own text is just "install a backend or opt out" and whose opt-out the floor negates. The raised kind (transient / foreign_sandbox / no_backend) is unchanged and now agrees with the guidance. Allow and refuse are unchanged in all 18 floor x opt-in x backend combinations. A new test asserts floor + transient keeps the retry guidance, names the floor, and offers no opt-in option. |
Sensitive change review
|
300c6c5 to
d0304b9
Compare
|
Addressed in d0304b9. Under a mandating floor the guidance is never replaced now; the floor note is prepended and the host-specific remedy follows unchanged. The full_governed replacement branch is gone. For the plain no-backend class, _no_backend_guidance now takes include_optout, and wrap_argv passes include_optout=False under the floor: on stock Ubuntu (apparmor_restrict_unprivileged_userns=1) the "kirocrew service install" / "kirocrew sandbox install-profile" steps are kept and only the opt-out sentence is dropped; the generic no-restriction case keeps the "install a backend" half and drops the "set ...=true" half. Wording note also fixed: the floor prefix no longer says "give this host a working backend", so it no longer contradicts the foreign-Seatbelt "your sandbox is NOT broken" text. Allow and refuse are unchanged in all 18 floor x opt-in x backend combinations. A new test pins a governed Ubuntu no-backend host keeping the profile-install steps, naming the floor, with no opt-out text. |
Sensitive change review
|
|
Thank you for the review. Both findings reproduce on head 131f138.
This PR is parked as a draft for the maintainer to decide on the suggested smallest fix: name sandbox.min_level in the refusal prefix, and add a governed-container test that asserts sandbox.min_level appears in message[:_PROBE_ERROR_MAX_CHARS]. No further push until then. |
131f138 to
bc22a0c
Compare
Sensitive change review
|
|
Re: review 5905884736 - fixed in bc22a0c.
Also fixed the stale "prepend" comments and made the AppImage test assert the repair command comes before the floor note. |
|
Parked for the maintainer. After the final push bc22a0c, two checks failed twice: Backend Tests (3.12, 7) test/test_denied_commands_security_cost.py::TestSelfModuleIndexIsLinear::test_the_scan_is_linear_not_quadratic (AssertionError: 2k tokens took 0.651s, limit 0.5s; earlier runs 0.707s and 0.516s), and macOS shard 4 test/test_readonly_source_skill_install.py::TestBuiltinSyncFromReadonlySource (test_provenance_marker_written, test_0455_copy_installs_marker_and_verifies, test_second_sync_does_not_read_install_as_user_customized). No further pushes or reruns from this lane; leaving the call to the maintainer. |
|
Thanks for the update. Both items from the earlier change request are fixed on this head:
The optional items on the stale "prepend" comment and the AppImage ordering assertion are also done. Our review of this head found no blocking problem. The allow/refuse verdict is unchanged, and the 18-case floor x key x backend matrix pins that. One thing done well: the tests check what doctor and the dashboard actually keep (the first 1,200 chars), not only the full string. This cannot be approved yet. PR Readiness is red on this head, with failing runs in Backend Tests (3.12, 7) ( Optional:
|
Withdrawn: every item in this review is fixed or answered on the current head (see the follow-up comment). Other holds on this PR are listed there.
…spawn On a host with no sandbox backend, a governance sandbox.min_level floor that mandates isolation is the real refuser whatever agent.sandbox_allow_unsandboxed_exec holds. The refusal remedy was only generalized to name the floor when the opt-in was set true; a floor+false (or floor+unset) host fell through to the ordinary 'change that key to true' / 'is not set' branches, pointing the operator at a key the floor makes powerless, and the SEL sel_reason never named the floor either. Key the governed remedy on floor_mandates_sandbox alone. The refuse/allow decision is unchanged for every floor x key x backend combination; only the message and sel_reason wording change.
bc22a0c to
d778120
Compare
Sensitive change review
|
|
The two earlier reds were not caused by this PR, and the branch is now rebased onto main dc4692c (head d778120, same diff).
The related tests (181) pass locally on the rebased head. CI on this head will decide the rest. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for this. On head d778120 the review checked three things. The refuse/allow predicate (floor_mandates_sandbox or not opted_in) and the first-party carve-out are unchanged, and the 18-case floor x key x backend matrix test pins them. The refusal prefix and the SEL sel_reason now name sandbox.min_level whether the opt-in key is true, false or unset. Callers that do not pass include_optout get the same text as before. One thing done well: the tests check the text that doctor and the dashboard keep (the first 1,200 chars), not only the full string.
Both items from the earlier change request are fixed on this head. (1) The short refusal prefix names the floor, so the floor name fits inside the probe-error cap in a governed container, and a test pins this. (2) The floor note gives the policy-owner pointer on every branch, and a test covers win32 and linux.
Security: the PR changes files under the sandbox paths, but only the text of an existing refusal changes. Every spawn this path refused on main is still refused, every spawn it allowed is still allowed, and the SEL denied event is still emitted on each refusal. No seal, mask or refusal is added or widened, and no secret is read or written.
Optional:
- On a governed Windows host, the generic branch of
_no_backend_guidance(sandbox_unavailable.py:467) tells the operator to install a Linux or macOS backend. Windows cannot do that. Under a floor on that platform, you could skip that sentence and let the policy-owner note stand as the remedy. include_optoutis pinned at only one of its three sites, and the REMEDY_MOUNT_DENIED container strip is not pinned. Two checks would cover this. Assert"sandbox_allow_unsandboxed_exec=true" not in messagein the AppImage cap test and in the policy-owner test, and add a mount-denied leg to the governed-container test. Building the container text without (b)/(c) (sandbox_wrap.py:1190) would also remove the post-hocreplace.- "What changed" and "Tests" in the body still leave out several things: the
sandbox_unavailable.pychange, the container (b)/(c) drop, the switch from replacing the remedy to appending a note, and the new refusal prefix. The "49 passed" count is also out of date. You can fix these by editing the body, without a push.
Closes #32738
Problem / Motivation
Goal: On a governed host, a backendless-spawn refusal names the
sandbox.min_levelfloor that actually forbids the spawn instead of pointing the operator at the powerlessagent.sandbox_allow_unsandboxed_execkey.On a host with no sandbox backend,
sandbox.wrap_argvfails closed and raisesSandboxUnavailableErrorwith a remedy the operator can act on. When agovernance
sandbox.min_levelfloor mandates isolation (any level above theloosest, e.g.
ccorstrict), that floor is the real reason the spawn isrefused, and
agent.sandbox_allow_unsandboxed_execis powerless against itwhatever its value.
The governed remedy that names the floor was only reached when the opt-in was
set true (
floor_mandates_sandbox and opted_in). A host where the floor mandatesisolation but the opt-in is declared
falsefell through to the "change that keyto true" branch, and a host where it is unset fell through to the
"allow_unsandboxed_exec is not set" branch. Both send the operator to a config
key the floor makes inert, and the SEL
sel_reasoncarried in the audit eventnever named the floor in those cases either.
Why it matters
The refusal message and the audit
sel_reasonare the only diagnostics theoperator and the audit log get for a security-relevant denial. On a governed
host they pointed at a lever that cannot move the outcome, so an operator would
edit
config.jsonand see the spawn refused again with no explanation of why.Not a goal
The refuse/allow decision is not touched. Whether a spawn is refused or proceeds
is unchanged for every combination of floor (none / cc / strict) x opt-in key
(unset / true / false) x backend (present / absent) -- all 18 cases. Only the
remedy wording and the
sel_reasonstring change, and only on the refusal paththat a mandating floor already governs.
What changed
src/kiro_crew/sandbox_wrap.py: the governed remedy (message +sel_reason)is now selected on
floor_mandates_sandboxalone, not onfloor_mandates_sandbox and opted_in. The message no longer asserts the flag"is set on this host"; it states the flag is powerless against the policy
whatever its value.
test/test_sandbox_platform_default_exec.py: a new test class coveringfloor+declared-false and floor+unset (both now name the floor and drop the
powerless-key remedy), plus a matrix test asserting the refuse/proceed verdict
across all 18 floor x key x backend combinations is exactly what the gate logic
dictates, independent of the remedy wording.
test/test_sandbox_first_party_exec.py: two existing tests updated.mainhada test (
test_governed_host_without_the_opt_in_...) that deliberately assertedthe policy wording stayed OUT of the floor+unset case, keeping the plain
"allow_unsandboxed_exec is not set" message there. That assertion is reversed
here on purpose: because the floor also makes the key powerless when it is
unset, the floor+unset case must name the floor too, so the test now asserts
the floor wording appears and the plain missing-opt-in wording does not. The
second updated test tracks the one-word change in the
sel_reasonstring("overridden" -> "powerless here").
Tests
Added and run;
49 passedacross the two touched files:test/test_sandbox_platform_default_exec.pytest/test_sandbox_first_party_exec.pyAlso re-ran
test/test_sandbox_governance_mask.py(733 passed across the threefiles together).
flake8,black, andmypyare clean on the touched files.Why this change
A
sandbox.min_levelfloor that mandates isolation is the authority that refusesthe spawn; the config opt-in cannot relax it. The remedy and the audit trail
should name the authority that actually decided, so the operator is pointed at
the policy owner / a working backend rather than at a key that does nothing on a
governed host. Keying the governed remedy on the floor alone makes the three
refusal messages agree with the one thing that decided the refusal, without
shifting any allow/refuse boundary.
Pattern harvest
sel_reason, and the allow/refuse gate are three readersof the same floor verdict; when they can disagree about which lever matters, a
governed operator gets a dead-end remedy. Selecting diagnostics off the same
predicate the gate uses keeps them consistent.
that case is governed by something other than the policy. When the policy also
governs it, the assertion inverts -- the lesson is to tie such message tests to
the actual authority, not to the branch that happens to emit the text.
Rule candidate: when a message, an audit-trail reason, and an allow/refuse gate
all read the same policy verdict, select the diagnostics off the exact predicate
the gate uses — otherwise a governed operator can be handed a remedy that points
at a lever the authority has already overruled. Corollary: a "keep this wording
out of this case" test is only valid while something other than that policy
governs the case; tie such tests to the actual deciding authority, not to the
branch that happens to emit the text.