Skip to content

fix: backport #30824 to 0.12.1 (self-management command check) - #33030

Merged
buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-wide-7
Nov 8, 2026
Merged

buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-wide-7

Conversation

@buluoray

@buluoray buluoray commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring the last value-2 fix, #30824, merged on main after v0.12.0, onto release/0.12.0 as one commit in a PR of its own.

Why it matters

PR Reported by What a 0.12.0 user sees today Faulty code on release
#30824 bolichen97 The tool gate refuses a self-management command in its plain form, but one more spelling of it gets through. security/argv_floor_self.py

Not a goal

  • No fix that is not already merged on main; nothing is changed only here.
  • No version bump, no tag, no CHANGELOG.md change.

What changed (motivation → approach → change)

The main squash commit f09c835400 was cherry-picked with -x onto release/0.12.0 @ a0b61daa99 as 2f2a740184. The code, spec and test hunks applied cleanly.

One hand edit, in a test: test/test_security_gate_liveness.py. On release this pick takes the security package to 34,697 lines, 3 over its budget there, so _PACKAGE_LINE_BUDGET is raised by 3 with a comment saying why. This is the same thing earlier backports did on release, for example #27257's +107. Main has more headroom, so main's commit did not need it.

The commit is authored with the public identity because the commit guard refuses the original address on a hand-edited pick; its message names Bolin Chen.

Backwards compatibility

Breaking: the tool gate refuses one more spelling of a self-management command it already refuses in its plain form. Only a command that actually runs a refused self-management subcommand is newly refused; ordinary commands, including other subcommands written the same way, stay allowed. This is a tool-gate rule for agent shell commands only; no credential, token or client outside this repository is involved.

Removes nothing: no setting, key or caller is removed.

Tests

Proof: not provable -- other: a backport of a main commit whose proof ran on its own PR

  • CI does not run the backend suite on PRs into release/*, so the related set was run here: test_denied_commands_security.py plus every test file that imports the argv floor or the denied-command catalog, 76 files, 6,165 passed. The one failure was the line budget above, now fixed; test_security_gate_liveness.py passes.
  • flake8, mypy src/kiro_crew, the comment-history and brand gates pass.

Manual verification

N/A - the fix was verified on its own main PR. The 0.12.1 RC soak is the end-to-end check.

Screenshots / video

N/A - no frontend file changes.

Related Issues

Backport to the 0.12 line for 0.12.1 of #30824.

Sibling sweep

Siblings: none -- the source PR carried its own sibling sweep; this PR only carries that fix.

Pattern harvest

Not generalizable: this PR only carries a fix already on main. The source PR has its own harvest.

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

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

The tool gate refuses an agent's attempt to run certain self-management
commands on its own. One shell spelling of those commands, which the
shell runs exactly like the plain form, was allowed. The gate now
refuses it, and every command it refused before is still refused.
(cherry picked from commit f09c835)

On release/0.12.0 the security package line budget is raised by 3 to fit this pick, as earlier backports did.

Originally authored on main by Bolin Chen (bolichen97); authored here with the public identity because the commit guard refuses the original address on a hand-edited pick.
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 8, 2026 08:25
@buluoray
buluoray requested review from Zedmor and removed request for a team November 8, 2026 08:25
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/argv_floor_self.py

  • No reasoning template for 2f2a740 yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 2f2a740184919d7689d5e656201cbdb060425d21
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

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

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 2f2a740184919d7689d5e656201cbdb060425d21 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 2f2a740184919d7689d5e656201cbdb060425d21 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

This is a clean cherry-pick of a fix already merged on main, and its tests pin both the newly refused and the still-allowed spellings, so nothing blocks.

Notes

  • The new _PACKAGE_LINE_BUDGET comment calls the fix "the separated-flag spelling", but it is a redirection glued to the subcommand word (restart>/tmp/log). Reword it so the next budget audit reads the right cause.

[DESIGN-REVIEWED] 2f2a740

Description read

[DESCRIPTION-READ] a54d06afa8eced00ce8537832acc0f1c4bd8b1b748574349c3c7ece264804350

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 Nov 8, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2f2a740184919d7689d5e656201cbdb060425d21 — 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 does not.

First-Principles-Verdict: PASS

This is a clean backport of a fix already merged on main. It reuses the existing redirect helpers, and the budget raise follows from the package line cap.

What this change ships

Inventory (4 items) — 4 justified

Intent: give 0.12.x users the main fix that stops a self-management command (restart, update, cloud, gateway restart) getting past the tool gate when a redirection is glued to it. FIX.

  1. The tool gate now refuses kirocrew restart>/tmp/log and the other glued-redirect spellings of a self-management command it already refuses plainly. It does this with the existing _strip_redirect and _REDIRECT_START_RE helpers, not a new matcher. — justified
  2. The security spec's self-protection paragraph now describes how the floor reads a glued redirection. — justified
  3. A regression test pins the newly refused spellings and the look-alikes that must stay allowed. — justified
  4. The security package line budget is raised by 3 on release so the picked commit fits under it. — justified

[FIRST-PRINCIPLES-REVIEWED] 2f2a740

Description read

[DESCRIPTION-READ] 47ab2d512acdf45da717c289436d7fdc9833a8765f969d8cf77ae4f4720c1946

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 Nov 8, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 2f2a740

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2f2a740184919d7689d5e656201cbdb060425d21 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2f2a740184919d7689d5e656201cbdb060425d21 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2f2a740

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2f2a740184919d7689d5e656201cbdb060425d21 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 2f2a740184919d7689d5e656201cbdb060425d21 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): 15 classified, 0 newly refused, 15 still allowed.
  • ubuntu-latest (platform posix): 15 classified, 0 newly refused, 15 still allowed.
  • windows-latest (platform windows): 6 classified, 0 newly refused, 6 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The change adds one more reading to the self-management argv floor. When a redirection is glued to a word, the floor now also keeps that word as an operand, so it refuses only when the stripped word is itself a self-management verb in leading position. I wrote 21 boundary candidates (glued redirects on read-only subcommands, data consumers that quote the new shape, and posix and windows spellings) for the classifier. No regression is confirmed in this review because no verdict has been handed back for those rows.

TIGHTENING: _self_cli_operands glued-redirect operand reading -- refuses a self-management subcommand whose verb word has a redirection glued to it, which the old floor skipped whole (kirocrew restart>/tmp/log): "if not glued_words or _REDIRECT_START_RE.match(later): continue / later = _strip_redirect(later)", OR-ed in by "any(_operands_lead_with(_self_cli_operands(tokens, prog_idx, glued_words=g), spec) for g in (False, True))".

ADJUDICATED: 21 candidates, 0 confirmed newly-refused (no classifier verdict for these rows has been handed back to this review)

PLATFORM COVERAGE: The diff assumes that >/< glued to a word is a shell redirection, and it splits at the first >/< (_strip_redirect). The posix rows cover read-only subcommands with a glued redirect (status, cron list, cloud doctor, cloud iam-policy, bare cloud, bare gateway, gateway --no-tunnel, --version, logs). They also cover the python -m kiro_crew module form and data consumers that carry the new shape as text (grep, git commit -m, gh pr comment --body, printf), plus a restart word that appears only in a log path. The windows rows cover the cmd.exe spellings %TEMP%\…, 2>NUL, a drive-letter target, kirocrew.exe, .venv\Scripts\python.exe -m kiro_crew, and PowerShell's *> $env:TEMP\…. Two assumptions are not probed by any row:

  • cmd.exe's ^> escaping, because no real code path in this repo emits it.
  • A target that is glued and also carries a separator with a verb as the next command's program (for example kirocrew gateway>gw.log;restart). The stripped word drops _ends_argv, so the walk runs on into the next command. I found no legitimate operation of that shape, so it is named here as a narrowing to watch, not encoded as a row.

[SCOPE-REVIEWED] 2f2a740

@buluoray
buluoray merged commit 044e96a into release/0.12.0 Nov 8, 2026
25 of 28 checks passed
@buluoray
buluoray deleted the crew/slack/0.12.1-wide-7 branch November 8, 2026 08:33
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 8, 2026
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.

1 participant