-
Notifications
You must be signed in to change notification settings - Fork 3
feat: pre-job authorization #193
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
🔴 For
issues: assignedevents,github.event.issue.author_associationreflects the original issue creator's association, not the person who triggered the assignment (github.event.sender). If a team member assigns an issue opened by an external user mentioning @claude, the authorize job sees the external user's association (e.g., NONE) and incorrectly rejects the action. Consider using the GitHub API to resolvegithub.event.sender.login's association forissuesevents, or handleassignedseparately.Extended reasoning...
What the bug is
The new
authorizejob determines the actor's association using a fallback chain:For
issues: assignedevents, there is nocommentorreviewin the payload, so both of those fields evaluate to empty strings. The expression falls through togithub.event.issue.author_association, which is the association of the issue creator, not the person who performed the assignment.Step-by-step proof
NONE) opens an issue with@claudein the body.MEMBERsees the issue and assigns it (triggering theissues: assignedevent).github.event.sender.login= the team member (the assigner)github.event.issue.author_association=NONE(the external user who created the issue)github.event.comment= null (no comment involved)github.event.review= null (no review involved)'' || '' || 'NONE'which resolves toASSOCIATION='NONE'ifcondition checksNONE != OWNER && NONE != MEMBER && NONE != COLLABORATOR- all true, soexit 1claudejob even though the actual actor is a trusted team member.Why existing code doesn't prevent this
The fallback chain
comment.author_association || review.author_association || issue.author_associationcorrectly handlesissue_comment,pull_request_review_comment, andpull_request_reviewevents because in those casesauthor_associationon the comment/review reflects the sender. Forissues: opened, it also happens to work because the issue author IS the sender. But forissues: assigned, the sender (assigner) is a different person than the issue author, and there is no field in the fallback chain that captures the assigner's association.Impact
This bug means that the common workflow of an external contributor opening an issue mentioning
@claudeand then a team member assigning it will be blocked by the authorization check. The team member's legitimate action is rejected because the wrong principal's association is checked.How to fix
The fix should resolve the sender's association rather than relying on
issue.author_associationforissuesevents. Options include:GET /repos/{owner}/{repo}/collaborators/{username}/permission) to checkgithub.event.sender.login's actual association.assignedevent type differently, e.g., checkinggithub.actoragainst a known collaborator list or API call.github.event.senderinformation which is always the person who triggered the event.