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.
fix: restrict Q workflow triggers to eliminate action_required from PR events #45745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: restrict Q workflow triggers to eliminate action_required from PR events #45745
Changes from all commits
6ad49bab778281File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guardedEventsis a hidden dependency on a list maintained in two places — adding a third guarded event type requires updating both this list andactiveCommentEventsInOn(), with no compile-time enforcement linking them.💡 Detail and suggested fix
guardedEventsinbuildCommentAuthorAssociationCondition(line 194) and the twostrings.Containschecks inactiveCommentEventsInOn(lines 592–597) independently hardcode the same event name set. If a developer adds e.g.workflow_run_commenttoguardedEventsto guard a future event type, they must also add a correspondingstrings.ContainsinactiveCommentEventsInOnor the new event will never appear in the active list and its guard will silently be omitted.Suggested: define a single package-level
var guardedCommentEvents = []string{"issue_comment", "pull_request_review_comment"}and drive both functions from it, so the two sites cannot diverge.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/diagnosing-bugs] The
case 0branch (BuildBooleanLiteral(true)) is unreachable in practice — this function is only called whenhasCommentEventInOn()returns true, guaranteeing at least one active comment event. If that guard is ever relaxed,case 0would silently emit a permissive always-true expression, bypassing the author-association check entirely.💡 Suggestion
Make the invariant explicit with a panic to fail loudly rather than silently permitting all actors:
Alternatively, add a doc comment on the function signature declaring the precondition.
@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 0silently drops the security guard whenactiveCommentEventsis empty — any future caller passing an empty slice will compile away the author-association check with no error or warning.💡 Detail and suggested fix
The outer gate in
compiler_pre_activation_job.go(line 521) currently prevents this path, but that's an undocumented precondition enforced at a distance. If any future call site passes an empty slice (e.g. from a different compiler path, a refactor, or a test), the function silently returnsBuildBooleanLiteral(true). When ORed withauthorizedAssoc, the full expression short-circuits totrue— the guard is entirely removed.The old code was fail-closed: it always emitted the guard. The new code is fail-open for the empty-input case. Security controls should default to the more restrictive posture.
Suggested fix — preserve the full guard as the fallback:
Or add a panic/error so misuse is caught at test time rather than deployed silently.
Uh oh!
There was an error while loading. Please reload this page.