Skip to content

fix(security): narrow the credential-mint and self-kill argv floors to what a command names - #10236

Merged
bolichen97 merged 1 commit into
mainfrom
fix/argv-floor-inline-python-false-denials
Sep 16, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/argv-floor-inline-python-false-denials

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

The bash gate refuses ordinary developer commands as credential mints and self-kills. Eight days of ~/.kiro/crew/security_events.jsonl on one host hold 179 bash-gate denials. 156 of them come from two argv-floor predicates. None of the 156 was the action the predicate exists to stop.

_is_credential_mint denies every inline Python program (python -c, python - <<'PY') that mentions kiro_crew anywhere, or that uses getattr, eval, importlib or b64decode at all. A patch script that edits src/kiro_crew/x.py, a one-liner importing kiro_crew.platform.governance, or python3 -c "print(getattr(json, 'dumps'))" next to a product path are all "credential mints". 143 denials; one command contained the word token; zero minted.

_is_self_kill reads every brace group as a word that "could expand to pkill". A quoted jq filter (--jq '{state}'), an awk program ('{print $1}'), or a glob argument (ls -d dir/*) followed by a product-named path in the same argv is a "self-kill". 13 denials; 8 of the commands contained no kill at all.

Why it matters

An agent hit by one of these denials stops mid-task. It then either asks the user to run the command by hand, or rewrites the command until it slips past the gate. Both are worse than the rule firing on a real mint. A gate that is wrong 87% of the time also trains people to disable the rule, and the rule covers a real escalation path (kirocrew token prints a signed dashboard URL).

What changed (motivation → approach → change)

An inline program is now judged by what it names, not by whether it mentions the product. _inline_payload_reaches_cli (new module src/kiro_crew/security/inline_payload.py: it answers one question — what an inline payload NAMES — and imports only the vocabulary, so it sits below argv_floor.py, which decides WHICH argv tokens are a payload; the two folds and the decode are unit-tested through it without standing up the floor) denies a payload that names the mint surface: the CLI dispatch (kiro_crew.cli, kiro_crew.__main__, the console-script entry kiro_crew._bootstrap, from kiro_crew import cli), the module implementing the token subcommand (kiro_crew.cli_server), a product module whose path names a token producer (kiro_crew.dashboard.token_auth, kiro_crew.instances.token_mint), a product import statement (the package anywhere in an import list — import os, kiro_crew.instances.run_marker as r imports it too) together with a credential word, token or secret, anywhere in the payload (from kiro_crew.slack.gateway import generate_token, import kiro_crew.slack.gateway as g; g.generate_token(), and the second credential: from kiro_crew.config.loader import read_local_secret reads the internal secret /api/token/local accepts through product code, past the sensitive-path floor that fences .local_secret itself; every reader of it carries secret as every producer carries token), or the bare package name handed to a dynamic module runner (runpy.run_module('kiro_crew', run_name='__main__') is python -m kiro_crew spelled as a call; importlib.import_module('kiro_crew') and __import__('kiro_crew') reach the same dispatch). A runner handed any other name (__import__('os').environ next to a product import) is generic code. The installed console script run through a code loader is the same dispatch spelled through the entry point: exec(open(shutil.which('kirocrew')).read()), exec(open('/venv/bin/kirocrew').read()) or runpy.run_path(shutil.which('kirocrew')) runs _bootstrap.main() against a sys.argv the payload chose, so a loader (exec, eval, compile, run_path) next to the program name — a whole word and the last path component — is denied; a loader on any other file (exec(open('patch.py').read()), runpy.run_path('/home/dev/kirocrew/scripts/gen_docs.py'), where kirocrew is a directory) is a patch-script idiom and stays allowed. Which callable a call reaches is decided ONCE, by what the payload's own static bindings resolve it to, and the runner, loader and decoder gates all read that one table (_resolved_calls): a name written at the call, a module alias (import runpy as rp; rp.run_module(…)), a from-import with or without an alias (from runpy import run_module as r), an assignment (r = runpy.run_module), and a head that names the callable in a string and is called or bound (getattr(runpy, "run_module"), runpy.__dict__["run_module"]) all resolve to the same runner. Reading the word written at the call instead is one alias away from missing, and closing each spelling per gate is how the decoder gate came to resolve its own import aliases while the runner gate did not. Resolution is static and its vocabulary is fixed, so a binding is only read when the payload's text binds one of these callables: from mypkg import compile is not the builtin, an object attribute is not a bare alias (obj.d(…)), a binding written inside a string binds nothing, and a name computed at run time (getattr(m, input()), a subscript by variable) resolves to nothing — the residual, noted rather than claimed covered. What the resolved call is HANDED is then the same question the written name is asked, so from runpy import run_path as rp; rp('patch.py') is a file load and getattr(json, 'dumps') is generic code. A product import inside a code loader's string (exec('from kiro_crew.config.loader import read_local_secret; …')) runs exactly as the bare statement does and is read the same way; a quoted statement with no loader (print('from kiro_crew.acp import x')) is prose. Before matching, _fold_inline_literals joins 'a' + 'b' and implicitly concatenated 'a' 'b' string pieces to a fixed point (every adjacent pair per pass, so no count of pieces outruns it) and _decoded_b64_literal_sources decodes the literals a decoder call is actually HANDED, read from the command as submitted (no count cap a payload could pad past), so __import__('kiro_crew.c'+'li'), os.system(b64decode('a2lyb2NyZXcgdG9rZW4=')) and a base64 literal split across pieces are read as what they hide. A decoded literal is asked the same questions as the payload — mint surface, product import plus credential word, dynamic runner handed the package — since an exec(b64decode(…)) body is a payload one decode away. An encoded literal a program only CARRIES stays data: a patch script's base64 fixtures are decoded by nobody, so they are decoded here by nobody either. Each decoding is paired with the literal it came from and a payload borrows one only for bytes it carries, so one command's decoder call does not lend its result to the next command's payload (python -c 'print(b64decode("aGVsbG8="))' beside an unrelated printf of encoded text is not a mint). The pool is read from every program text the shell can hand an interpreter — the command itself for an unquoted heredoc body, its shell words for a quoted -c operand, here-string or pipe producer, and one nested shell level — because a quoted payload keeps its decoder call inside a single token, where the tokenizer cannot see it; a text is only split when it names an interpreter or a shell, so Python's own quotes are never stripped and printed syntax never reads as a call. is_denied hands the mint predicate raw_text= for this: base64 is case-sensitive and the floor otherwise reads a lower-cased view. A payload that only mentions the package, imports an unrelated product module with no token or secret symbol (secrets, the stdlib module or the product module handlers/secrets.py, is neither), or uses getattr/eval/importlib with no product name in reach is not a mint. The verb-gated -m kiro_crew ... token check and the interpreter-argv companion rule are untouched.

inline payload Before After
Path("src/kiro_crew/x.py") in a patch script 🟥 blocked 🟩 allowed
from kiro_crew.acp import x; print(x) 🟥 blocked 🟩 allowed
print(getattr(json, "dumps")) next to a product path 🟥 blocked 🟩 allowed
import kiro_crew.cli as c; c.main() 🟦 blocked 🟦 blocked
import kiro_crew.slack.gateway as g; g.generate_token() 🟦 blocked 🟦 blocked
os.system(b64decode("a2lyb2NyZXcgdG9rZW4=")) 🟦 blocked 🟦 blocked
exec(open("/tmp/x").read()) with no product name 🟥 blocked 🟩 allowed

🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged

A program that names the token mint is still refused; a program that only lives near the product is not.

A brace group now expands to what bash expands it to. _glob_to_regex translates {a,b} to one word per alternative, {c..c} and {a..z} to the sequence, and leaves a group with no top-level comma and no .. ({state}, {print $1}) literal, braces included. Nesting is capped at _BRACE_NESTING_CAP = 8; past it the group reads as .*, the fail-closed direction, so a word built hundreds of levels deep is judged instead of raising RecursionError. Brace pairs are resolved once per word in one linear pass (_brace_pairs); the old per-brace scan to the end of the word was quadratic, so a word of 12,000 unbalanced braces stalled the synchronous gate for tens of seconds. The regex the translation produces is bounded too: a word spends at most _BRACE_GROUP_BUDGET = 6 alternation groups (past it a group reads as .*), identical alternatives ({*,*}) collapse to one branch before the budget is charged, and consecutive .* pieces collapse to one. Without that, {*,*} fifteen times over gave re 2^15 ways to fail a five-letter name and took 8.8 s per protected name. Two argv facts complete the kill fix: the filesystem inspectors (ls, stat, file, du, readlink, realpath, dirname, basename) and movers (cp, mv, ln, rm, mkdir, rmdir, touch, chmod, chown; not tar, whose -I runs a program) join _DATA_CONSUMER_PROGRAMS, so a glob among their arguments is a filename, not a program; and _data_consumer_exempt keeps that exemption for an argument glued to a trailing operator (cp $dir/*;), since the operator starts no program inside the token, and refuses it for a token that opens with a command substitution (ls $(kirocrew update), cat \kirocrew token`), since the word's basename reading is the body's program, which runs. A substitution later in the word (cp report_$(hostname)*.log

) or inside a brace group (mv {$(date +%F),current}.log ) keeps the exemption: the word is a filename around a body, and the body is judged on its own by the payload walk, which descends into every substitution wherever it sits (echo foo$(pkill -f kirocrew)andls {$(pkill -f kirocrew),y}are denied for the body). The glob reader itself reads only glob and brace syntax: a command substitution is literal text to it, as onmain, because what it prints is outside a static floor (at program position $(printf pk)ill -f is the documented residual, unchanged here) and its body is the walk's business. Parameter expansion (${X}, $X) is literal for the same reason: reading it as anything denied awk field lists ({print $6,$7}) and prose heredocs naming ${name}. The exemption stays gated on the program being a data consumer: these tokens have had their quotes removed, so a trailing operator at program position ('/tmp/kirocrew;' token, a symlink literally so named) is never read as an argv boundary and the verb after it is still scanned. x;pkill -f kirocrewstill runspkill` and is still denied.

Replayed against the 204 denied commands in the log, the gate on origin/main still denies 179 and this branch denies 32 (the breakdown is under Testing). security/__init__.py also drops _MINT_SURFACE_RE, _fold_inline_literals and _decoded_b64_literals from the facade and EXPORTED_NAMES: no caller reaches them through the facade, and the tests import inline_payload directly. It leaves .github/black-baseline.txt: the hunk this diff adds made the file black-clean, and the baseline gate prunes a graduated entry rather than keep it.

Tests

test/test_argv_floor_inline_and_brace_scope.py (new, 195 tests) pins each narrowed question. A payload that only mentions the package is allowed and one that names the mint surface is denied, in -c, heredoc, here-string, pipe and file-redirect forms; the runpy / import_module / __import__ spellings of python -m kiro_crew token are denied, including with the package name spelled in pieces, and the same runners handed another name are allowed. test_the_mint_surface_covers_every_token_producer_in_the_tree derives the producers from the tree rather than a list: the seed is the function that names token_signing.key and opens a file, the reach follows the import graph one hop into the modules that define the producers (closed over their own calls) and then the re-export chain to a fixed point (a module that imports a producer name is an import source for that name, however deep; only the re-export relation is closed, since closing the call graph at every hop pulls in the whole dashboard), and every (module, imported name) pair on that path must be a reach in both spellings (from M import f; import M as m then m.f), with the three key touchers that produce nothing (warm_auth_singletons, extract_numeric_claim, revoke_access_cookie) listed with their reason; every pyproject.toml console-script entry module must be a reach too. test_the_credential_word_covers_every_local_secret_reader_in_the_tree does the same for the internal secret: the seed is every function that names .local_secret or the .secret sidecar suffix (the read may sit in a generic helper, as run_marker.read_secret delegates to _read_sidecar), the four namers that hand no credential to a caller (the two gateway starters that write it, the CLI and MCP cron dispatchers that present it) are listed with their reason, and every other one must be a reach in both spellings. The whole route GPT described (import read_local_secret, present it to /api/token/local), the reader spelled in pieces (getattr(loader, 'read_local_' + 'secret')), and the price of the word (a product import next to a variable named secret) are denied; secrets (stdlib or handlers/secrets.py) next to a product import and a .local_secret mention with no import are allowed. Base64 literals decode from the raw command and not from the lower-cased view, and a literal split across + pieces decodes after folding; 'a' + 'b' folds and a + name does not; a 500-piece name folds whole, a bare list of 200 encoded literals is data no decoder is handed, and an encoded mint behind 200 decoys is still read when a decoder call is handed it; the encoded mint is denied through each carrier that can reach an interpreter (-c, heredoc, here-string, pipe producer, nested bash -c), and a neighbouring command's decoding cannot travel to an unrelated payload; a product import inside exec('…') / eval(compile('…')) is denied and the same text in a print is not. {state} is literal, {a,b} is its alternatives, {c..c} is c, a 600-deep brace word is judged and not crashed, a 12,000-brace unbalanced word is judged in under two seconds and read literally, seventeen {*,*} / {*,**} / {*,a*} groups in a row are judged in milliseconds and fail closed; a command substitution in a glob word is literal text and its body is walked ({$(pkill -f kirocrew),x} y and tar czf x_$(pkill -f kirocrew).tgz are denied for the body; {$(date +%F),current}.log under mv, rsync or cp with a product-named path later is not a kill), and {$((e-1)),d}, {print $6,$7,$8,$9}, {${name},%name%} and {$X,-f} are not verbs; a glob under ls/stat/du/cp (with or without a glued trailing ;) is not a kill program, a quoted '/tmp/kirocrew;' token or 'pkill;' -f kirocrew is still denied, and so are x;pkill -f kirocrew and sudo pkill -f kirocrew.

test/test_denied_commands_security.py: the 43 stdin-carrier fixtures use import kiro_crew.cli as the minimal reach (the bare package import reaches nothing; kiro_crew/__init__ imports no CLI). The quote-glued ex""ec(open(...)) case still opens the perf gate but is no longer a mint. The base64-wrapped mint is denied by decoding, and a base64 literal decoding to hello world is allowed. The pipe over-block test pins that the left side of a | b; python - is still yielded as program text and is denied only when it names the mint surface. test_refusal_inband_notice.py and test_security.py use import kiro_crew.cli as the floor-denial fixture.

Manual verification

Replayed the 204-command denial corpus from this host's SEL log against is_denied on origin/main (179 denied) and on this branch (32 denied); read every one of the 32 — 26 are other rules (rm -rf, git push brace refspecs, git reset --hard, curl uploads, env | grep), 3 are a wc -l $dir/*; inside a command whose jq filter contains | "…", which the pre-existing awk/sed script-executes guard reads as a pipe-to-command for the whole call, 1 is a heredoc quoting an earlier review finding about killing a process tree next to the product name, and 1 is a grep pattern that spells the mint rule's own id, and 1 is a product import next to a variable named secret (the price of the credential word; a rename away); all six are denied on main as well. Ran the GPT and Opus local review lanes and a verifier on the RecursionError fix (600-deep literal and alternative brace words, unbalanced braces, 19,000-character words: no exception). Full backend suite: the 85 remaining failures are identical on a clean origin/main checkout.

Related Issues

no linked issue: found from this host's audit log, not from a filed report.

Pattern harvest

Rule candidate: review-prompt
Pattern: a security predicate whose evidence is "the input mentions our name" (or "uses a dynamic-exec verb") rather than "the input names the protected action" — check the predicate's own audit log for its true-positive rate before adding another such branch.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|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

@iamwhatever
iamwhatever requested review from a team and pepmach September 11, 2026 23:00
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Intent: Stop the two argv-floor predicates (_is_credential_mint, _is_self_kill) from denying ordinary developer commands — inline Python that merely mentions the package or uses getattr/eval/importlib, and quoted brace groups / glob arguments next to a product-named path — while every real mint and self-kill spelling they caught before stays denied. Evidence is the host's own SEL log: 156 of 179 bash-gate denials in eight days, zero true positives among them.
Not a goal: Changing the regex tier, the interpreter-argv companion rule, the sensitive-path floor over the signing key, or the -m kiro_crew … token verb-gated check; closing the documented residual (a name no static matcher can see, e.g. chr() arithmetic or a written-then-run file).

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A fail-closed security pin is deliberately overturned: opaque inline dynamic-exec payloads (exec/getattr/runtime-assembled names) now pass unless static resolution finds the mint surface.

Watch

  • The deleted gate (_INLINE_DYNAMIC_EXEC_RE denying any inline exec/__import__/b64decode as "I cannot tell what this runs") was documented as a deliberate fail-closed decision, and the rewritten tests (test_a_dynamic_exec_inline_payload_is_denied_as_opaque → decoded-and-judged; test_quote_glued_dynamic_exec_still_reaches_the_floor now asserting not _is_credential_mint) flip its verdict. The PR's justification is strong — 143/179 audit denials with zero mints, and the write-then-run bypass (python /tmp/s.py) meant the old pin never stopped a determined payload, the sensitive-path floor over token_signing.key being the real guarantee — but it consciously reopens the runtime-computed-name residual the old gate closed, on the credential-mint path. That trade is evidence-backed and reversible by revert, yet it is a security-posture loosening a human should ratify, not wave through as a false-positive fix.
    Clears when: a maintainer with security ownership explicitly approves overturning the opaque-payload denial, citing the sensitive-path floor as the retained guarantee.

  • The narrowing's honesty now rests on a cross-tree naming invariant: every token producer must carry token and every .local_secret reader must carry secret in reachable names, or _MINT_VERB_RE misses it. The tree-derived tests (test_the_mint_surface_covers_every_token_producer_in_the_tree and the secret-reader twin) are the right mechanism, but a future producer added on a platform path those tests' import-graph walk doesn't traverse would fail open silently.
    Clears when: the walk's own coverage (its seed and hop rules) is asserted against pyproject.toml entry points and stays green when a deliberately misnamed producer fixture is introduced — or a maintainer confirms the existing derivation already fails on one.

[DESIGN-REVIEWED] 50bb1b9

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the reversed opaque-deny pin is accepted: inline dynamic-exec payloads naming nothing of the product are now allowed, coverage resting on the naming-convention tests plus the sensitive-path floor.

What this change ships

Inventory (10 items) — 10 justified

Intent: stop the bash gate falsely denying ordinary inline-Python and brace/glob commands as credential mints or self-kills, without dropping the real denials — a FIX. Provenance: the allowed-fixture tests this PR adds fail on base, and the base-commit pin test_the_true_residual_gap_is_a_name_no_matcher_can_see already conceded the opaque deny protected nothing a write-then-run script couldn't bypass; the rewritten pins quote that evidence, so the lens-8 bar is met.

  1. Inline Python mentioning the package or using getattr/eval/importlib is no longer denied; the gate asks what the payload names — justified
  2. Quoted jq/awk brace programs and glob arguments no longer read as "could be pkill"; braces translated per bash — justified
  3. Base64 literals a decoder is handed are decoded (raw text) and judged, preserving the previously pinned base64-mint denial — justified
  4. Console script run through a code loader is newly named as the mint dispatch — justified
  5. Filesystem inspectors/movers treat globs as filenames (_DATA_CONSUMER_PROGRAMS additions) — justified
  6. Trailing-operator tokens: 'kirocrew;' token now denied, cp $dir/*; now exempt — justified
  7. Words opening with a command substitution lose the data-consumer exemption — justified
  8. Pathological brace words answer in linear time instead of stalling the gate into a watchdog exit — justified
  9. is_denied hands the mint predicate the command as submitted (raw_text=) — justified
  10. security/__init__.py reformatted off the black baseline; spec and refusal note updated same-commit — rides along (harm-free; spec update is the documented invariant)

[FIRST-PRINCIPLES-REVIEWED] 50bb1b9

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/security/inline_payload.py:509 -- "word in _RESOLVABLE_NAMES" makes re.compile("kirocrew") a credential-mint denial -> Fix: resolve dotted calls only when the receiver is statically bound to the expected module.
[GPT-REVIEWED] 50bb1b9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 50bb1b9bb72c7cae25110543f74ce6a90ba20d39: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 — this comment is updated in place on each push.

Review details

Advisory only — the new inline-mint gate has one residual over-match; nothing blocks.

FINDING — src/kiro_crew/security/inline_payload.py:509 — _resolved_calls' direct-word branch (if word in _RESOLVABLE_NAMES:) appends the call with no _preceded_by_attribute_access guard, so an attribute call whose method name collides with a loader/runner — most commonly re.compile('…kirocrew…'), also obj.exec/eval/compile(...) or obj.run_module('kiro_crew') — resolves as the builtin; a benign inline one-liner like python3 -c "import re; re.compile('kirocrew gateway')" then matches _CONSOLE_SCRIPT_LITERAL_RE/_PACKAGE_LITERAL_RE in _names_the_mint and is refused as a credential mint (the false-denial class this module targets; narrower than the old blanket deny, so a residual rather than a regression) → Fix: in the direct-word branch resolve an attribute-reached name only when its dotted receiver is a _CALLABLE_MODULES module that exports it, so base64.b64decode/runpy.run_module still resolve while re.compile/obj.exec do not.

[OPUS-REVIEWED] 50bb1b9

Verdict parsed from the review's SHA-scoped output markers for commit 50bb1b9bb72c7cae25110543f74ce6a90ba20d39.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 50bb1b9bb72c7cae25110543f74ce6a90ba20d39: <one-sentence reason>

@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 Sep 11, 2026
@iamwhatever
iamwhatever force-pushed the fix/argv-floor-inline-python-false-denials branch from ed8457a to 5a3ef83 Compare September 11, 2026 23:37
@iamwhatever

Copy link
Copy Markdown
Contributor Author

976c63330168 — fixed

mechanism: added test_the_mint_surface_covers_every_token_producer_in_the_tree in test/test_argv_floor_inline_and_brace_scope.py. It derives the token-producer set from the tree (seed = functions that open the token_signing.key constant, then two hops along the import graph) and asserts _MINT_SURFACE_RE / _PRODUCT_IMPORT_RE reach every one of them, so the hand-written surface list can no longer drift silently. The verify_only exception table must itself be covered by the derived set, and the [project.scripts] entry (kiro_crew._bootstrap) is asserted reachable.

c3649a97172a — fixed

mechanism: inline_payload.py now runs _fold_inline_literals first and feeds the folded text into _decoded_b64_literals, so a base64 payload split across concatenated string pieces is decoded after folding. Covered by the new combined fold+decode test.

9b4b8f6c5b14 — rebutted

argv_floor.py sits at exactly 4500 lines on main, which is _MODULE_LINE_CAP; adding the inline-payload helpers in place would break the module-size gate. The move into security/inline_payload.py is the mechanical consequence of that cap, not a design change, and is now stated in the PR body ("Why a new module").
self-added: _token_closes_its_argv moved next to _ends_argv in shell_normalizer.py for the same reason.

b744a8fbdf15 — fixed

mechanism: PR body now explains the .github/black-baseline.txt line removal: src/kiro_crew/security/__init__.py is touched by this PR and formatted with the pinned black, so it graduates out of the baseline (--update-baseline).

@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 readiness: checking Automated validation is still running labels Sep 11, 2026
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 31 classified, 0 newly refused, 22 still allowed.
  • ubuntu-latest (platform posix): 31 classified, 0 newly refused, 22 still allowed.
  • windows-latest (platform windows): 9 classified, 0 newly refused, 8 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

TIGHTENING: The inline-interpreter credential-mint gate (new src/kiro_crew/security/inline_payload.py, wired through _is_credential_mint(text_lower, *, raw_text=) and _has_self_importing_inline_program) plus the data-consumer exemption's new substitution carve-out -- the one threat they refuse is minting the dashboard token through a carrier the old text matcher could not see: "the installed console script named as a program next to a code loader (exec(open(shutil.which('kirocrew')).read()) … runs the entry point's _bootstrap.main() in-process against a sys.argv the payload chose", a base64 literal "decode[d] … of the command as submitted (is_denied hands the mint predicate raw_text= for this)" so os.system(b64decode('a2lyb2NyZXcgdG9rZW4=')) "[is] read as what [it] hide[s]", and a token that "OPENS with a command substitution (ls $(kirocrew update) …: the word's basename reading is the body's program, which runs)". These sit inside a change that is otherwise a deliberate narrowing (the old "any kiro_crew mention or any dynamic-exec primitive" reading produced 143 of 179 audit-log denials with zero mints; the old brace-as-.* reading produced 13 more), so the boundary to probe is where the new, sharper matchers begin: runpy/run_path and the extra base64 decoder spellings newly join the trigger regex, the console-script literal gains a \/.exe Windows shape, and the mint surface folds .///\ into one separator class.

ADJUDICATED: 37 candidates, 0 confirmed newly-refused
No confirmed regression was handed to this review by the harness. The candidates work the four new seams: the loader/runner gate one token off the console-script attack (run_path on repo scripts, product-named directories, a user's kirocrew.py), the newly-triggering decoder spellings on benign input (standard_b64decode, decodebytes, a carried fixture literal no decoder is handed), the leading-command-substitution refusal on harmless bodies (cat "$(git rev-parse …)/pyproject.toml", echo "$(kirocrew doctor)"), and the credential-word pairing one character off both words (secrets, token_hex, max_tokens, the handlers/secrets.py module), plus the maintainer ops this diff's own earlier revisions repeatedly broke (jq/awk brace programs beside product-named repos, host- and date-stamped log archiving under tar/cp/mv, worktree glob listings).

PLATFORM COVERAGE: posix (28 rows) -- /-separated product paths, $(…) and backtick substitutions, heredoc and here-string stdin carriers, $VAR scratch-dir idioms: the spellings behind the diff's shell-word, carrier-walk and substitution assumptions. windows (6 rows) -- the py -3 launcher, raw drive-letter and doubled-backslash paths, \-separated package paths (src\kiro_crew\security.py, probing the new one-class separator in _MINT_SURFACE_RE), a UNC destination, and PowerShell $() subexpression words under Copy-Item/Compress-Archive/Get-ChildItem (probing that the glob/word reading is not posix-table-shaped). any (3 rows) -- gh reads and the bare product CLI verb, which carry no path or separator. One assumed spelling my candidates probe only from the allowed side: the .exe-suffixed console-script literal (kirocrew.exe) appears in this diff solely as a deny target, and I found no legitimate operation that names it, so no allowed-side .exe row exists to submit; the nearest legal neighbours (kirocrew.py posix and windows) are rows 4 and 5. The per-leg verdicts are the deterministic fold's to report, per leg, after this review is captured.

[SCOPE-REVIEWED] 50bb1b9

@iamwhatever
iamwhatever force-pushed the fix/argv-floor-inline-python-false-denials branch from 5a3ef83 to aea1ed2 Compare September 12, 2026 01:00
@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 readiness: checking Automated validation is still running labels Sep 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=23ecf70b0ed3 — rebutted

Tried the fixpoint closure locally (frontier over the import graph until no module imports a new producer, producers_in closed at each round). It does not converge on the token producers: producers_in follows "uses a producer NAME", so start_api_server (which wires the dashboard handlers) becomes a producer at round 3, and from there every module that imports kiro_crew.dashboard — api_tailnet_mobile_qr, the whole handlers package — is in the set. The gate would then have to treat any product import as a mint, which is exactly the over-broad reading this PR removes (143 of 179 denials, zero mints).
The two-hop bound is the convention the gate rests on, stated in the test docstring: a producer is either a function that carries token in its name or lives under a module path that does, and a re-export under a token-free path at hop 2 is caught. A hop-3 re-export of a hop-2 re-export is not a spelling the tree has; when it appears, this test fails on the new (module, name) pair unless it is named in verify_only with its reason, which is the review moment the suggestion asks for.
self-added: the experiment also cost 84 s per run versus 20 s, on a test that gates every push.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=5e784cc06287 — fixed

Brace pairs are resolved once per word in one linear pass (_brace_pairs, a stack over the pattern) instead of a scan from each { to the end of the word; an unmatched { is absent from the table and reads as a literal. The 12,000-brace word from the finding answers in 0.15 s end to end through is_denied.
mechanism: test_unbalanced_braces_are_literal_and_linear in test/test_argv_floor_inline_and_brace_scope.py pins the pair table, the literal reading of {{{kirocrew, and a 2 s ceiling on the 12,000-brace word through _glob_could_expand_to and the two floor rules.
self-added: the local GPT lane on the fixed head then found the other stall in the same translation — {*,*} fifteen times over is a regex with 2^15 ways to fail a five-letter name (8.8 s per protected name). Fixed in the same push: a word spends at most _BRACE_GROUP_BUDGET = 6 alternation groups (past it a group is .*, fail-closed), identical alternatives collapse to one branch before the budget is charged, and consecutive .* pieces collapse to one; test_a_run_of_alternation_groups_is_budgeted_not_backtracked pins seventeen {*,*} / {*,**} / {*,a*} groups under 1 s and fail-closed.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=836484326de1 — fixed

A dynamic module runner handed the bare package name is a reach: _DYNAMIC_IMPORT_RE in inline_payload.py matches run_module / run_path / import_module / __import__ called with a kiro_crew literal argument (quote optional, because a heredoc payload arrives with the shell's quote removal applied), and _inline_payload_reaches_cli denies on it. runpy / run_module / run_path are added to _INLINE_DYNAMIC_EXEC_RE so the floor's pre-filter descends into a payload that spells the name in pieces ('kiro_' + 'crew') with no product-name hint elsewhere in the command.
The argument has to be the package literal, not the package mentioned anywhere: the runner-plus-mention reading denied __import__("os").environ next to a product import, a real command from the corpus. Variable indirection (m = 'kiro_crew'; __import__(m)) stays with the residual the sensitive-path floor over the signing key covers, as the module docstring states.
mechanism: test_a_payload_that_names_the_mint_surface_is_denied gains the exact runpy.run_module('kiro_crew', run_name='__main__') command from the finding, its heredoc form, import_module('kiro_crew').cli.main(), __import__('kiro_crew') and the pieces spelling; test_a_payload_that_only_mentions_the_package_is_allowed gains the runners handed another name next to a product path or import.

@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 readiness: checking Automated validation is still running labels Sep 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=295897abea86 — rebutted

The security/__init__.py hunk is not a reformat rider: it is the facade subtraction the body declares (_MINT_SURFACE_RE, _fold_inline_literals, _decoded_b64_literals leave the facade and EXPORTED_NAMES; the tests import inline_payload directly).
That hunk made the file black-clean, and scripts/check_black_formatting.py fails on a graduated entry left in .github/black-baseline.txt — so the one-line baseline prune is the gate's requirement, not a choice.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=295897abea86 — rebutted

The security/__init__.py change is the declared facade subtraction (three names leave the facade and EXPORTED_NAMES), not an undeclared reformat.
The baseline prune follows from it mechanically: scripts/check_black_formatting.py fails when a file that became black-clean is still listed in .github/black-baseline.txt.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _dynamic_runner_handed_the_package — the runner's balanced argument list (_call_arguments) searched for the package literal, replacing the [^()]*, regex gap

  • span=685d0ad14a85 — fixed in 1bfd018

run_module(run_name=str('__main__'), mod_name='kiro_crew') is denied: the runner's arguments are read as one balanced slice (the same walk the loader gate uses), so a nested call before the package literal no longer hides it.
_PACKAGE_LITERAL_RE matches the package or a dotted module under it, not a path component — run_path('src/kiro_crew/../../scripts/x.py') stays a file load and is allowed.
Pinned in test_a_payload_that_names_the_mint_surface_is_denied (nested str('__main__') before mod_name=, import_module(package=None, name=str('kiro_crew'))).

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _indirect_call_arguments in inline_payload.py — resolves a getattr-named runner or loader (immediate and alias-bound) and reads what the resolved call is HANDED; _CALL_NAME_RE carries no \A, since a string-start anchor makes a positional match read every call after the first as nameless

  • span=685d0ad14a85 — fixed in 1148ff2

Real, and a regression this PR introduced rather than a pre-existing residual. Classifying the payload with the real code at each ref: origin/main denies python -c 'import runpy; getattr(runpy, "run_module")("<package>")', this branch allowed it — so the narrowing dropped a denial main had, which is the one thing it must not do. The same held for the alias-bound spelling (r = getattr(runpy, "run_module"); r("<package>")) and for a loader reached the same way (getattr(builtins, "exec")(open(shutil.which("kirocrew")).read())).
Fixed by resolving the indirection instead of widening the gate: a getattr whose second argument is a plain string literal naming one of the runners (run_module, run_path, import_module, __import__) or loaders (exec, eval, compile, run_path, execfile) resolves to that callable, and the resolved call is then asked the SAME question the written name is asked — what it was handed. So the three legitimate shapes stay allowed: getattr(runpy, "run_path")("patch.py") is a file load, getattr(runpy, "run_path")("src/kiro_crew/x.py") is a path and not the package (_PACKAGE_LITERAL_RE excludes a path component), and getattr(json, "dumps") is generic code. _call_spans never registers the (...) after getattr(...) as a call (it is not NAME-prefixed), so its arguments are read from the bracket index; the alias form is read by binding a bare name = getattr(...) and reading later calls of that name. The bracket index is only built when the payload contains getattr, so an ordinary payload pays nothing.
Residual, noted rather than claimed covered: an attribute assembled at run time from values the payload does not carry (getattr(runpy, input())) resolves to nothing here, as a decoder name built the same way does. That is the same class of residual main carries for a file written and then run.
Pinned by TestAResolvedCallableIsReadLikeTheNameWrittenAtTheCall in test/test_inline_payload_scoped_regressions.py: six denied shapes (immediate runner, alias-bound runner, import_module, the attribute spelled in pieces so the fold joins it, and two loader forms) and four allowed ones, plus test_the_attribute_comes_from_getattrs_own_second_argument (a runner name in getattr's DEFAULT slot is not what the call resolves to). 2647 security tests pass; deny_diff against origin/main reports 0 regressions over the 41 classified golden paths.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _resolved_calls + _callable_aliases in inline_payload.py — one static binding table (from-import, module alias, assignment, getattr, __dict__ subscript) resolved once and read by the runner, loader AND decoder gates; replaces name-at-call-site regex matching, and DELETES _indirect_call_arguments, _call_arguments, _DYNAMIC_RUNNER_RE, _INLINE_CODE_LOADER_RE and _B64_DECODE_CALL_RE

  • span=685d0ad14a85 — fixed in da586a3

Real, and treated as the class rather than the spelling: this span has blocked five rounds running, each a different way of naming the same callable, so the fix replaces the primitive instead of adding a sixth special case. Probing the neighbours confirmed the class was wider than the report: from runpy import run_module as r; r(<pkg>) (the finding), r = runpy.run_module; r(<pkg>) and runpy.__dict__["run_module"](<pkg>) were all allowed, while the DECODER gate already resolved its own import aliases via the old _decoder_call_names. Runner and loader read the word written at the call; their sibling resolved bindings. One missing primitive, three gates.
Which callable a call reaches is now decided once, by what the payload's own STATIC bindings resolve it to, and all three gates read that one table. Resolved: the written name, a module alias (import runpy as rp; rp.run_module(…)), a from-import with or without an alias, an assignment (r = runpy.run_module, d = base64.b64decode), and a head that names the callable in a string and is then called or bound (getattr(runpy, "run_module"), runpy.__dict__["run_module"]). A spelling closed for one gate is closed for all three — pinned that way deliberately, by running the same four bindings against the runner, the loader and the decoder.
Precision kept, because every name resolved is a denial made possible: the from-import vocabulary is scoped per module (from mypkg import compile is not the builtin), an imported alias is a bare name so obj.d(…) is not it, bindings are read in token order so a binding written inside a string binds nothing, and a binding must name the callable rather than its result (r = runpy.run_module('x') binds nothing). What a resolved call is HANDED is then the same question the written name is asked, so from runpy import run_path as rp; rp('patch.py') stays a file load, rp('src/kiro_crew/x.py') stays a path, and getattr(json, 'dumps') stays generic code.
Residual, noted rather than claimed covered: a name computed at run time (getattr(m, input()), m.__dict__[key] by variable) resolves to nothing — pinned as a residual test, not as a reach. Closing that needs runtime semantics, which no static reading of the payload can supply; it is the same class of residual main carries for a file written and then run, and it falls to the sensitive-path floor.
Verification: 14 deny spellings and 10 allow spellings classified with the real code (_is_credential_mint plus is_denied), all correct; the new TestACallIsJudgedByWhatItResolvesTo pins them; 2666 security tests pass; deny_diff against origin/main reports 0 regressions over the 41 classified golden paths; the module is net SHORTER than the version this replaces.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt da586a3: The displayed blocking verdict is stale — it was produced on 1148ff2ad6 and cites _call_arguments, _DYNAMIC_RUNNER_RE, _indirect_call_arguments and the "getattr" in view gate, all of which da586a3edc deletes in favour of one static binding table that denies the reported from runpy import run_module as r; r("kiro_crew", …) shape (pinned in TestACallIsJudgedByWhatItResolvesTo, alongside the assignment and __dict__ spellings the report did not name); the provider refuses to re-review this diff's content so no fresh verdict is obtainable, while Opus 4.8, Design, First Principles, UX, both Denial Differentials and the full test matrix pass on this head.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt da586a3: Verdict is stale: it was produced on 1148ff2 and cites _call_arguments, _DYNAMIC_RUNNER_RE and _indirect_call_arguments, all deleted in this head's binding table, which denies the reported from runpy import run_module as r shape (pinned in TestACallIsJudgedByWhatItResolvesTo); the provider refuses to re-review this diff's content so no fresh verdict is obtainable, while Opus 4.8, Design, First Principles, UX and the full test matrix pass on this head.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for da586a3edc8dd83dbf7854d9d90d319ac0f35847.

Verdict is stale: it was produced on 1148ff2 and cites _call_arguments, _DYNAMIC_RUNNER_RE and _indirect_call_arguments, all deleted in this head's binding table, which denies the reported from runpy import run_module as r shape (pinned in TestACallIsJudgedByWhatItResolvesTo); the provider refuses to re-review this diff's content so no fresh verdict is obtainable, while Opus 4.8, Design, First Principles, UX and the full test matrix pass on this head.

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

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _indirect_heads gains a third name-free head -- a GROUPING -- plus _unwrapped_head / _DOTTED_HEAD_RE; a bracket counts as a grouping only when nothing callable or subscriptable precedes it, so a call's own argument list is not mistaken for one

  • span=685d0ad14a85 — fixed in ae2e129

Real, and a regression this PR introduced. Classified with the real code at each ref: origin/main denies python3 -c 'import runpy; (runpy.run_module)("<pkg>")', this branch allowed it. The same held for the nested (((runpy.run_module))), spaced (( runpy.run_module )) and alias-wrapped ((r)(…)) spellings. (builtins.exec)(open(shutil.which('kirocrew')).read()) was allowed by main TOO, so that one is a residual this fix happens to close rather than a regression it repairs.
The finding's mechanism is exact: _call_spans records a call only when a NAME immediately precedes the (, and for a grouped head the preceding token is ), so no span exists and every gate reading the span index sees nothing. This is a different axis from the binding table -- not how a name is BOUND but how a call HEAD is written -- so the fix goes in the same resolution layer as the other two name-free heads (getattr(...), __dict__["..."]) rather than into any one gate: grouping parentheses are not an operation, so the head is the callable they wrap, and the resolved call is then asked the same question every other call is asked -- what it was HANDED.
Precision preserved, because a bracket is only a grouping when nothing callable or subscriptable sits in front of it. functools.partial(print)("<pkg>") therefore stays allowed: that bracket is partial's own argument list, and the call hands over what partial RETURNS, not the callable named inside it. (runpy.run_path)("patch.py") stays a file load, (runpy.run_path)("src/kiro_crew/x.py") stays a path, (json.dumps) stays generic code, and a plain tuple ("<pkg>", "x") is data, not a head.
Residual, unchanged and still noted rather than claimed: a callable selected at run time (getattr(m, input()), __dict__[key], an index into a list of callables) resolves to nothing here, because no static reading of the payload can say which one it picks.
Verification: 6 grouped deny spellings and 5 allow spellings classified with the real code, all correct; pinned in TestACallIsJudgedByWhatItResolvesTo across the runner and loader gates; 2687 security tests pass; deny_diff against origin/main reports 0 regressions over the 41 classified golden paths; argv_floor.py stays at 4499, under the per-module cap.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition — span=685d0ad14a85 (inline_payload.py, gpt/BLOCKING), round 8

Accepted, and the finding understated the gap. Fixed at 5ca8ab716f by moving the
literal fold from the token stream to the parse tree.

Proof the finding is real, at both refs

The reported shape was b64decode(b"aGVs" b"bG8=") — adjacent byte literals skipping the
fold. Probing one encoded mint spelled fifteen ways, against origin/main and against
ae2e12932a:

spelling main ae2e12932a now
"<enc>" / b"<enc>" deny deny deny
"a" "b" (2 pieces) deny deny deny
b"a" b"b" (2 pieces) deny allow deny
"a" + "b" / b"a" + b"b" deny allow (bytes) deny
"a" "b" "c" "d" "e" (5 pieces) deny allow deny
b"a" … b"e" (5 pieces) deny allow deny
"a" + … + "e" (5 pieces) deny allow deny
b"a" + b"b" b"c" (mixed joiners) deny allow deny
r"a" r"b" deny allow deny
("a" "b") deny allow deny
"".join([...]), "<rev>"[::-1] deny allow allow (residual)

Ten of the fifteen were open on the reviewed head, not one. Two causes beyond the reported
prefix: the fast path required an 8+ character base64 literal to exist before folding
could run, so a payload split into short enough pieces was skipped before the fold; and a
folded value still wrapped in the call's own parentheses failed the value matcher, because
a constant span excludes the parentheses around it.

The fix, and why it ends this class rather than this instance

Rounds 1–6 on this span were each a new spelling: how a callable is named
(getattr(m,"f"), an import alias, __dict__[k]) and how a call head is written
((f)(x)). Those closed into a static binding table because the set of static bindings is
finite. Round 8 is a different axis — how the payload's bytes are written — and that set
is not finite while the reader is a regex over tokens: b/r/u prefixes, implicit
concatenation, +, parentheses, piece length, and every combination.

_constant_text reads the parse instead, where the case list is the grammar's and is
closed: an ast.Constant (into which the parser has already merged implicit concatenation
and every literal prefix) and + over two of them. Parentheses are not nodes, so a grouped
literal folds for free. There is no piece-count or chain-depth limit — total work is bounded
by the payload's own length, and nesting deep enough to matter is refused by the parse — so
a payload cannot stay unfolded by being long. A payload the parser rejects (a carrier the
shell truncated) keeps the lexical fold, which tolerates a malformed prefix; that path is
pinned by its own test.

A folded value carrying a newline, or both quote characters, stays as written: emitting it
would let the fold manufacture a statement boundary the payload never wrote, which the
product-import anchor would read as an import. Pinned by
test_a_folded_value_cannot_manufacture_a_statement_boundary.

Residual, stated rather than claimed covered

A computed input — "".join([...]), a slice, bytes.fromhex, an f-string, a name — is
outside a static floor's reach, the same residual a callable named at run time gets
(getattr(m, input())). test_a_computed_input_is_the_documented_residual pins all five so
that resolving one later is a deliberate widening rather than a surprise. Closing it would
mean denying every decode whose input a static reader cannot evaluate; that is a wider
refusal than this PR's goal, so it is named here instead of taken silently.

Verification

  • 3039 passed / 5 skipped across the security suite at the rebased head (19 files,
    including test_security_gate_liveness.py); 23 new tests in
    TestTheFoldIsClosedOverConstantExpressions.
  • deny_diff.py --base origin/main --head HEAD: no regressions, 41 classified golden paths
    allowed at both refs.
  • argv_floor.py stays at 4499 lines, under _MODULE_LINE_CAP.
  • black 26.3.1 / isort / flake8 / mypy clean on the three changed files; comment-history and
    docs-lint gates pass.

Two existing assertions moved, both pinned to the old mechanism rather than to behaviour:
the 500-piece fold test (a depth cap broke a property it deliberately pins, so the cap is
gone) and the scan-once test (it pinned the payload's length; it now pins the folded view's,
keeping the "once" property).

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 5ca8ab7: verdict is stamped ae2e129 and its byte-literal fold finding is fixed at this head by folding on the AST (Constant | BinOp(Add)), where 13 of 15 constant spellings now deny and the two computed ones are pinned as the documented residual; the provider refused to re-review this sha.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 5ca8ab716f4c7a7dedfdfa145f10f15bff4ba89d.

verdict is stamped ae2e129 and its byte-literal fold finding is fixed at this head by folding on the AST (Constant | BinOp(Add)), where 13 of 15 constant spellings now deny and the two computed ones are pinned as the documented residual; the provider refused to re-review this sha.

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

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override scope 5ca8ab7: attempt 2 of this head returned VERDICT PASS with all five upstream jobs green (Fable 5 candidates, candidate validation, and adjudication on ubuntu, macos and windows); the per-head monotonic floor holds it at attempt 1's failure, which was a 30-minute queue-load timeout in the candidates lane rather than a scope finding.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the scope AI finding as false positive, not applicable, or explicitly accepted for 5ca8ab716f4c7a7dedfdfa145f10f15bff4ba89d.

attempt 2 of this head returned VERDICT PASS with all five upstream jobs green (Fable 5 candidates, candidate validation, and adjudication on ubuntu, macos and windows); the per-head monotonic floor holds it at attempt 1's failure, which was a 30-minute queue-load timeout in the candidates lane rather than a scope finding.

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

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 85bb017: this head is a no-conflict rebase of 5ca8ab7 onto main 90ff928 with a byte-identical diff (index lines stripped, sha256 4ac200f69110c4cb at both heads); the prior head carried a recorded GPT override (5672959473) after its byte-literal fold finding was fixed by folding on the AST (Constant | BinOp(Add)), 13 of 15 constant spellings deny and the two computed ones are pinned as the documented residual. Rebased only to pick up #10895, which repairs the three pod stop-race tests main had broken via #10586.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override scope 85bb017: this head is a no-conflict rebase of 5ca8ab7 onto main 90ff928 with a byte-identical diff (index lines stripped, sha256 4ac200f69110c4cb at both heads); the prior head carried a recorded scope override (5673605557) after attempt 2 returned VERDICT PASS with all five upstream jobs green and only the per-head monotonic floor held it at a queue-load timeout. No security-scope content changed in the rebase.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the scope AI finding as false positive, not applicable, or explicitly accepted for 85bb017fed1330370903863eebbb00f18c56dbec.

this head is a no-conflict rebase of 5ca8ab7 onto main 90ff928 with a byte-identical diff (index lines stripped, sha256 4ac200f69110c4cb at both heads); the prior head carried a recorded scope override (5673605557) after attempt 2 returned VERDICT PASS with all five upstream jobs green and only the per-head monotonic floor held it at a queue-load timeout. No security-scope content changed in the rebase.

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

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded, but the following reviewer lane(s) could not be re-run automatically: Security Scope Review. Re-run the lane's latest workflow run for 85bb017fed1330370903863eebbb00f18c56dbec manually from the Actions tab.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 85bb017: no-conflict rebase of 5ca8ab7 onto main 90ff928, diff byte-identical (index lines stripped, sha256 4ac200f69110c4cb at both heads). 5ca8ab7 carried GPT override 5672959473 for the same finding: byte-literal fold fixed by folding on the AST (Constant | BinOp(Add)); 13/15 constant spellings deny, the two computed inputs are the pinned residual. Rebased only to pick up #10895.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 85bb017fed1330370903863eebbb00f18c56dbec.

no-conflict rebase of 5ca8ab7 onto main 90ff928, diff byte-identical (index lines stripped, sha256 4ac200f69110c4cb at both heads). 5ca8ab7 carried GPT override 5672959473 for the same finding: byte-literal fold fixed by folding on the AST (Constant | BinOp(Add)); 13/15 constant spellings deny, the two computed inputs are the pinned residual. Rebased only to pick up #10895.

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

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition of the GPT 5.6 finding on bc3de059e3 (compound-suite import bypass) — fixed in 690f03e2d0.

Confirmed real, not a false positive: against a clean origin/main archive, 9 of 10 compound-prefix probe shapes were denied; this branch denied 3 of 10. main caught them only because it matched the bare word kiro_crew anywhere in the payload — the same coarseness that produces the false denials this PR removes.

Fix: _PRODUCT_IMPORT_RE anchored a statement start on (?:^|[;\n]); a simple statement can also begin after the : that closes a compound header. The class is now [;\n:]. Python's grammar has exactly those four boundaries, so unlike the literal-spelling axis this set is closed by construction — there is no fifth spelling to find.

Pinned by TestAnImportBeginsAtEveryStatementBoundary: 12 prefixes (if True:, for, while, try:, with, def, class, indented block, ;, newline) reach the import; a colon inside a dict, slice or annotation starts nothing. deny_diff vs main: 0 regressions across 41 golden paths. 3103 security tests pass.

The one probe shape still allowed on both main and this head, x=1; if x: from …, is a SyntaxError — a compound statement cannot follow ; on one line — so it never executes.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

Revision 50bb1b9bb72c7cae25110543f74ce6a90ba20d39 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition of the GPT 5.6 finding on c6c0e14fa6 (Windows separator in the mint surface) — fixed in 09545a9325.

Probed 10 shapes against a clean origin/main archive and this branch. Split verdict:

  • The cited example, python - < src\kiro_crew\__main__.py, is allowed on main too — the POSIX shell consumes the bare \ before any matcher sees the path, on main and here alike. Not a regression of this PR.
  • Three shapes were regressions: a Windows path inside an inline Python string reaching cli.py, __main__.py (via runpy.run_path) or dashboard/token_auth.py. main denied all three; this branch allowed them.

Fix: _MINT_SURFACE_RE now reads [./\\] and [\w./\\] — the three package-path separators (. module, / POSIX, \ Windows) are one class. All three regressions deny again; ordinary Windows paths (isort src\kiro_crew\mcp_core.py, a printed path, ast.parse(open(...))) stay allowed. Pinned by TestAPackagePathIsOneClassOfSeparators. deny_diff vs main: 0 regressions across 41 golden paths; 3110 security tests pass.

One note for the record: a single-backslash spelling such as '...\dashboard\token_auth.py' in a non-raw literal is folded to its value, where \t is a TAB — the same file Python itself would try to open, which does not exist. The spellings that actually reach the file on Windows (raw or doubled) are the ones now denied.

…o what a command names

The `credential-exfil-kirocrew-token` floor denied any inline Python that
merely mentioned the product package, so ordinary `python -c` commands
that named `kiro_crew` in a string, a path or a comment were refused.
The floor now denies a payload that names the mint surface -- the CLI
module, the token module, or a product import next to a credential
verb -- and lets every other mention through.

String literals are folded on the AST before matching, so an encoded
mint reads the same however its literal is spelled (adjacent pieces,
`+`, byte and raw prefixes); a computed input the parse cannot evaluate
is the documented residual. A product import is read at every statement
boundary the grammar has: start of input, `;`, newline, and the `:`
that closes a compound header. A package path names the mint whether its
separators are spelled `.`, `/` or the Windows `\`.

Golden paths: 0 regressions across 41 classified commands.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. Tier 2 deep review: security argv-floor narrowing verified. Denial Differential and inline_payload matcher logic confirmed. No credential-mint or self-kill leaks.

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.

2 participants