Repository navigation
test(cron): pin the ssh-self floor's host state for backup@host - #20885
iamwhatever wants to merge 1 commit into
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] b881a15 Description read[DESCRIPTION-READ] a3645ef56c72b9b1d49f83d3f04bb6dfe2377a6f12f8de77c84625da3db079cf 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: |
|
The five Backend Tests reds on 281814e (Linux shards 1-4, Windows shard 5) are main's, not this PR's. Each fails only |
The two cron vet tests that allow `ssh -o ConnectTimeout=10 backup@host uptime` read the runner's own host state through the ssh-self argv floor: its host name, hosts file, resolver, and the address table a background thread publishes after the first ssh check of the process. When that publication lands while the gate parses the hosts file, the dotless target gets the pending answer and the command is refused, so the verdict depended on which test of a worker ran the first ssh check. A fixture pins that state on argv_floor for both tests: own names without `host` together with their published and resolved flags, no enrichment retry, no hosts file, and a not-self DNS verdict. The floor still runs, and loopback targets stay refused. Fixes #20595
281814e to
b881a15
Compare
|
The four Linux Backend Tests reds on b881a15 come from CI's leaf lane ("leaf changed files, pass 1/3"). That lane repeats this PR's changed test file with |
|
Closing in favour of #20964, which fixes the root cause in argv_floor.py; this PR only pinned the test seam and would hide that race. |
Problem / Motivation
Goal: The two
ssh -o ConnectTimeout=10 backup@host uptimecases intest/test_mcp_cron_security.pypass or fail on the cron vet's own logic, never on the CI runner's host-name state.test_an_assignment_nothing_reads_is_ordinary[ssh -o ConnectTimeout=10 backup@host uptime]went red on four unrelated branches on 2026-10-15 (Linux 3.12, shard 3) withAssertionError: should allow: 'ssh -o ConnectTimeout=10 backup@host uptime', refused bysandbox-escape-ssh-self component=argv-floor. Main passed the same shard on the same base.Why it matters
Any PR whose shard happens to run this case first in a worker can go red with nothing to fix in its own diff. Its author pays for the triage and the rerun.
Not a goal
src/. This is a test-only change.What changed (motivation → approach → change)
The two
backup@hosttests pin the floor's view of this machine, sohostis a remote machine on every runner.Symptom. On the failing CI worker, the network floor shows this test ran the process's first ssh check: the own-host seed's UDP probes and the enrichment worker's lookups of the runner's own name. It never asked DNS about
host. So the refusal came from the hosts-file layer, before the DNS verdict layer.Cause. For a dotless target,
argv_floor._host_is_selfasks_hosts_file_verdictfirst. The gate reads the hosts-file key (it holds the netlink-published flag and the own-name set), parses/etc/hostsin the call, then reads the key again. The first ssh check also starts thekirocrew-own-host-resolvethread, and its netlink publish changes that key. When the publish lands inside the parse, the gate answers pending and the command is refused.Change. A
_ssh_target_host_is_remotefixture intest/test_mcp_cron_security.pypins the floor's view of this machine onargv_floor, in the same slots the ssh-self tests intest/test_denied_commands_security.pypin:_OWN_HOST_NAMES_CACHEfrozenset({"127.0.0.1"})_NETLINK_ADDRS_PUBLISHED,_OWN_HOST_RESOLVE_DONETrue_OWN_HOST_RESOLVE_NEXT_TRYinf_hosts_file_paths()/etc/hostsparse_resolved_host_verdicttest_vet_shell_command_allows_smuggling_lookalikesandtest_an_assignment_nothing_reads_is_ordinaryuse it. These are the only two tests in the file that reach the floor's hosts-file or DNS layer (traced over the whole file). The floor still runs:localhostand loopback addresses are judged before these inputs.Backwards compatibility
Compatible: test-only; no product code, config or public surface changes.
Removes nothing: every assertion stays, and the fixture only pins state for the two tests that use it.
Tests
No assertion changes. The two tests above take the fixture.
Determinism proof on Linux, Python 3.12. The parent column is clean main at
a7903730df. The PR column is this commit's patch (git patch-idunchanged across rebases onto later main; none of those main commits touchsrc/kiro_crew/security/argv_floor.py,security/__init__.py,security/denied_rules.py,mcp_cron.py,conftest.pyor this file). The forced conditions are throwaway-pplugins, not committed; source below.On the current base
e33caf76f3the file collects 674 tests: main's newenginessensitive leaf adds twotest_every_sensitive_entry_refuses_with_one_neutral_wordingcases. All 674 pass, also under the forced publish, and the forced-delay node passes._parse_hosts_file, real worker and real/etc/hosts, failing node alonetest_mcp_cron_security.py:819refusal text as CI_publish_netlink_addressesinside every in-call parse, whole filebackup@hostcases), 670 passed-n0, 20 runs-n 4 --dist loadgroup --max-worker-restart=2besidetest_deny_guidance.pyandtest_argv_floor_inline_and_brace_scope.py, 10 runsTwo unchanged tests in this file,
test_script_leaf_swap_never_reads_the_targetandtest_fifo_substituted_during_open_is_nonblocking_and_refused, fail withDID NOT RAISE <class 'OSError'>on this host under xdist and in seeds 31337 and 777. Clean main fails them the same way (8 of 10-n 4runs, seed 31337 3/3, seed 777 2/2): at the failing assert, the closed descriptor number is held by a pipe. The-n 4runs deselect them.Probe plugins and commands
python -m pytest -n0 -p no:cacheprovider -p f12_force_delay -qq "test/test_mcp_cron_security.py::test_an_assignment_nothing_reads_is_ordinary[ssh -o ConnectTimeout=10 backup@host uptime]" python -m pytest -n0 -p no:cacheprovider -p f12_force_publish -qq test/test_mcp_cron_security.pyManual verification
A throwaway test with the fixture applied:
ssh -o ConnectTimeout=10 backup@<target> uptimeis refused withsandbox-escape-ssh-selfforlocalhost,127.0.0.1and[::1], and allowed forhost(4 passed).Related Issues
Fixes #20595
Related: #17035, #19969
Pattern harvest
Rule candidate: review-prompt
Pattern: a test that sends an ssh, scp, sftp or rsync command through
is_deniedor_vet_shell_commandwithout pinningargv_floor's host state (own names, hosts file, DNS verdict) gets a verdict that depends on the runner.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)