Skip to content

feat(guardrails): ship the main-checkout edit guard off by default - #17018

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/17015-main-checkout-guard-opt-in
Nov 18, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/17015-main-checkout-guard-opt-in

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #17015

Summary

The owner decided the main-checkout edit guard from #16954 stays in guardrails but ships off by default, so a person opts in (control-hub#11, recorded at https://github.com/melodic-software/control-hub/issues/11#issuecomment-6967662619). No release has published the guard yet; release PR #17006 is held until this lands.

Fix

  • block_main_checkout_edit_enabled defaults to false, and its description says how to turn it on. The hook's fallback for an unset option is now false too, and only the value true turns the guard on.
  • The manifest description lists main-checkout edits as opt-in beside credential reads (496 of 500 characters). The README guard row, the kill-switch section, the option details and the generated options table say it is opt-in and how to turn it on. docs/catalog.md was regenerated with node scripts/generate-catalog.mjs.
  • The unreleased changelog fragment from feat(guardrails): deny edits in a main checkout on its default branch #16954 now says opt-in and no longer announces a new denial.
  • Everything else about the guard is unchanged: it denies and never asks, covers any file that is not git-ignored, and has no per-repository opt-out.
  • The suite resolves its fixture root with cd -P, the one-line fix for the pr-verify note on feat(guardrails): deny edits in a main checkout on its default branch #16954: the guard compares resolved paths, so the unowned-path cases now name resolved paths too.

Verification

  • block-main-checkout-edit.test.sh: PASS=144 FAIL=0. It follows the credential-read shape. With the option unset, an Edit of a tracked file in a main checkout on its default branch passes, both directly and through run-guards.sh. It asserts plugin.json's default equals the script's fallback, then sets the option to true for every case feat(guardrails): deny edits in a main checkout on its default branch #16954 tested, all of which still behave as before. A value other than true stays off. With the old :-true fallback restored, the default-off case fails both ways.
  • abort-boundary.test.sh 391/391 once it turns the guard on, as it already does for credential reads. run-guards.test.sh 752/752, coverage-manifest.test.sh 32/32, block-credential-read.test.sh 360/360, require-jq-notice-isolation 20/20, require-jq-posture 56/56.
  • validate-plugins.sh --only guardrails, the changelog-fragment checks, the kill-switch hoist check, the Write/Edit spawn ratchet (7 of 7), shellcheck and shfmt -i 2 all pass.
  • Left out: a Windows run of the suite (not selected for Windows CI).

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgexJUYJe9Na3shvSfs

kyle-sexton and others added 2 commits November 17, 2026 22:01
block_main_checkout_edit_enabled now defaults to false, and the hook's
fallback for an unset option matches: only the value true turns it on. The
manifest lists the guard as opt-in beside credential reads; the README,
catalog and the unreleased changelog fragment say it is opt-in and how to
turn it on, and no longer announce a new denial. Everything else about the
guard is unchanged.

The test suite covers the default-off case directly and through the
dispatcher, sets the option on for every earlier case, and resolves its
fixture root with cd -P, as the guard resolves the paths it compares.

Closes #17015

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgexJUYJe9Na3shvSfs
@kyle-sexton

Copy link
Copy Markdown
Member Author

Owner of this pull request: the hub session "Plugin Presets". This build session reports to it; route questions about the opt-in default there.

@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 03:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T04:10:37.626444Z d104f3b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44227877975

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed d104f3b
Run 44227877975

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions github-actions Bot 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.

claude-security-review: 1 inline finding(s) on d104f3b82ba790cc684791ed1d5334e9ba60ed71; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed d104f3b82ba790cc684791ed1d5334e9ba60ed71: read 7 of 7 changed file(s); 1 finding(s), 1 as inline comments.

Security review: PR #17018 (guardrails: main-checkout edit guard off by default)

This PR switches off the block-main-checkout-edit guard by default. That guard was added in #16954 and has not been released yet. In plugin.json, userConfig.block_main_checkout_edit_enabled.default goes from true to false. The hook's fallback for an unset option also goes from :-true to :-false, at plugins/guardrails/hooks/block-main-checkout-edit.sh:14, and only the exact value true turns the guard on. The rest of the diff is docs, the changelog fragment, the regenerated catalog line and tests. The tests turn the option on in abort-boundary.test.sh, and the guard suite resolves its fixture root with cd -P.

Findings

  • One manifest flag, IMPORTANT (inline on plugin.json:149). The default of a guard key changes in the direction that allows more edits unchecked. Anyone who installed the marketplace from main and never set the key will lose the deny when they update. The guard's code (block-main-checkout-edit.sh:14) gates edits, so the skill's guard rule makes this a flag. It does not meet the CRITICAL bar: the guard enforces where edits happen, and turning it off leaks no token, compromises nothing and costs nothing. The owner can settle it with a decision reply on the thread.

What was checked and found clean

  • Code: I found no other weakening of the hook. The early exit happens before any file is read or any git runs. The ownership checks, the safe.directory check and the -c core.fsmonitor=false -c core.hooksPath=/dev/null overrides are unchanged and still apply when the guard is on. An unrecognised value such as yes leaves the guard off. That matches what the PR says, and it does not widen the default.
  • Instruction-surface lens: I read docs/contracts/instruction-exception-register/README.md. The softened rule keeps edits out of the main checkout on the default branch. It matches none of the Gate 0 classes there: irreversible-action, secret-handling, data-integrity, external-publication, legal-compliance, agent-authority. An edit in the working tree is local and can be undone, and committing or pushing it is still controlled by the other guards and by branch protection.
  • Trust controls: none of the changed files is a trust control or a merge-hold path, and none matches a TRUSTED PATHS glob.
  • PR context: it contains no instructions aimed at this review lane. It cites an owner decision (control-hub#11). Per the skill, that is treated as data and does not settle the flag.

critical-findings: 0

Manifest lines (2)
  • manifest description: pass
  • manifest userConfig.block_main_checkout_edit_enabled.default: flag, guard default changed from true to false, so the main-checkout edit deny is off for every user who never set the key (reader: plugins/guardrails/hooks/block-main-checkout-edit.sh:14)

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed d104f3b82ba790cc684791ed1d5334e9ba60ed71: read 7 of 7 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17018, ship the main-checkout edit guard off by default

No blocking or advisory findings. I read every hunk of all 7 changed files.

The change does what it sets out to do and stays consistent across files:

  • The fallback matches the manifest. The hook's fallback is now :-false (block-main-checkout-edit.sh:14). The manifest default is also false, and only the exact value true turns the guard on.
  • The suite tests the new default. The test file still unsets the option at line 14. It then checks the default-off case through both paths: direct and through the dispatcher (lines 57–58). It checks that the plugin.json default equals the script fallback (lines 59–60), and only then exports =true for the cases feat(guardrails): deny edits in a main checkout on its default branch #16954 already had. A new case checks that a value other than true stays off (lines 146–147).
  • The test helper supports -u. The -- -u NAME form these cases use is part of the documented guard_invoke contract (guardrails-test-helpers.sh:151-152).
  • Other suites are covered. abort-boundary.test.sh now turns the guard on, the same way it turns on credential reads. run-guards.test.sh only checks that hooks.json wires the guard, so it does not depend on the default. run-guards.sh has no default of its own for the switch that could disagree with the script.
  • The docs agree. The README guard row, the kill-switch section, the option details and the options table all say the guard is opt-in. So do the manifest description, docs/catalog.md and the changelog fragment.

Closing issue #17015, "Done when":

  • "With no configuration, an Edit of a tracked file in a main checkout on its default branch is not denied." Met. The test at lines 57–58 would fail if this broke.
  • "With block_main_checkout_edit_enabled true, every case feat(guardrails): deny edits in a main checkout on its default branch #16954 tested still behaves as before." Met. Those cases are unchanged and now run after the option is set to true at line 61.
  • "The manifest, README and catalog agree that the guard is opt-in." Met.

Settled thread. The earlier thread on the default change (plugin.json line 149) was resolved with a stated owner decision, and its lines have not changed since (no). The question of whether turning this guard's default off is acceptable belongs to the security lane, which runs on this repository. Here it is only the manifest "PR says why" check below.

Not independently verified. The PR's test counts (PASS=144, 391/391, 752/752, and the others) are the author's claims. I had no shell to run them.

Loosened-check verdict: fail (default; the wrapper supplied no resolved value); patterns: 0.

  • The plugin.json default assertion changed from true to false, and the guard's default went from on to off. The closing issue names both changes ("block_main_checkout_edit_enabled default false", "the default-off case passes an edit") and gives the reason: on by default, the guard would deny every edit for a person working on the default branch of a solo repository.
  • No test was skipped or deleted, no threshold was lowered and no check was removed.
Advisory and manifest lines (3)
  • manifest userConfig.block_main_checkout_edit_enabled.default: pass. The PR and closing issue guardrails: ship the main-checkout edit guard off by default #17015 state why (owner decision, control-hub#11 Q33: on by default would deny edits for anyone working on the default branch of a solo repository). The guard is unreleased (release PR chore(release): release 23 plugins #17006 is held). Judging whether the guard should be off by default is left to the security lane.
  • manifest version (changelog fragment bump: minor): pass. The guard has not been released yet, and the fragment still covers adding it as an opt-in guard.
  • manifest description: pass. Main-checkout edits move from "Blocks" to "opt-in" beside credential reads, which matches the new default, and docs/catalog.md matches the manifest.

Verifier dropped 0 of 0 candidates.

@kyle-sexton

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: d104f3b82b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit c1913a9 Nov 18, 2026
124 of 127 checks passed
@kyle-sexton
kyle-sexton deleted the feat/17015-main-checkout-guard-opt-in branch November 18, 2026 05:05
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guardrails: ship the main-checkout edit guard off by default

1 participant