Skip to content

fix(guardrails): fail open with a notice for a literal PR id merge mutation when gh is missing - #9823

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-7376-40117552055-1
Oct 24, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-7376-40117552055-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7376

Summary

Opened by the work-resolve-issue lane. The run's own summary:

block-unresolved-pr-merge now lets a GraphQL merge mutation with a literal PR_ id through with the two-channel 'not checked' notice when gh is missing or unauthenticated, per the owner's option B on #6463. A non-literal id still blocks with or without gh, and a literal id whose node cannot be read for a non-auth reason still blocks. Changes are left uncommitted in the working tree, as the lane instructs.

Not verified

  • I did not run scripts/run-test-file.sh plugins/guardrails/hooks/block-unresolved-pr-merge.test.sh directly, and I did not confirm that each new case fails on main: Bash in this lane runs only the named wrappers. check-affected passed but does not show whether it ran that suite. The reviewer could no
  • The new fragment was written by hand because new-changelog-fragment refuses a detached HEAD; check-changelog-fragments validates it.
  • The PR body must carry 'Hold: a human merges this' (owner's merge hold on the issue).

Fix

  • plugins/guardrails/hooks/block-unresolved-pr-merge.sh: gh missing with a literal PR_ id now reaches the existing unchecked notice (the early refuse is removed; the empty-node refuse still runs first, so a non-literal id blocks); a node read that fails with an auth error fails open; header comment up
  • plugins/guardrails/hooks/block-unresolved-pr-merge.test.sh: unauthenticated literal id now expects exit 0 with the notice on both channels; new cases for Bash and PowerShell: literal id with gh missing passes with the notice, variable and $(...) ids with gh missing still block; a non-auth unreadable
  • .changes/guardrails/fix-merge-guard-literal-id-GH -missing-7a3c91d2.md: patch changelog fragment

Verification

The runner ran each check from the base copy against 4919f45:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

Left out: the items under Not verified.

Related

#7376

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed a8120b163dfef050edb9c975bc498740daf9c291: 0 finding(s), 0 as inline comments.

Incremental review of a8120b1 against 4919f45. No findings.

What changed: the not-logged-in match on a failed literal-id node read in block-unresolved-pr-merge.sh (line 649) no longer includes the bare word authentication. It now matches only Bad credentials, HTTP 401, gh auth login and not logged in. A 403 that merely mentions authentication (SSO, SAML, a proxy) now fails closed instead of failing open. The new auth_forbidden fixture and the test case at block-unresolved-pr-merge.test.sh:549-552 cover it.

Checked:

  • This narrows the fail-open path, so it is not a security weakening, and it matches the closing issue's intent. The issue asks for fail-open only when gh is missing or unauthenticated.
  • I read the hook's BUPM_ERR handling (the first line of gh's stderr) and the fake gh. The auth_forbidden branch sits after the fail branch and before the endpoint dispatch, so it fires for the node read.
  • scenario does rm -rf "$FIX", so the fixture file does not leak into later cases.
  • The new case would fail against the previous regex: authentication required matched it and exited 0. The case expects exit 2.
  • No other authentication pattern remains in the hook, so the other paths have no inconsistent matching.

Not run: I had no shell, so I did not run the test suite. The PR's own verification claims are author-claimed and unverified by me.

Other notes:

  • No spend change and no trusted-path files changed in this increment, so no hold.
  • The PR body's "Hold: a human merges this" line, which the issue requires, is outside this increment. The description text I was given does not show it.

@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 4919f452a837c1134456897eeaa414123ba5b13f; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed a8120b163dfef050edb9c975bc498740daf9c291: 0 finding(s), 0 as inline comments.

Incremental security review of a8120b1 against 4919f45. It covers block-unresolved-pr-merge.sh and block-unresolved-pr-merge.test.sh. I found no security issues.

The change narrows the fail-open regex for a failed graphql node read. It drops the bare authentication alternative, so only gh's own not-logged-in phrasings (Bad credentials, HTTP 401, gh auth login, not logged in) reach _bupm_unchecked. A 403 that merely mentions authentication, such as SSO or SAML enforcement or a proxy, now goes to _bupm_refuse and blocks. This tightens the guard: fewer error strings can bypass the merge check. BUPM_ERR is the first 200 characters of gh's own stderr, so the pull request's author does not control it. The new test, auth_forbidden, checks that a 403 mentioning authentication exits 2 and names the node.

manifest fields: none touched. No trusted-path files changed in this increment.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of 3 on a8120b1.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head a8120b163dfef050edb9c975bc498740daf9c291.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit c2ace07 Oct 24, 2026
39 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-7376-40117552055-1 branch October 24, 2026 19:54
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.

fix(guardrails): fail open with a notice for a literal PR id merge mutation when gh is missing (#6463 item 5)

0 participants