fix(hooks): allow uv add/remove; pin apm install/uninstall as allowed - #1323
Merged
Conversation
…m install/uninstall check-bash-safety.sh's install_re denied uv's add subcommand alongside its pip-install-compatible and bare install forms. The add/remove subcommands mutate pyproject.toml and uv.lock, so the change is visible and reviewable in the PR diff -- unlike the other two forms, which install into the venv with no diff trail. Drop the add subcommand from the deny set (remove was never matched); the other two forms stay denied. apm's install/uninstall subcommands were already unmatched by install_re in both check-bash-safety.sh and its sibling check_task_bash_safety.sh -- add explicit regression tests pinning that existing allow so a future widened install_re can't silently sweep apm back into deny. Update security-control-inventory.md's LLM05 row to reflect the new scope of the deny set. Refs #1320.
…remove Confirms install_re's substring scan still catches a still-denied pip-install-compatible/bare-install verb chained after the newly allowed uv add/remove via &&, ;, or | -- the specific way the new carve-out could have been exploited had it been implemented as a first-token check instead of a shared substring pattern. Refs #1320.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1323 +/- ##
========================================
Coverage 99.51% 99.52%
========================================
Files 118 119 +1
Lines 20936 21085 +149
Branches 2460 2480 +20
========================================
+ Hits 20835 20984 +149
Misses 101 101 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Step 8 inner-layer review found this row implied uv remove was newly carved out alongside uv add; uv remove was never in install_re's deny set and its status did not change in this PR. Reworded to state that precisely. Refs #1320.
tvna
marked this pull request as draft
August 25, 2026 11:54
.gitapex/ssot.json's registered target[0].ref for hooks/check-bash- safety.sh still listed uv add among the denied patterns after this branch's own earlier commit removed it from install_re. Operator caught the drift; syncing the registry entry to match actual current enforcement. Refs #1320.
This was referenced Aug 25, 2026
tvna
marked this pull request as ready for review
August 25, 2026 14:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relax
hooks/check-bash-safety.sh's install-verb deny list to allowuv add/uv remove(declarative, PR-diff-visible dependency changes) while keepinguv pip install/bareuv installdenied, and pin the already-allowedapm install/apm uninstallwith regression tests.Facts
human-harnessskill before changing anything, sincedocs/security-control-inventory.md's LLM05/ASI02 row cites this deny rule as a[deny]supply-chain-risk control -- a blanket removal would be disabling a security control (compliance.md's "Not overridable" class).AskUserQuestionhow far to relax it; they picked the recommended option: allow onlyuv add/uv remove(mutatepyproject.toml/uv.lock, visible in the PR diff), keepuv pip install/bareuv installdenied (install into the venv with no diff trail).hooks/check-bash-safety.shnor its siblingskills/executing-a-branch-plan/scripts/check_task_bash_safety.shhas any pattern matching "apm" -- both subcommands are already fully allowed. Live-verified via theapmCLI's own--helpoutput thatinstall/uninstallare real subcommands.uv add/uv removein check-bash-safety.sh; pin already-allowed apm install/uninstall #1320 (Acceptance Criteria Map drafted there viadrafting-issues)..gitapex/ssot.json's registeredtarget[0].refpattern string for this gate still listeduv addamong the denied patterns, unsynced with the actualinstall_rechange -- fixed.Assumptions
None load-bearing beyond what's stated above; the scope of the relaxation (declarative-only) was an explicit operator choice via
AskUserQuestion, not an inferred preference.Skill audit evidence
evaluating-deterministic-gate-qualityagainsthooks/check-bash-safety.sh, read againstskills/evaluating-deterministic-gate-quality/references/dimensions.md, dimension 15 in particular. Verdict: well-formed and well-placed. Dimension 15 live-tested directly against the script on disk (jq missing, truncated/non-object JSON, non-stringtool_name,tool_input: false, array-wrappedtool_input.command, missingcommand,tool_nameabsent) -- all fail closed exactly as before; this diff only touched theinstall_realternation, not any of the malformed-input guards. Pre/post-diff comparison (running identical payloads throughorigin/main's and this branch's script) confirmeduv addflipped deny->allow,uv removewas allow on both sides (never matched),uv pip install/uv installstayed deny on both. Dimension 9 (known-limitation disclosure) and dimension 12 (duplication/drift) also checked as satisfied for this diff's scope. One caveat the reviewing agent disclosed itself: its own context carried this repo's CLAUDE.md (the skill's dispatch guidance prefers a CLAUDE.md-free context for independence), noted rather than re-run, since the review target was unrelated to CLAUDE.md content.hooks/test_gitapex_check_bash_safety.pygainedDENIED_CHAINED_AFTER_ALLOWED_COMMANDS, three cases chaining a still-denied verb after the newly-alloweduv add/uv removevia&&,;, and|(e.g.uv add safe && uv pip install malicious), confirminginstall_re's whole-string substring scan still catches it rather than short-circuiting on the first allowed token. The independent reviewing agent additionally hand-constructed and ran, directly against the script, its own novel attempts not copied from the test file: command-substitution smuggling (uv add "$(echo malicious)" && uv pip install evil), newline-separated chaining, and tab/mixed-case verb obfuscation afteruv add-- none defeated the carve-out. One unrelated pre-existing gap surfaced (a fully-obfuscated verb via command substitution, e.g.uv remove x; `echo apt-get` install -y evil) but was confirmed identical onorigin/mainbefore this diff -- the already-disclosed "obfuscation that hides the verb itself" class named in the script's own header comment, not introduced or worsened here.Acceptance Criteria Map
Restated from #1320, row by row:
uv run --frozen pytest hooks/test_gitapex_check_bash_safety.py -q --no-cov--uv add requests/uv remove requestsexit 0 (allow),uv pip install requests/uv install requestsstill exit 2 (deny)apm install foo/apm uninstall fooexit 0 (allow, no warn output)Risk / blast radius
uv add/uv removecan still execute arbitrary code during dependency resolution/build (e.g. an sdist's build backend) -- this relaxation does not eliminate that execution-time risk, only compensates for it via post-hoc PR review of thepyproject.toml/uv.lockdiff. Disclosed in the new code comment and indocs/security-control-inventory.md's updated LLM05 row.uv pip install/bareuv installremain denied;apm install/apm uninstallhad no behavior change (pinning only).ruleset-scancurrently fails on this PR (and on every open PR againstmain): a pre-existing, disclosed gap (issue chore(ci): adopt ruleset-as-code (or classic branch protection) for gitapex's own main branch #439,docs/runbooks/rulesets.md) where PR feat(drafting-a-pr-to-merge): add independent-review-pending status check #1318's newindependent-review-pendingrequired check was added to the committed.github/rulesets/main.jsonbut not yet applied to the live GitHub ruleset. Reconciling it requires a maintainer to dispatchApply rulesets(dry run first) with theruleset-applyEnvironment's required-reviewer approval -- outside this PR's scope and outside what this session can or should do unilaterally.Rollback
Revert the commits on this branch (
15d271b,a479c8b,c8e411e,a36381a);install_reand thessot.jsonregistry entry return to denyinguv add, the new allow/defeat-test sections and thesecurity-control-inventory.mdline revert with it. No schema/data migration involved.Verification
uv run --frozen pytest hooks/test_gitapex_check_bash_safety.py -q --no-cov-> 82 passeduv run --frozen pytest --no-cov -q(full suite, mirrors CI'stest.yml) -> 5626 passed, 1 failed (pre-existing, environment-caused shallow-clone issue intests/test_gitapex_scan_harden_checkout_pin_drift.py::test_repository_workflows_are_drift_free-- same class already documented in PR fix(hooks): add jq type-confusion matrix test, close two origin-hook gaps #1314's own body; real CI checks out full history viafetch-depth: '0'and does not hit this; unrelated to this diff)uv run --frozen python3 .github/scripts/gitapex_scan_ssot_schema.py-> "No ssot.json drift found." (re-run after the registry fix)python3 .github/scripts/gitapex_gate_owasp_llm_mapping.py-> "OWASP LLM01-10 mapping is complete."bash -n hooks/check-bash-safety.sh-> syntax OKruff check/ruff format --check/mypy/betterleaks(pre-commit hooks) -> all passed on every commitStep 8 independent review verdict
Outer layer:
github:request_copilot_reviewwas called against this PR; no Copilot review appeared afterward (get_reviewsreturned empty) -- consistent with PR #1318's own recent, explicit finding that neither Anthropic's Claude Code Review GitHub App nor GitHub Copilot's reviewer is actually configured in this repository (Devin Review and CodeRabbit both confirmed skipped via their own check-run status: "trial expired and no credits remaining" / "manual review required for this OSS repository"). Disclosed here rather than silently assumed covered.Inner layer: an independent, isolated subagent (adversarially framed, did not author this change) reviewed the full diff and file contents (not only the changed hunks) across correctness, regression/blast-radius, reuse/simplification, and convention-adherence, against commit
c8e411e. It read the complete currenthooks/check-bash-safety.shandhooks/test_gitapex_check_bash_safety.py, diffed the whole script againstorigin/mainto confirm no unrelated regex changed, ran 30 of its own adversarial commands directly against the live script, confirmedapmmatches no pattern in the script at all, confirmed the siblingcheck_task_bash_safety.shintentionally still deniesuv add(documented pre-existing divergence, out of this PR's scope), and ran the test suite itself (82 passed). One real finding surfaced and was fixed atc8e411e:docs/security-control-inventory.md's LLM05 row implieduv removealso changed status, when it was already outside the deny set -- corrected.A second, narrower drift was then caught directly by the operator (not by either Step 8 layer) between
c8e411eand this verdict's commita36381a:.gitapex/ssot.json's registeredtarget[0].refpattern for this same gate still listeduv addas denied. This commit's own diff was independently re-verified directly (git diff c8e411e..a36381a): exactly one line, a registry pattern-string edit removing|uv addto matchinstall_re's actual current content, with no code or test logic touched -- confirmed viagit diff, JSON-validity check, and a freshgitapex_scan_ssot_schema.pyrun (still "No ssot.json drift found."). Given the narrow, mechanically-verifiable nature of this specific delta, this was independently validated directly rather than re-dispatched to a fresh inner-layer subagent; no new adversarial surface was introduced. No other findings survived verification. This verdict is re-issued againsta36381aper this skill's own no-stale-verdict rule.Checklist
docs/security-control-inventory.md's LLM05 row and.gitapex/ssot.json's registry entry both updatedhooks/check-bash-safety.shmatches thehooks/check-*.shnaming convention); see the## Skill audit evidencesection aboveevals/*/split.mdKept-edit-log entry addedSKILL.mdStop-boundary bullets or dispatch branches addedRelated Issue
Closes #1320