fix(gate): apply the self-authored-linked-issue block on every advisory path - #1252
Merged
Merged
Conversation
…ry path The self-authored-linked-issue finding (#audit-3.11) fired only on the main webhook review path. The same advisory is built in three other places that did NOT thread linkedIssueAuthorLogins, so a self-authored PR escaped the block depending on which path evaluated it: - sweepRepoRegate (the re-gate maintenance sweep) — re-evaluates stale open PRs and can drive auto-maintenance, so a self-authored PR re-gated here passed. - buildAuthorizedPrActionAdvisory (gate-override / PR-panel retrigger actions) — an authorized merge/close action skipped the block. - buildPredictedGateVerdict (the MCP predicted-gate preview) — already passed gate.selfAuthoredLinkedIssue to evaluateGateCheck, but never produced the finding for it to act on, so a configured self-authored gate never appeared. All three now thread the linked-issue authors: the two live paths resolve them the same way the main path does (cache-first, with the live-fetch fallback only when the gate can block and an installationId is available), and the offline predicted-gate resolves them from the issues snapshot it already holds.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1252 +/- ##
=======================================
Coverage 94.97% 94.97%
=======================================
Files 177 177
Lines 19806 19810 +4
Branches 7125 7126 +1
=======================================
+ Hits 18811 18815 +4
Misses 397 397
Partials 598 598
🚀 New features to boost your workflow:
|
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
The self-authored-linked-issue finding (#audit-3.11) fired only on the main webhook review path. The same advisory is built in three other places that did not thread
linkedIssueAuthorLogins— so whether a self-authored PR got blocked depended on which path evaluated it:sweepRepoRegate(re-gate maintenance sweep)buildAuthorizedPrActionAdvisory(gate-override / PR-panel retrigger)buildPredictedGateVerdict(MCP predicted-gate preview)gate.selfAuthoredLinkedIssuetoevaluateGateCheck, but never produced the finding for it to act on — so a configured self-authored gate never showed in the preview.All three now thread the linked-issue authors:
resolveLinkedIssueAuthorLogins, with the live-fetch fallback only when the gate can actually block (mode === "block") and aninstallationIdis available (sourced from the repo record).issuessnapshot it already holds (no live fetch).This makes the gate's self-authored verdict consistent across every path rather than dependent on the trigger.
Scope
src/queue/processors.ts,src/rules/predicted-gate.ts); no schema change; no migrationbuildAuthorizedPrActionAdvisoryis now exported for a direct unit testValidation
npm run test:ci— full gate greennpm audit --audit-level=moderate— 0 vulnerabilitiesSafety
site//CNAME/lovableCredit: the gap was identified by #1222 (built on the pre-#1238 3-arg
resolveLinkedIssueAuthorLogins); this re-implements it on currentmainwith the live-fetch-fallback signature and the predicted-gate snapshot path.