Repository navigation
feat(guardrails): make the unpinned force-with-lease a setting; this repository blocks it - #15968
Conversation
block-dangerous-git passed --force-with-lease with --force-if-includes, a lease pinned to no commit, while AGENTS.md allows only a lease pinned to the full SHA. git-push(1) documents --force-if-includes as the mitigation for that lease, so the shipped default stays allow and consumers keep the choice. The new block_dangerous_git_unpinned_lease option, or unpinned_lease in a repository's docs/conventions/guardrails.yaml read at its local origin/HEAD, set to block allows only --force-with-lease=<ref>:<sha>; either layer set to block blocks it, the empty expect included. This repository sets unpinned_lease: block, so its sessions match AGENTS.md once the plugin release lands. Every force-push block message now names only --force-with-lease=<ref>:<full-sha>, the form that passes under both values, so naming it costs the block path no read of the team file. Closes #15940 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #15968 (head 88b9337)Blocking only. This lane already reviewed an earlier head (a61f53e), so this review reports only CRITICAL and IMPORTANT findings. I read the whole diff for all 7 changed files. None of them matches a TRUSTED PATHS glob. The only Result: no exploitable security issue. One mandatory manifest flag (IMPORTANT), posted inline. Manifest
Hook logic checked (
|
|
claude-review reviewed Code review: PR #15968, guardrails unpinned force-with-lease setting (blocking only)This lane already reviewed an earlier head, Change since the last review. The earlier manifest flag was the Correctness. Nothing blocking:
Closing issue #15940. Each Done-when item:
The author's verification (PASS=1094, shellcheck, the sync and contract checks) is the author's claim and was not verified here, because this lane has no shell. Manifest
Spend. One Verifier dropped 0 of 0 candidates. |
A manifest key that declares options needs Claude Code v2.1.271 or later, so block_dangerous_git_unpinned_lease raised the guardrails client floor for every consumer. The description now lists allow and block instead, as the manifest's other string options do; the hook already treats any value other than block as allow, and two test rows cover an unknown value and a case-different BLOCK passing as allow. Refs: #15940 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
Closes #15940
Summary
AGENTS.mdallows one force-push form, a lease pinned to the full SHA (--force-with-lease=<branch>:<sha>). The guardrailsblock-dangerous-githook also passed--force-with-lease[=<ref>] --force-if-includes, a lease pinned to no commit, and the empty expect--force-with-lease=<ref>:. This PR makes the unpinned lease a setting and turns it toblockin this repository, so here the hook andAGENTS.mdaccept exactly the same forms.AGENTS.mdis not edited.Direction: the owner decided to narrow the hook (decision comment), then added that the narrowing must be valid, always right, and not unnecessary friction. git-push(1) documents
--force-if-includesas git's mitigation for an unpinned lease ("will verify if updates from the remote-tracking refs that may have been implicitly updated in the background are integrated locally before allowing a forced update", https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-force-if-includes), so blocking it for every consumer of the shipped plugin would be friction they could not remove. Hence:allow, behavior unchanged. No consumer sees a new block. Consumers keep the choice.block, matching the owner's rule "never ... a lease without the SHA" inAGENTS.md.Fix
plugins/guardrails/hooks/block-dangerous-git.sh: a lease that pins no full commit id (no expected value with--force-if-includes, or the empty expect) is blocked when either layer saysblock:block_dangerous_git_unpinned_lease(allowdefault,block), per user;unpinned_lease: blockin the session repository'sdocs/conventions/guardrails.yaml, read at its localorigin/HEADand never the working tree or index, the same mechanismfix_request_postalready uses inblock-fix-request-post.sh. A project.claude/settings.jsoncannot carry a plugin option (pluginConfigsis read only from user and managed settings,docs/contracts/hook-config-delivery/README.mdfact 5), so the team file is the repository-level layer.--force,-f,+refspec, bare lease, unpinned lease) now names only--force-with-lease=<ref>:<full-sha>, the form that passes under both values. Naming one fixed form keeps the block path from reading the team file, so the process-count pins in the suite hold.AGENTS.mddoes not mention it, and no skill, doc or script in this repository uses it (git grep -E "force-with-lease=[^ ]*:( |\"|'|$)"finds only a benchmark table row with a full SHA). Underallowit still passes.docs/conventions/guardrails.yaml:unpinned_lease: block(this repository's setting).schemas/guardrails.schema.json: theunpinned_leasekey.plugin.json: the option. README: the hook row, an Option details entry, and the regenerated options table (scripts/sync-plugin-options-docs.py)..changes/guardrails/(minor).Every repository hit for
force-if-includes:plugins/guardrails/hooks/block-dangerous-git.sh,plugins/guardrails/hooks/block-dangerous-git.test.sh,plugins/guardrails/README.md(all updated here) andplugins/guardrails/CHANGELOG.md(released history, left as is). No skill, doc, script or convention tells an agent to run the unpinned form.Verification
bash plugins/guardrails/hooks/block-dangerous-git.test.sh: PASS=1092 FAIL=0 on the final content. Before the hook change the new rows failed (18 failures: the unpinned forms exited 0 underblock, the messages named--force-if-includes).allowthe unpinned lease, the empty expect and the pinned lease pass; underblock(option or team file)--force-with-lease --force-if-includes,=main --force-if-includes,--force-w --force-i, the empty expect and a bare-plus-pinned mix block, while the pinned lease (with and without--force-if-includes),--force-if-includesalone, a negated lease and a dry run pass. Team-file rows:blockatorigin/HEADblocks; the file only in the working tree does not;allowplus the option atblockblocks (either layer); an unknown value keepsallowand says so. Message rows: under both values every force-push block names--force-with-lease=<ref>:<full-sha>and neverforce-if-includes.node scripts/validate-plugin-contracts.mjs: no guardrails warnings.python3 scripts/sync-plugin-options-docs.py --check: up to date.scripts/check-convention-yaml.sh: 15 files validate.plugins/guardrails/hooks/coverage-manifest.test.sh: 32 checks pass.scripts/sync-shared-copies.sh --check: all copies match.shellcheck -xon the hook and its test: clean..claude/settings.json,guardrails@melodic-software). Once this merges,unpinned_lease: blockis onorigin/main, and once the guardrails release carrying this hook lands, every session here blocks the unpinned lease and names the pinned form. Until that release, sessions run the old hook, which ignores the key.Related
AGENTS.mdto admit the unpinned lease, the opposite of the owner's decision, and its tests asserted that block messages name both forms. This PR replaces it; nothing from its branch is reused.🤖 Generated with Claude Code
https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc