Skip to content

test(security): pin the rm floor force requirement - #24949

Merged
iamwhatever merged 1 commit into
mainfrom
greener/pr-21900
Oct 28, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
greener/pr-21900

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: make a regression that drops the force-flag check in the recursive-force rm floor turn a test red.

The rm floor's allow cases had no recursive-only command against root or home. Removing and force from rm_floor._rm_wipe_targets left every test green. The fail-closed comment in the floor's caller also named a depth cap that does not exist (rm_floor.py has no depth or cap).

Supersedes #21900 by @devansh1401. That fork PR touches src/kiro_crew/security/, which the Sensitive Change Review gate refuses for forks, so this carries the same patch on a branch of this repository. Author credit is kept with Co-authored-by:.

Why it matters

If the force check were dropped, the floor would refuse rm -r / and rm -r ~, which it is meant to allow (no force flag), and no test would notice.

Not a goal

  • No runtime change.
  • No change to fail-closed handling or the rm parser.

What changed (motivation → approach → change)

Backwards compatibility

No runtime or public API change.

Tests

  • TestRecursiveForceRmFloor: 121 passed.
  • Mutation: with if recursive and force: patched in memory to if recursive:, exactly the two new cases fail (2 failed, 119 passed).
  • Full test/test_denied_commands_security_rows.py: 191 passed.

Manual verification

N/A: test and comment changes only; the mutation ran in memory through a pytest plugin.

Screenshots / video

N/A: no user-facing surface.

Related Issues

Closes #21759
Supersedes #21900

Checklist

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

Submitted under the project's Apache-2.0 license.

Add rm -r / and rm -r ~ to the rm floor's allow cases so dropping the
force check turns a test red, and drop the stale depth-cap phrase from
the floor's fail-closed comment.

Supersedes #21900. Closes #21759.

Co-authored-by: Devansh kukreja <117558669+devansh1401@users.noreply.github.com>
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 0060980

  • What rule changed: no rule changed. The only edit under src/kiro_crew/security/ is one comment in deny_gate.py (# incl. RecursionError and the depth cap -> # incl. RecursionError).
  • Before -> after: every command gets the same deny or allow decision before and after; only the comment text and two test cases differ.
  • Worst case if wrong: a misleading comment stays wrong; no command can be newly allowed or refused because no code line changed.
  • Evidence checked: git diff origin/main shows a comment-only hunk in deny_gate.py; rm_floor.py has no depth cap, so the old phrase was stale.
  • No regression:
    • Tools still work: the deny path runs the same code, and the full test_denied_commands_security_rows.py file passes (191 passed).
    • Backward compatible: yes, because no matcher, config key, rule id or public API changed in this patch.
    • Existing tests: all 119 existing TestRecursiveForceRmFloor cases still pass, and the two new cases fail only when the force check is removed.
  • How to undo: revert this one commit; it restores the old comment and drops the two test cases.

@github-actions

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/deny_gate.py

  • @iamwhatever posted a complete reasoning template for 0060980.

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: this adds two test cases and fixes one comment, with no runtime change. Without them, dropping the floor's force check left every test green.

[DESIGN-REVIEWED] 0060980

Description read

[DESCRIPTION-READ] 9b26f638ac80f108615712e3ddef9f5e4e9124486f6244f3dd735f7dfc8d7b03

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 006098072c0487b08356b9a0e014c1ffa02cc249 — 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

Nothing to check.

What this change ships

Inventory (2 items) — 2 justified

Intent: make the test suite catch a regression that drops the force requirement from the recursive-force rm floor. FIX (test coverage plus a comment correction).

  1. Recursive-only rm -r / and rm -r ~ are now pinned as allowed, so deleting and force turns a test red — justified
  2. The fail-closed comment no longer mentions a depth cap that rm_floor.py doesn't have — justified

[FIRST-PRINCIPLES-REVIEWED] 0060980

Description read

[DESCRIPTION-READ] 33bca9045f2d9052101b6e8e9f872ab3fa276bad42a45f820fdb2aa30c9eb5e1

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 0060980

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

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

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 006098072c0487b08356b9a0e014c1ffa02cc249 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0060980

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

@github-actions

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 006098072c0487b08356b9a0e014c1ffa02cc249 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): 10 classified, 0 newly refused, 9 still allowed.
  • ubuntu-latest (platform posix): 10 classified, 0 newly refused, 9 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: Nothing in the patch makes a rule stricter. In src/kiro_crew/security/deny_gate.py it only edits a comment on the existing except around _rm._rm_wipe_targets, and the fail-closed handling stays the same. The test file adds two rows to the allowed list (rows that must stay allowed): RM -r / and RM -r ~ (recursive without force). Boundary candidates for the rm floor were written anyway, so the classifier will confirm that no behaviour changed.

TIGHTENING: None. The only changes are the comment edit - except Exception as exc: # incl. RecursionError and the depth cap / + except Exception as exc: # incl. RecursionError and the two new allow-list test rows + "RM -r /", / + "RM -r ~",. No pattern, floor or validator refuses anything new. The surface nearby is the recursive-force rm argv floor (deny-rules tier, component="argv-floor"), which refuses a recursive+force wipe of the root or home directory itself.

ADJUDICATED: 13 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: The diff makes no new assumption about paths, separators, argv shapes or interpreters. Candidates still probe both host spellings around the rm floor:

  • posix: relative paths, $HOME and ~ subdirectories, /tmp scratch paths, long-option --recursive --force, find -exec rm, and git rm. These cover the one-token-off-root/home boundary the floor reads.
  • windows: cmd rmdir /s /q, PowerShell Remove-Item -Recurse -Force .\build, and Git Bash rm -rf on a C:\Users\...\Temp drive-letter path. These cover backslash and drive-letter spellings of the same cleanup.
  • any: git rm -r --cached, which is platform-neutral.

No assumed platform went unprobed.

[SCOPE-REVIEWED] 0060980

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever iamwhatever self-assigned this Oct 27, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Approving at 006098072c. On main, weakening if recursive and force: to if recursive: reddens no test; with this PR's tests [RM -r /] and [RM -r ~] go red, so the force requirement is now pinned. The depth-cap comment correction matches rm_floor.py (there is no depth cap). 191 related tests pass.

@iamwhatever
iamwhatever merged commit f4f1e78 into main Oct 28, 2026
126 of 138 checks passed
@iamwhatever
iamwhatever deleted the greener/pr-21900 branch October 28, 2026 00:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 28, 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.

test(security): pin the force flag in the rm floor and fix its error comment

2 participants