Add Bonk break-glass command - #150
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
06120ba to
9a5c1f1
Compare
There was a problem hiding this comment.
Review: Add Bonk break-glass command
I focused on the actual bypass mechanics, since this workflow gates a required merge check and the job now holds checks: write. A note up front: the current implementation is materially different from what my earlier comment on this PR assumed — the break-glass job doesn't just add a label and hope a re-run turns the check green, it directly mints a bonk check-run with conclusion=success via the Checks API. That's the real bypass, and it changes which concerns actually matter. Re-reviewing on that basis:
1. Blocking — the synthesized check-run must match the required status check context, or this bypass does nothing
The break-glass job creates a check-run named bonk (line 70). But the normal bonk job's status context is produced by the Actions runner and is typically reported as Bonk PR Review / bonk (workflow name + job id), not bare bonk. GitHub branch protection required checks match on the context string. If the required check is registered as bonk (a check-run created directly by the action, e.g. ask-bonk posts its own bonk check-run) this works; if the required context is the job status Bonk PR Review / bonk, then POSTing a check-run named bonk creates an unrelated green check and the required job check stays red/absent — merge stays blocked. Please confirm the exact required-context string in branch protection and make the -f name= value match it verbatim. This is the load-bearing line of the whole feature and it's currently an unstated assumption.
2. Blocking — cancelling the in-flight bonk run can leave the required check permanently pending
The job cancels non-completed runs (lines 52–55) and then synthesizes a success check. But if branch protection requires the job-level status context, a cancelled run reports that context as cancelled/failing, and your separately-created bonk check-run does not overwrite it (different check-run id/context). Net result can be worse than doing nothing: you've killed the in-flight review and not satisfied the required context. This is the same root issue as #1 — the fix is to stop relying on a name collision and instead target the exact required context. Until #1 is pinned down, the cancel step is risky.
3. Blocking — bonk break glass bypasses review of this very file
Because issue_comment and non-fork pull_request events run the workflow definition from the default branch, this feature only activates after merge to main. Fine. But once merged, any OWNER/MEMBER/COLLABORATOR can comment bonk break glass on a PR that further weakens or removes these guards and force the required check green without Bonk ever reading the diff. Given this is the kernel's merge gate, please document the threat model in the PR body: the control reduces to "trust every collaborator with the allowlisted association," and the escape hatch can be used to merge changes to the escape hatch itself. That may be acceptable, but it should be an explicit decision, not implicit.
4. The label path and the check-run path are redundant and can disagree
Two independent mechanisms now suppress Bonk: (a) the bonk-break-glass label makes the bonk job no-op on the next pull_request event, and (b) the directly-POSTed success check-run. On the current head SHA, (b) is what unblocks merge immediately; (a) only matters on a subsequent synchronize. But a new push creates a fresh head SHA, so the label-driven no-op job produces a skipped/neutral bonk job — which, if that's the required context, is not success and re-blocks merge. So after break-glass, the next push may silently re-block. Please decide on one authoritative mechanism and document the push-after-break-glass behavior; right now the two paths interact in a way that's easy to get wrong.
5. unlabeled re-arm produces a failing/pending check, not a clean slate
Subscribing to unlabeled (line 5) re-runs bonk when the label is removed — good for reversibility. But removing the label does not delete the synthetic success check-run you POSTed earlier for that SHA. If the re-run's real conclusion is failing, you now have two bonk-ish checks (the stale synthetic success + the new real result) on the same SHA, and which one branch protection honors again comes down to context/id semantics from #1. Reversibility isn't clean.
6. sender.type != 'Bot' on the label-driven bonk job is doing subtle double duty
Line 82–83 now runs the bonk job for Bot senders if the label is present. That's how the labeled no-op re-runs after a bot push, but it also means a bot-authored synchronize on a break-glassed PR will spin a runner just to echo the skip message. Minor, but worth a comment since it inverts the original bot-exclusion intent.
Non-blocking / confirmations
- Fork guard (lines 34–37) correctly refuses break-glass on forks — good, since
checks: writeon a fork head would be a real escalation. - Exact-string comment match (
== 'bonk break glass', line 15) still fails silently on whitespace/case, and the job posts no acknowledgement or error comment. With a Checks-API bypass this is more important, not less: a collaborator can't tell whether the bypass fired. Recommendtrim()+lowercase normalization and a confirmation comment/reaction. bonk.ymlalso fires on this comment; it no-ops (no/bonk/@ask-bonkmention) but spins a runner. Acceptable.--forceongh label create(line 42) is idempotent — fine.
Bottom line: the security posture (fork guard + author_association allowlist + minimal per-job permissions) is sound and not a regression. The blocking items are all correctness, and they converge on one question: what exact status-check context does branch protection require, and does the synthesized bonk check-run satisfy it? Please answer that in the PR (ideally with a one-line comment in the workflow), and reconcile the label-vs-check-run duality in #4 before merge.
|
Review posted to PR #150. SummaryI re-reviewed the workflow change in Blocking items I raised (all correctness, converging on one question):
Plus advisories on The security posture itself (fork guard + |
|
Re: break-glass review pointsAuthor's responses checked against the actual workflow ( Key fact: The normal review posts its result as a check-run via the
Bottom line: items 1, 2, 4, 5 are invalid — they stem from assuming a job-level status context rather than the |
|
Posted to PR #150. I verified each point against the actual workflow file. The findings: The load-bearing fact: The Verdicts:
Your responses are consistent with the code. |
Re-review: Add Bonk break-glass commandThanks for the point-by-point responses. I re-read the current workflow (both commits, including "Require write access for Bonk bypass") against your replies. I agree with your dispositions on the correctness items, and I want to record why they hold so the reasoning is captured for the next reader — several of them turn on non-obvious details of the current code. Agreeing with your rebuttals#1 required-context match / #2 cancel ordering — These both reduce to: the required context is a check-run named #4 label vs check-run duality — Agreed, and the reason is easy to miss: on a later #5 unlabeled re-arm / #6 bot sync — Both consistent with the code. The one thing I'd still ask for: write it down#3 is accepted as inherent, and that's exactly why the assumptions behind #1/#2/#4 need to be documented in the file itself. Every non-blocking conclusion above rests on facts that live outside the diff:
None of these are visible to a future editor reading Remaining advisory (non-blocking)The exact-string comment match ( Bottom line: no security regression, and the correctness objections are resolved by the current mechanics. My only ask before merge is documenting the three load-bearing invariants (#1/#4/#3) in the workflow, since the whole feature's correctness rests on facts that aren't in the diff. |
|
Review posted to PR #150. SummaryI re-reviewed the current state of
My one remaining ask (non-blocking): document the three load-bearing invariants inline in the workflow — the required-context/app-id assumption, the purpose of the no-op echo step, and the self-modification threat model — because the feature's correctness rests entirely on facts that don't appear in the diff and would silently break under a well-meaning refactor. Plus an advisory to normalize the comment match and add an acknowledgement. No security regression identified. |
|
remote: Permission to cloudflare/cloudflare-os.git denied to github-actions[bot]. |
|
@ndisidore Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
Allow authorized collaborators to skip Bonk by commenting
bonk break glass.