Skip to content

fix(security): deny mutating tailscale subcommands (replaces #8262) - #21149

Closed
iamwhatever wants to merge 2 commits into
mainfrom
replace/8262
Closed

iamwhatever wants to merge 2 commits into
mainfrom
replace/8262

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Status: parked

This PR is parked as a draft at head e85340b54 by the owner's decision. No further pushes are planned.

What it does. It adds network-exposure deny rows for the tailscale subcommands that widen this machine's network exposure (serve, funnel, node-state verbs, drive, file cp). They are enforced by an argv floor (security/exposure_floor.py) that mirrors the self-protection subcommand floor on the unchanged shared shell walk.

Why it is parked. GPT and Opus blocked the floor's brace-expansion code four times. Each fix round found a new way around it.

Open findings on e85340b54:

  • Brace word at or before the verb (GPT, Opus). Bash puts every alternative into the argv, but the floor judges each alternative alone. So tailscale {file,cp} /etc/passwd peer:, tailscale {,--socket} /var/run/tailscale/tailscaled.sock serve --bg … and tailscale {--socket,/sock} funnel 3000 are allowed.
  • Security Scope, 1 row. cat > /tmp/commit-message.txt <<'EOF' with a line naming tailscale serve is refused. This is the inherited quoted-heredoc class.
  • First Principles, advisory. file cp is egress rather than exposure, and logout narrows exposure the way the dropped down verb does. Both are scope questions for the Goal.

Shared gaps. The shell-walk gaps that every argv floor inherits are tracked in #21345.


Replaces #8262

Carries over @GoZippy's #8262 with authorship kept (commit 1, git cherry-pick -x), rebased onto current main, plus one commit that moves the family's enforcement from pattern text to an argv-structural floor. Thank you, @GoZippy.

Problem / Motivation

Goal: The agent's own bash cannot widen this machine's network exposure by running the raw tailscale CLI.

No DeniedCommandRule in BUILTIN_DENIED_RULES names tailscale. Putting the dashboard on the tailnet is a governed action: tailnet_serve.publish() is owner-only, SEL-audited and honours capabilities.tailnet_origin. That governance lives at the dashboard/CLI seam. The raw tailscale CLI sits below it, and the agent has a bash tool. So from bash the agent can run tailscale serve to publish the dashboard, tailscale funnel to expose a local service to the public internet, or tailscale up/set to enable an SSH server or advertise this node as an exit or subnet router, all bypassing publish() and its pin.

Why it matters

"The agent can never widen its own network exposure" is the invariant the governed publish path exists to uphold, and today one bash call defeats it. tailscale funnel is the sharpest case: a local service becomes reachable from the open internet with no gate in the path. On Windows there is no OS sandbox under the bash tool to catch it either.

Not a goal

  • Moving any OTHER catalog rule off text matching. r=rm; $r -rf / behaves as it does on main.
  • Reaching a name the command text does not determine (an earlier tool call, a computed value, a library call from an interpreter).
  • Inverting the node-state row to deny-by-default behind a read allowlist.
  • tailscale down and tailscale exit-node: they narrow exposure or move egress, so they are outside the Goal (possible follow-up).

What changed (motivation → approach → change)

Root cause. Governance for tailnet exposure is enforced at publish(), not at the command layer, and the denied-command gate (the one place that does sit on the agent's bash) had no rule for tailscale.

Commit 1 (@GoZippy): the rows. A network-exposure category of catalog rows: serve, funnel, node-state (up/set/login/logout/switch/cert/web), drive, file cp. Commit 2 drops GoZippy's exit-node row and the down verb so the rows match the Goal exactly: they narrow exposure or move egress rather than widen it (a possible follow-up, judged on its own). Reads stay allowed, configure kubeconfig is outside the family, and Kiro Crew's own publish path (tailnet_serve._run, subprocess.run) never passes through the gate.

Why not a text pattern. As text, the rows either refuse commands that only NAME a subcommand (the Security Scope Review confirmed grep -rn "tailscale serve" docs/, git log --grep="tailscale funnel", commit messages, PR titles, pytest -k "tailscale serve", echo "Run: sudo tailscale set …"), or, anchored, miss shell grammar the anchor does not model (if true; then tailscale funnel 3000; fi). That is the same loop that closed the regex dd rule in #17894.

Commit 2: an argv floor. security/exposure_floor.py::_tailscale_exposure_rule is a thin mirror of the self-protection subcommand floor (argv_floor._matches_self_subcommand) on the UNCHANGED shared walk (shell_normalizer._shell_payload_walk, no hooks; shell_normalizer.py is identical to main):

  • Frames: the command and every $( ), backtick, process substitution, sh -c and eval payload, tokenized with quoting resolved and same-line literal assignments substituted.
  • Position-blind, fail-closed: EVERY token whose basename is tailscale/tailscale.exe (any case, either path separator, or a glob that could expand to it) is a candidate unless _data_consumer_exempt says it is an argument of a data consumer (echo, grep, rg, cat, …).
  • Its leading non-flag operands are read against a verb table (_operands_lead_with) with exact read carve-outs, each the word right AFTER the verb (serve status, serve get-config, funnel status, drive list, switch --list). There is no --help carve-out: a mutating verb with a help flag is refused, as the self-protection floor refuses kirocrew restart --help. --socket takes a value, and a redirect glued to the verb (up>/tmp/log) is cut off. The first two operands are brace-expanded with a depth cap ({funnel,}, file {cp,}). A word the expansion leaves unchanged ('{status}') is a literal, and an expansion that cannot be computed fails closed.
  • It is handed the command AS SUBMITTED, so assignments resolve case-sensitively: ts=tailscale; TS=echo; "$ts" funnel 3000 is refused.
  • It gets the enabled row ids and scans past a disabled match. Like git-publish, is_denied removes the five patterns from the regex tier, so the floor is the only enforcement, gated per row.
  • Inherited over-refusals, the same class main's floors already refuse (git grep -e git -e push origin main, git grep -n kirocrew restart are refused on main): git grep -e tailscale -e up, docker compose up -d tailscale web, a wrapper before grep, and a heredoc body or single-quoted backtick naming a subcommand. They are shared-walk gaps, tracked in shell-normalizer shared gaps #21345 and pinned with their sibling by test_the_floor_inherits_the_shared_walks_over_refusals.

Review history

Head Lane Finding Disposition
8548306c5 Security Scope 7 read-only commands naming a subcommand refused (match-anywhere .*tailscale) Superseded: text matching removed
055ac3b0d Opus / GPT / Security Scope Anchored regex: quadratic on sudo a/a/…; if …; then tailscale bypass; lowercase resolver merged ts/TS; backtick/heredoc refusals Superseded: branch reset to GoZippy's commit, replaced by the argv floor
430afae7a GPT 6.1 / Opus F1 disabled row hid an enabled one; F2 timeout 30 bash <<EOF; F3 '{status}' recursion; F4 git grep -e tailscale -e up refused; mypy F1, F3 kept in the floor (enabled ids, brace guard + cap). F2, F4 and the mypy error were in pieces since removed (see next row)
f0bb5b491 GPT 6.1 5 bypasses: echo ready;tailscale funnel, 2>&1 tailscale funnel, ((1<<shift)) then funnel, "$s" <<EOF, $(echo tailscale funnel …); plus Opus's tailscale up>/tmp/log and cat <<EOF | bash Root cause: the floor had its OWN program-position finder and heredoc stripping. Main's floors have neither: they are position-blind and fail closed, and a probe showed every one of them refuses these shapes. Both pieces were removed, and the floor now mirrors _matches_self_subcommand on the unchanged shared walk. All seven are must-refuse tests. The glued-verb redirect is cut in the floor's own operand reader
f0bb5b491 Security Scope echo "Run \tailscale serve status`"` refused Inherited shared-walk behaviour (escaped and single-quoted backticks), listed in #21345
f0bb5b491 Backend Tests (Windows) .result(timeout=10) tripped the wait-discipline ratchet Fixed: 30 s
f0bb5b491 Opus 5.5 API rate limit, no verdict Infra
c9b284f29 GPT 6.1 tailscale funnel --bg 3000&&echo --help (help carve-out read across a glued &&); tailscale file {cp,}; brace overflow read as a literal Fixed fail-closed: --help carve-out removed, a read is only the word right after the verb; first two operands brace-expanded; an expansion that cannot be computed denies. Tests for each
c9b284f29 Security Scope tailscale serve get-config --all refused Fixed: get-config is a serve read
c9b284f29 Security Scope 6 inherited over-refusals (docker compose / kubectl / gh arguments) Not changed: same class main's floors refuse (#21345), owner decision
c9b284f29 First Principles Description contradicted the diff; exit-node and down outside the Goal Description was stale when read (already corrected); exit-node row and down verb dropped

Rebase onto main. Conflicts resolved in the deny_guidance.py category list, the rule-count pin (113 -> 119) and the golden fixture (main's order kept, six rows appended). The spec paragraphs now describe the floor. _PACKAGE_LINE_BUDGET is raised to the measured package total (29,866).

Backwards compatibility

Compatible: the six rows only add refusals, and each is an ordinary user-disableable catalog row. shell_normalizer.py is unchanged, so no other floor's input changes.

Removes nothing: the change adds deny rows and a floor for those rows only; no path, record, key or public function is removed or renamed.

Tests

  • test_tailscale_network_exposure_family, test_the_windows_spelling_is_covered, test_reading_the_help_is_not_a_mutation: the deny/allow matrix for all six rows (GoZippy's, unchanged).
  • test_tailscale_is_judged_as_the_program_through_shell_grammar: every refused spelling, including the seven bypass shapes from the last two GPT/Opus rounds, if true; then …; fi, both orders of ts/TS, $(echo tailscale) funnel, {tailscale,} funnel, tailscale {funnel,}, bash <<EOF and timeout 30 bash <<'EOF'.
  • test_tailscale_named_as_data_is_not_refused: the Security Scope false positives from the first head (grep/rg/git log/commit/PR title/pytest -k/echo, a multi-line quoted --body).
  • test_the_floor_inherits_the_shared_walks_over_refusals: each inherited over-refusal next to the sibling main's own floors already refuse.
  • test_tailscale_rows_never_reach_the_regex_tier: the six patterns never run; each row toggles only its own verbs; a disabled serve does not hide funnel.
  • test_a_literal_brace_operand_is_answered_not_recursed: tailscale '{status}' returns and is allowed; file {cp,} and a 257-comma overflow are refused (30 s bound).
  • test_a_help_flag_does_not_excuse_a_mutating_verb: serve --help, funnel --bg 3000&&echo --help and switch other&&echo --list are refused; switch --list and bare --help are allowed.
  • test_a_long_flag_run_is_read_as_flags.
  • Local: TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over every test file that touches is_denied or the catalog, plus the line-budget and wait-discipline ratchets -> 13021 passed. The 5 failures in test/test_terminal_handler.py fail the same way on clean main (host shells). flake8, isort and mypy are clean. check_comment_history.py and check_file_line_cap.py pass (0 failures).

Manual verification

N/A — unit coverage sufficient: the change is a pure command-text decision in is_denied, exercised directly by the tests above.

Related Issues

Replaces #8262. Shared shell-walk gaps this floor inherits: #21345.

Pattern harvest

Rule candidate: review-prompt
Pattern: a deny rule written as a text pattern over a shell command; judge the argv program instead (as git-publish, ssh-to-self and the self-protection floors do).

Checklist

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

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/deny_guidance.py

  • src/kiro_crew/security/__init__.py

  • src/kiro_crew/security/denied_rules.py

  • src/kiro_crew/security/exposure_floor.py

  • @iamwhatever posted a complete reasoning template for e85340b.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

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

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Check that the operator-facing deny guidance for these rows points the agent at kirocrew tailnet up and not at a dead end.

[DESIGN-REVIEWED] e85340b

Description read

[DESCRIPTION-READ] ed12aea40dd7438a536abedcf757adc7cf29239ee3d23168eff383c7696046f2

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of e85340b5498ae20fee6eae8df7348f615c98d202 — 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: CONCERNS

The file cp row is out of the Goal and rests only on symmetry, and the node-state row keeps logout, which by the PR's own test narrows exposure.

Not justified as shipped

  • Item 5 — oversized: the Goal is "cannot widen this machine's network exposure". Taildrop sends one file to a peer, which is egress, not exposure. Its only stated support is symmetry: "the drive row's question asked one object smaller".
    Subtraction: delete network-exposure-tailscale-file-cp and its (("file","cp"), …) entry in _VERB_RULES.
    Clears when: the row is removed, or a human amends the Goal.
  • Item 3 — inherited: down was dropped because "they narrow exposure", but logout stays in the up|set|login|logout|switch|cert|web set, and taking the node off the tailnet narrows it the same way.
    Subtraction: remove logout from the node-mutate frozenset.
    Clears when: logout is removed, or a widening it causes is named.

What this change ships

Inventory (8 items) — 6 justified

Intent: stop the agent's bash from exposing this host through the raw tailscale CLI, below the governed publish path — FIX.

  1. tailscale serve mutations refused; status/get-config allowed — justified
  2. tailscale funnel refused — justified
  3. up/set/login/logout/switch/cert/web refused — logout contradicts the PR's own "narrows" boundary
  4. tailscale drive mutations refused — justified
  5. tailscale file cp refused — oversized, egress not exposure
  6. Rows enforced by the argv floor (exposure_floor.py), with patterns taken out of the regex tier — justified
  7. Each row can be toggled on its own, and a disabled row no longer hides an enabled one — justified
  8. New network-exposure category in the spec and deny-guidance comment — justified

[FIRST-PRINCIPLES-REVIEWED] e85340b

Description read

[DESCRIPTION-READ] 09d95f8f97d148cf044202696b708878a328f32b956f4073c181a829ffe946bf

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging e85340b5498ae20fee6eae8df7348f615c98d202. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/security/exposure_floor.py:159 -- Brace-expanded global flags bypass exposure denial
expanded = operands[:position] + ([alt] if alt else []) + operands[position + 1 :]
On a host where the agent’s user can configure Serve, tailscale {,--socket} /var/run/tailscale/tailscaled.sock serve --bg --https=443 http://127.0.0.1:5476 -> _tier_deny_rules / is_denied allows it because brace expansion occurs after flag parsing -> Bash produces a valid --socket … serve invocation and publishes outside tailnet_serve.publish; the daemon socket is not sandbox-masked.
Anchor: residual/security
Fix: Expand brace words into the resulting argv before _words strips flags and consumes --socket values.
[BLOCK-MERGE] e85340b
[GPT-REVIEWED] e85340b

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 (fenced): UPHOLD-FENCED. This is a governance-ceiling bypass. The construction is ordinary bash, not an extreme condition.

  • Why the brace word slips through: _words (exposure_floor.py:113-117) sees {,--socket} without a leading -, so it records it as an operand and sets verb_seen. That means the _VALUE_FLAGS skip at :114 never consumes the socket path. The operands become ["{,--socket}", "/var/run/…sock", "serve", …].

  • Why neither expansion is refused: _verdicts (:148-161) expands position 0 into "" and --socket. The first gives ["/var/run/…", "serve", …], the second gives ["--socket", "/var/run/…", "serve", …]. Neither starts with a _VERB_RULES verb (:58-67, checked at :134), so _verdict returns None for both and the floor allows the command (:191-194).

  • Why it still runs: bash drops the empty alternative and runs tailscale --socket /var/run/… serve --bg …. The floor has no recovery path. The only other condition, an agent user with Serve permission, is a normal operator setup, and a prompt-injected agent can produce this command on purpose.

    [ADJUDICATION] e85340b total=0 uphold=0 downgrade=0
    [GPT-ADJUDICATED] e85340b

    [ADJUDICATION-FENCED] e85340b fenced=1 flagged=0
    UPHOLD-FENCED F1 src/kiro_crew/security/exposure_floor.py:159 -- _words counts a brace word like {,--socket} as an operand, so the socket path is never skipped as a flag value and neither expansion starts with a verb; bash then runs a valid tailscale --socket … serve that the floor allows, which an adversarial agent can produce on an ordinary Serve-capable host.
    [GPT-ADJUDICATED-FENCED] e85340b

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

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — 🔴 changes requested (blocking)

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

Brace expansion in the new tailscale floor is handled wrong, so tailscale {file,cp} /etc/passwd peer: gets past every network-exposure row.

BLOCKING — src/kiro_crew/security/exposure_floor.py:159
expanded = operands[:position] + ([alt] if alt else []) + operands[position + 1 :] / out.extend(_verdicts(expanded, after_verb, depth + 1))
Bash turns a brace word into ALL of its alternatives as separate words (bash -c 'echo tailscale {file,cp} x' → tailscale file cp x). The floor instead judges each alternative alone, as though only one of them would run. So for tailscale {file,cp} /etc/passwd peer: it checks [file, /etc/passwd, …] and [cp, …] separately, and neither one starts with the file cp verb. For tailscale {--socket,/sock} funnel 3000, the flag that comes out of the expansion lands in the operand slot, and the verb walk misses funnel. Both commands return falsy from security.is_denied (I checked this at runtime). The regex tier for these rows is stripped at security/__init__.py:1265, and no sandbox mask covers tailscale, so the agent's bash can Taildrop a host file to another node or open a public Funnel.
Fix: put every non-empty alternative into the argv in place of the brace word (operands[:p] + [a for a in alternatives if a] + operands[p+1:]). Then recompute operands and _VALUE_FLAGS skipping on the expanded argv (re-run the _words logic over the expanded raw tokens) instead of judging each alternative separately. The other option is to fail closed with _ALL_RULES whenever a brace group comes before or at the verb and expands to more than one word.

[BLOCK-MERGE] e85340b
[OPUS-REVIEWED] e85340b

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

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

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🔴 BLOCK (blocking)

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

Verdict basis: a script-confirmed newly-refused operation.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 30 classified, 1 newly refused, 29 still allowed.
  • ubuntu-latest (platform posix): 30 classified, 1 newly refused, 29 still allowed.
  • windows-latest (platform windows): 21 classified, 0 newly refused, 21 still allowed.

Newly refused (confirmed by the real classifier at both refs)

  • cat > /tmp/commit-message.txt <<'EOF' feat(security): refuse raw tailscale serve and funnel from bash EOF (posix, leg macos-latest)
    • Who loses it: The maintainers' own commit flow (golden row git commit -F /tmp/commit-message.txt) for this very feature; a quoted heredoc to a file is data.
    • Refused by: deny-rules -- Blocked by security policy: .tailscale(?:.exe)?(?:\s+--?[a-z-]+(?:[= ]\S+)?)\s+serve(?!\s+(?:status|get-config)\b)\b.*
      Matched structurally on the command's argv, not by the pattern text above: tailscale is the argv's own program and its leading subcommand changes this machine's network exposure.
  • cat > /tmp/commit-message.txt <<'EOF' feat(security): refuse raw tailscale serve and funnel from bash EOF (posix, leg ubuntu-latest)
    • Who loses it: The maintainers' own commit flow (golden row git commit -F /tmp/commit-message.txt) for this very feature; a quoted heredoc to a file is data.
    • Refused by: deny-rules -- Blocked by security policy: .tailscale(?:.exe)?(?:\s+--?[a-z-]+(?:[= ]\S+)?)\s+serve(?!\s+(?:status|get-config)\b)\b.*
      Matched structurally on the command's argv, not by the pattern text above: tailscale is the argv's own program and its leading subcommand changes this machine's network exposure.

Each row above is an operation that the base ref ALLOWS and this change REFUSES. Narrow the rule at the tier named. Withdrawing a row is not the way to green: that is its own pull request, on its own merits.

Scope-Verdict: CONCERNS

TIGHTENING: A new argv-structural floor, exposure_floor._tailscale_exposure_rule, wired into is_denied as the only enforcement for five new network-exposure catalog rows. Their patterns are removed from the regex tier (regex_patterns = [p for p in regex_patterns if p not in _rules._NETWORK_EXPOSURE_FLOOR_PATTERNS]). -- The one threat: the agent's own bash widening this machine's network exposure below the governed tailnet_serve.publish seam. The hunk is _VERB_RULES = ((("serve",), …serve), (("funnel",), …funnel), (frozenset({"up","set","login","logout","switch","cert","web"}),), …node-mutate), (("drive",), …drive), (("file","cp"), …file-cp)), with reads carved out only by the word right after the verb (_READS).

ADJUDICATED: 37 candidates, 0 confirmed newly-refused (no harness verdicts reached this review, so no row is confirmed)

PLATFORM COVERAGE:

  • posix: The diff assumes slash-separated paths and a case-insensitive basename match, so the rows include:
    • a full-path binary with a capitalised basename (/Applications/Tailscale.app/Contents/MacOS/Tailscale status);
    • --socket in both its separate-value and glued = spellings, ahead of read verbs;
    • path tokens whose basename is tailscale: docker exec tailscale …, kubectl … deploy/tailscale, go run ./cmd/tailscale, and the redirect target _tailscale;
    • pipes and || after a read verb;
    • a quoted heredoc written to a commit-message file.
  • windows: The diff adds tailscale.exe, splits on \ as well as /, and lowercases the program name, so the rows include:
    • bare tailscale.exe;
    • a quoted C:\Program Files\Tailscale\tailscale.exe path;
    • the PowerShell & call operator;
    • uppercase TAILSCALE.EXE;
    • package and service names that contain the program name (winget … Tailscale.Tailscale, Restart-Service Tailscale).
  • any: The read verbs whose spelling is the same on both hosts: status, serve status, whois, ip, funnel status, serve get-config, help serve, dns, exit-node suggest, debug prefs, lock status. Also the governed kirocrew tailnet status/down.
  • Not covered: No candidate uses a UNC (\\server\share\tailscale.exe) spelling, because I could not attribute one to a real user. Unquoted backslash Windows paths are not probed either; the PR documents that the floor does not reach them, so they cannot newly refuse anything.

UNADJUDICATED: Nothing outside the shell deny composite is touched. Two things still lack a verdict.

  • The verdict itself. The verdict depends on the harness classifying the rows above. Until it reports, "no confirmed regressions" is not evidence.
  • A narrowing I can argue but not confirm. The node-mutate row refuses set as a whole verb. But the product's own error text in tailnet_serve.py:656 and :812, and docs/guides/remote-and-mobile.md:395, tell the user to run sudo tailscale set --operator=$USER. An agent following that instruction now gets a pattern refusal instead of the cause. This is a privilege grant over tailscaled rather than a network-exposure widening. It sits inside the threat's verb, so I left it out of candidates.json and raise it here instead. The narrowest fix keeps set refused and changes the refusal guidance to name the operator grant as an owner action. The network-exposure category deliberately gets no guidance in deny_guidance._CATEGORY_CLASSES, so the agent receives no hint that the step is the owner's.

[SCOPE-REVIEWED] e85340b

The confirmed rows, in the committed corpus's own shape
{
  "golden_paths": [
    {
      "kind": "shell",
      "command_or_flow": "cat > /tmp/commit-message.txt <<'EOF'\nfeat(security): refuse raw tailscale serve and funnel from bash\nEOF",
      "platform": "posix",
      "reason": "The maintainers' own commit flow (golden row `git commit -F /tmp/commit-message.txt`) for this very feature; a quoted heredoc to a file is data."
    }
  ]
}

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 38c82ec
  • What rule changed: Adds six network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. Like git-publish, the six patterns are removed from the regex tier and never run; the floor is gated per row. shell_normalizer._shell_payload_walk gains two keyword hooks (prepare, bodies) that default to the current behaviour; only the new floor passes them. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: when tailscale/tailscale.exe is the PROGRAM of an argv (directly, behind sudo/env/timeout/nice/nohup, after ;/&&/|/newline/then/do/!, in a subshell, $( ), backticks, sh -c, eval, a heredoc fed to a shell, or through a same-line literal variable) and its leading subcommand is serve/funnel/up/down/set/login/logout/switch/cert/web/drive/file cp/exit-node, it is BLOCKED. Reads stay ALLOWED: status, serve status, funnel status, drive list, exit-node list/suggest, switch --list, --help, netcheck, ping, whois, version, configure, file get. A command that only names a subcommand as data stays ALLOWED (grep, git log --grep, commit messages, PR titles and bodies, echo, quoted-heredoc commit messages, single-quoted backticks).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking a legitimate tailscale-related command from agent bash. Known cases: ssh host tailscale up (a remote node's exposure) and a double-quoted backtick span naming a mutating subcommand (bash really runs it). No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: 45 bypass spellings refused and 24 data mentions allowed in the new tests, plus GoZippy's original 6-row matrix. A spy on _deny_pattern_matches shows the six patterns never run (3000-flag run, 16 KB sudo a/a/...). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over the 109 test files that touch is_denied or the catalog: 13540 passed; the 5 test/test_terminal_handler.py failures fail identically on clean main 74a249d48 (host shells), unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): the walk hooks default to None, so the self-protection, git-publish and ssh floors receive identical frames (their suites pass unchanged); the golden fixture keeps main's order with the six rows appended; operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, plus every other file that calls is_denied.
  • How to undo: disable any of the six network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit 38c82ec and commit f0e04f2.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 430afae
  • What rule changed: Adds six network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. Like git-publish, the six patterns are removed from the regex tier and never run; the floor is gated per row. shell_normalizer._shell_payload_walk gains two keyword hooks (prepare, bodies) that default to the current behaviour; only the new floor passes them. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: when tailscale/tailscale.exe is the PROGRAM of an argv (directly, behind sudo/env/timeout/nice/nohup, after ;/&&/|/newline/then/do/!, in a subshell, $( ), backticks, sh -c, eval, a heredoc fed to a shell, or through a same-line literal variable) and its leading subcommand is serve/funnel/up/down/set/login/logout/switch/cert/web/drive/file cp/exit-node, it is BLOCKED. Reads stay ALLOWED: status, serve status, funnel status, drive list, exit-node list/suggest, switch --list, --help, netcheck, ping, whois, version, configure, file get. A command that only names a subcommand as data stays ALLOWED (grep, git log --grep, commit messages, PR titles and bodies, echo, quoted-heredoc commit messages, single-quoted backticks).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking a legitimate tailscale-related command from agent bash. Known cases: ssh host tailscale up (a remote node's exposure) and a double-quoted backtick span naming a mutating subcommand (bash really runs it). No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: 45 bypass spellings refused and 24 data mentions allowed in the new tests, plus GoZippy's original 6-row matrix. A spy on _deny_pattern_matches shows the six patterns never run (3000-flag run, 16 KB sudo a/a/...). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over the 109 test files that touch is_denied or the catalog: 13548 passed; the 5 test/test_terminal_handler.py failures fail identically on clean main (host shells), unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): the walk hooks default to None, so the self-protection, git-publish and ssh floors receive identical frames (their suites pass unchanged); the golden fixture keeps main's order with the six rows appended; operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, plus every other file that calls is_denied.
  • How to undo: disable any of the six network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit 430afae and commit 63eb6d8.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f0bb5b4
  • What rule changed: Adds six network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. Like git-publish, the six patterns are removed from the regex tier and never run; the floor is gated per row. shell_normalizer._shell_payload_walk gains two keyword hooks (prepare, bodies) that default to the current behaviour; only the new floor passes them. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: when tailscale/tailscale.exe is the PROGRAM of an argv (directly, behind sudo/env/timeout/nice/nohup, after ;/&&/|/newline/then/do/!, in a subshell, $( ), backticks, sh -c, eval, a heredoc fed to a shell, or through a same-line literal variable) and its leading subcommand is serve/funnel/up/down/set/login/logout/switch/cert/web/drive/file cp/exit-node, it is BLOCKED. Reads stay ALLOWED: status, serve status, funnel status, drive list, exit-node list/suggest, switch --list, --help, netcheck, ping, whois, version, configure, file get. A command that only names a subcommand as data stays ALLOWED (grep, git log --grep, commit messages, PR titles and bodies, echo, quoted-heredoc commit messages, single-quoted backticks).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking a legitimate tailscale-related command from agent bash. Known case: a double-quoted backtick span naming a mutating subcommand (bash really runs it). No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: 49 bypass spellings refused and 27 data mentions allowed, plus a disabled-row test and a no-hang brace test, in the new tests, plus GoZippy's original 6-row matrix. A spy on _deny_pattern_matches shows the six patterns never run (3000-flag run, 16 KB sudo a/a/...). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over the 109 test files that touch is_denied or the catalog: 13549 passed; the 5 test/test_terminal_handler.py failures fail identically on clean main (host shells), unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): the walk hooks default to None, so the self-protection, git-publish and ssh floors receive identical frames (their suites pass unchanged); the golden fixture keeps main's order with the six rows appended; operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, plus every other file that calls is_denied.
  • How to undo: disable any of the six network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit f0bb5b4 and commit 20377de.

@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 Oct 16, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c9b284f
  • What rule changed: Adds six network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. The floor mirrors argv_floor._matches_self_subcommand on the unchanged shared walk (shell_normalizer.py is identical to main). Like git-publish, the six patterns are removed from the regex tier and never run; the floor is gated per row. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: any argv token that is the tailscale/tailscale.exe program, and is not an argument of a data consumer (echo, grep, cat, …), is BLOCKED when its leading subcommand is serve/funnel/up/down/set/login/logout/switch/cert/web/drive/file cp/exit-node. That holds in the same shapes the existing floors cover (separators, wrappers, reserved words, subshells, $( ), backticks, sh -c, eval, heredocs, same-line variables). Reads stay ALLOWED: status, serve status, funnel status, drive list, exit-node list/suggest, switch --list, --help, netcheck, ping, whois, version, configure, file get. Mentions inside one quoted word stay ALLOWED (grep -rn "tailscale serve", git log --grep, commit messages, PR titles and bodies, echo "…").
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking. The floor inherits the over-refusals the existing floors already have on main: an argument of a non-data-consumer (git grep -e tailscale -e up, docker compose up -d tailscale web, time grep tailscale up), and a heredoc body or single-quoted backtick naming a subcommand. Each has a refused sibling on main (git grep -e git -e push origin main, git grep -n kirocrew restart). They are tracked in shell-normalizer shared gaps #21345. No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: every bypass shape from the GPT/Opus rounds (including echo ready;tailscale funnel, 2>&1 tailscale funnel, ((1<<shift)) + funnel, "$s" <<EOF, $(echo tailscale funnel …), tailscale up>/tmp/log, cat <<EOF | bash) is refused; a spy shows the six patterns never run; tailscale '{status}' returns. Probe of main's floors against the same shapes: /home/ec2-user/workplace/wt-8262/RETRO.md (table copied into shell-normalizer shared gaps #21345). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over every test file that touches is_denied or the catalog, plus the line-budget and wait-discipline ratchets: 13021 passed. The 5 test/test_terminal_handler.py failures fail identically on clean main (host shells) and are unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): shell_normalizer.py is unchanged, so the self-protection, git-publish and ssh floors receive identical input (their suites pass unchanged). The golden fixture keeps main's order with the six rows appended. Operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, test_wait_discipline_ratchet.py, plus every other file that calls is_denied.
  • How to undo: disable any of the six network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit c9b284f and commit 7a90824.

1 similar comment
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c9b284f
  • What rule changed: Adds six network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. The floor mirrors argv_floor._matches_self_subcommand on the unchanged shared walk (shell_normalizer.py is identical to main). Like git-publish, the six patterns are removed from the regex tier and never run; the floor is gated per row. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: any argv token that is the tailscale/tailscale.exe program, and is not an argument of a data consumer (echo, grep, cat, …), is BLOCKED when its leading subcommand is serve/funnel/up/down/set/login/logout/switch/cert/web/drive/file cp/exit-node. That holds in the same shapes the existing floors cover (separators, wrappers, reserved words, subshells, $( ), backticks, sh -c, eval, heredocs, same-line variables). Reads stay ALLOWED: status, serve status, funnel status, drive list, exit-node list/suggest, switch --list, --help, netcheck, ping, whois, version, configure, file get. Mentions inside one quoted word stay ALLOWED (grep -rn "tailscale serve", git log --grep, commit messages, PR titles and bodies, echo "…").
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking. The floor inherits the over-refusals the existing floors already have on main: an argument of a non-data-consumer (git grep -e tailscale -e up, docker compose up -d tailscale web, time grep tailscale up), and a heredoc body or single-quoted backtick naming a subcommand. Each has a refused sibling on main (git grep -e git -e push origin main, git grep -n kirocrew restart). They are tracked in shell-normalizer shared gaps #21345. No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: every bypass shape from the GPT/Opus rounds (including echo ready;tailscale funnel, 2>&1 tailscale funnel, ((1<<shift)) + funnel, "$s" <<EOF, $(echo tailscale funnel …), tailscale up>/tmp/log, cat <<EOF | bash) is refused; a spy shows the six patterns never run; tailscale '{status}' returns. Probe of main's floors against the same shapes: /home/ec2-user/workplace/wt-8262/RETRO.md (table copied into shell-normalizer shared gaps #21345). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over every test file that touches is_denied or the catalog, plus the line-budget and wait-discipline ratchets: 13021 passed. The 5 test/test_terminal_handler.py failures fail identically on clean main (host shells) and are unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): shell_normalizer.py is unchanged, so the self-protection, git-publish and ssh floors receive identical input (their suites pass unchanged). The golden fixture keeps main's order with the six rows appended. Operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, test_wait_discipline_ratchet.py, plus every other file that calls is_denied.
  • How to undo: disable any of the six network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit c9b284f and commit 7a90824.

GoZippy and others added 2 commits October 16, 2026 18:55
… 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.

(cherry picked from commit aec20bf)
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
@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 Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: e85340b
  • What rule changed: Adds five network-exposure deny-catalog rows in src/kiro_crew/security/denied_rules.py (commit 1, @GoZippy; commit 2 drops its exit-node row and the down verb as outside the Goal) and their only enforcement, a new argv-structural floor security/exposure_floor.py::_tailscale_exposure_rule, wired into is_denied in security/__init__.py. The floor mirrors argv_floor._matches_self_subcommand on the unchanged shared walk (shell_normalizer.py is identical to main). Like git-publish, the five patterns are removed from the regex tier and never run; the floor is gated per row. deny_guidance.py only adds network-exposure to the no-guidance category list. No existing rule is modified or removed.
  • Before -> after (what was allowed/blocked, now): BEFORE: every tailscale command was allowed from agent bash, including tailscale funnel (public internet) and tailscale serve (tailnet publish outside publish()). AFTER: any argv token that is the tailscale/tailscale.exe program, and is not an argument of a data consumer (echo, grep, cat, …), is BLOCKED when its leading subcommand is serve/funnel/up/set/login/logout/switch/cert/web/drive/file cp. That holds in the same shapes the existing floors cover (separators, wrappers, reserved words, subshells, $( ), backticks, sh -c, eval, heredocs, same-line variables). Reads stay ALLOWED: status, serve status, serve get-config, funnel status, drive list, switch --list, netcheck, ping, whois, version, configure, file get. Mentions inside one quoted word stay ALLOWED (grep -rn "tailscale serve", git log --grep, commit messages, PR titles and bodies, echo "…").
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Over-blocking. The floor inherits the over-refusals the existing floors already have on main: an argument of a non-data-consumer (git grep -e tailscale -e up, docker compose up -d tailscale web, time grep tailscale up), and a heredoc body or single-quoted backtick naming a subcommand. Each has a refused sibling on main (git grep -e git -e push origin main, git grep -n kirocrew restart). They are tracked in shell-normalizer shared gaps #21345. No secret exposure and no lock-out: the floor only refuses and never grants; each row is user-disableable; Kiro Crew's own tailnet_serve publish path spawns tailscale via subprocess.run and never passes this gate.
  • Evidence checked (which sandbox result proves it): Local is_denied on this head: every bypass shape from the GPT/Opus rounds (including echo ready;tailscale funnel, 2>&1 tailscale funnel, ((1<<shift)) + funnel, "$s" <<EOF, $(echo tailscale funnel …), tailscale up>/tmp/log, cat <<EOF | bash) is refused; a spy shows the five patterns never run; a mutating verb with --help is refused; file {cp,} and an uncomputable brace expansion are refused; tailscale '{status}' returns. Probe of main's floors against the same shapes: /home/ec2-user/workplace/wt-8262/RETRO.md (table copied into shell-normalizer shared gaps #21345). CI Security Scope adjudication on this head is pending.
  • No regression:
    • Tools still work (which tools/commands were run, result): TMPDIR=/tmp/r8262 PYTHONPATH=src pytest -n 8 over every test file that touches is_denied or the catalog, plus the line-budget and wait-discipline ratchets: 13021 passed. The 5 test/test_terminal_handler.py failures fail identically on clean main (host shells) and are unrelated.
    • Backward compatible (old config / old data / old callers still work, how checked): shell_normalizer.py is unchanged, so the self-protection, git-publish and ssh floors receive identical input (their suites pass unchanged). The golden fixture keeps main's order with the five rows appended. Operator custom rules are untouched.
    • Existing tests (which suites passed on this head): test_denied_commands_security.py, test_deny_guidance.py, test_security*.py, test_hooks*.py, test_tailnet*.py, test_wait_discipline_ratchet.py, plus every other file that calls is_denied.
  • How to undo: disable any of the five network-exposure-tailscale-* rows in the Denied Commands panel (the floor honours it per row), or revert commit e85340b and commit eb191b2.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Closing this parked draft. The description says no further pushes are planned, and the AI review blocked the brace-expansion floor four times. The remaining shell-parsing gaps are tracked in #21345, so that issue is the place to pick this up again. The branch stays, so this can be reopened if the approach comes back. Thanks for the work here.

@iamwhatever iamwhatever closed this Nov 1, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants