Restrict Hackbot triggers to authorized user with editbugs permissions - #6444
Open
ayoubdiourin7 wants to merge 3 commits into
Open
Restrict Hackbot triggers to authorized user with editbugs permissions#6444ayoubdiourin7 wants to merge 3 commits into
ayoubdiourin7 wants to merge 3 commits into
Conversation
suhaibmujahid
requested changes
Jul 31, 2026
| matches.append( | ||
| HackbotMention( | ||
| raw=raw, | ||
| author_phid=transaction.get("authorPHID", ""), |
Member
There was a problem hiding this comment.
I do not think there is a comment transaction without authorPHID, if that is a possibility, we should skip the transaction altogether.
| ) | ||
| return None | ||
|
|
||
| authorized_members = await client.get_project_members(EDITBUGS_GROUP_PHID) |
Member
There was a problem hiding this comment.
We might want to implement TTL cache, and re-fetch if a user is not exist in the list. So we optimize for the happy path. We could do it now or file a follow up issue and we do it later.
Comment on lines
+143
to
+155
| comments: list[str] = [] | ||
| for mention in mentions: | ||
| if mention.author_phid in authorized_members: | ||
| comments.append(mention.raw) | ||
| else: | ||
| log.warning( | ||
| "Ignoring %s mention from non-editbugs user %s on %s", | ||
| webhook.mention_token, | ||
| mention.author_phid or "<missing PHID>", | ||
| object_phid, | ||
| ) | ||
| if not comments: | ||
| return None |
Member
There was a problem hiding this comment.
I would move this before No %s mention found in triggering, so we have only one check for the comments.
ayoubdiourin7
force-pushed
the
feat/hackbot-editbugs-auth-clean
branch
from
August 1, 2026 12:14
28a08b1 to
1f5820a
Compare
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.
Changes
@hackbotcomment.Resolves #6423