Repository navigation
fix(security): tell a pending ssh-to-self refusal apart from a settled one - #14380
Pearcekieser wants to merge 1 commit into
Conversation
|
Intent: make the |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- test/test_denied_commands_security.py:9276 -- |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify coordination with #14122: it edits the same refusal note, and whichever lands second must reconcile the status text and the spec paragraph. [DESIGN-REVIEWED] 658a0db |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the collision the description itself names: #14122 edits the same settled note, and whichever PR lands second must reconcile the three-note split. What this change shipsInventory (8 items) — 7 justifiedIntent: FIX — let an agent refused by
Evidence run: no prior [FIRST-PRINCIPLES-REVIEWED] 658a0db |
Security Scope Review (fork) — ✅ PASSWhich legitimate operations does adjudicated, zero confirmed regressions Scope-Verdict: PASS TIGHTENING: the ssh-to-self argv floor's refusal path in ADJUDICATED: 15 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix (12 rows) and windows (2 rows: [SCOPE-REVIEWED] 658a0dbSecurity scope review -- adjudicated candidates
No candidate flipped from allowed to refused. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed Review detailsNothing blocks: one advisory finding — the unchanged fail-closed contract on FINDING — src/kiro_crew/security/argv_floor.py:1517 — the docstring two lines above still states that "A miss schedules one single-flight resolver worker and answers fail_closed for this call — True (denied) for dotted names", but the added [OPUS-REVIEWED] 658a0db |
58a3afc to
0d027a1
Compare
|
|
|
|
|
|
No-code retrigger: f55b53d has the same tree as 0d027a1, and only the commit date differs. On 0d027a1, the GPT 5.6 Review, Opus 5 Review, Internal Content Scan and Security Scope Review lanes all failed before reaching a verdict at 06:22Z. The CI GitHub App had hit The remaining red shards are inherited from main, not from this change:
|
0d027a1 to
f55b53d
Compare
|
|
3231443 to
fcd2d11
Compare
|
Pushed The one content change from The two GPT advisories on that head repeat points already answered in earlier replies: the overlong-host wording and the mixed failed/pending command. Locally, the liveness, security and facade tests pass (1,303), and |
fcd2d11 to
9a0e161
Compare
|
issue (blocking, security): the status re-walk kept every unclassified host. Fixed in Opus 5 on Recording is now bounded where names are appended.
|
|
issue (non-blocking): a failed host followed by a never-seen host reported PENDING forever. Fixed in Opus 5 on The status now comes from the first recorded host, which is the one the deciding walk stopped on. It is LOOKUP FAILED when that host's last lookup failed or its name is longer than DNS allows. The security spec says the same.
|
9a0e161 to
0689952
Compare
|
issue (blocking, security): the refusal note echoed agent-authored host operands. Fixed in This answers Opus 5 on Filtering or escaping the recorded name would have left command text inside a security refusal, so the fix drops the recorded host names altogether. The status re-walk now records only the status of the first unclassified answer (
|
|
issue (non-blocking): the PENDING and LOOKUP FAILED notes named checks that do not run for every cause. Reworded in This answers Opus 5 on |
…d one The sandbox-escape-ssh-self floor fails closed on a first-contact dotted hostname while its DNS check runs off-loop, so the first command naming one is refused. The refusal used one note for every case, so a caller could not tell a retry-and-pass refusal from a settled denial or a lookup that keeps failing. The refusal now names its status: PENDING, LOOKUP FAILED or DENIED.
0689952 to
658a0db
Compare
|
Rebased onto main 6a8cb5e to clear the conflict in test/test_security_gate_liveness.py. The package line budget is 27,882: main's 27,761 plus this PR's 121 lines. No code change since 0689952. The GPT finding about the re-walk reading /etc/hosts on the loop is still open and waits on a design decision. |
Problem / Motivation
Goal: an agent refused by
sandbox-escape-ssh-selfcan tell from the refusal alone whether retrying the same command will pass.The first ssh, scp, sftp or rsync naming a new dotted hostname in a gateway process is refused with
sandbox-escape-ssh-self, and the identical retry passes. The refusal note is the same whether the lookup is still running, keeps failing, or the target really is this machine, so the agent cannot tell "retry" from "stop".Why it matters
Agents hit this on the first remote ssh of nearly every session. Some give up on a command that would have passed; others retry a command that is refused forever. The only guidance is a conditional sentence the agent cannot evaluate.
Not a goal
What changed (motivation → approach → change)
The refusal now names its status. The note is fixed text: nothing from the command, host names included, is written into it, so an operand cannot add lines to a host-authored refusal.
Status: PENDINGStatus: LOOKUP FAILEDStatus: DENIEDThe deny decision does not change. After a refusal,
ssh_self_unsettled_statusinsrc/kiro_crew/security/argv_floor.pywalks the same command again with every not-yet-classified answer taken as "not this machine", through aContextVarprobe that schedules no resolver and records only the status of the first unclassified answer, never its text. If that second walk still finds a self target, the refusal is settled. The DNS worker keeps a bounded record of hosts whose last lookup failed, which separates PENDING from LOOKUP FAILED. The record is capped like the verdict cache, oldest evicted first, and skips names longer than 253 characters.src/kiro_crew/security/denied_rules.pyholds the three notes.src/kiro_crew/security/__init__.pypicks one for an ssh-self floor hit, and_exports.pylists the new names. The security spec indocs/system-specs/modules/security.mddescribes the statuses.Backwards compatibility
Compatible: what is allowed and what is denied is unchanged; only the second line of the
sandbox-escape-ssh-selfrefusal text differs, and the first line (rule pattern) that the dashboard recovery card parses is the same.Tests
test/test_denied_commands_security.py, classTestSandboxEscapeSshSelf:Status: PENDINGwithout echoing the host, and the identical command passes once the verdict publishes;Status: LOOKUP FAILED, including when an unseen host follows it in the same command, and an overlong name saysStatus: LOOKUP FAILED;localhost, a loopback IP behind options, a cached self alias, and a settled self target next to an unclassified one all sayStatus: DENIED;Status: PENDING;prove.pyreports PROVEN: with the production hunks reverted, these tests fail.Manual verification
Reproduced on a live gateway: the first
sshto a dotted public host was refused withsandbox-escape-ssh-self, and the identical command ran a moment later. The refusal text of the fixed build is covered by the tests above.Related Issues
Related to #14122, which moves the address-table read to gateway startup and edits the same note; whichever lands second resolves the note text.
Fixes #14379
Pattern harvest
Rule candidate: review-prompt
Pattern: a fail-closed refusal that can clear on retry must say whether it is pending or settled, not describe every case in one conditional note.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)