Harden webhook handling and user resolution - #1512
Open
daiv-agent[bot] wants to merge 1 commit into
Open
Conversation
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.
Hardens webhook-driven identity resolution and callback handling across GitLab and GitHub. Webhook validation now fails closed when no secret is configured, callbacks reject duplicate deliveries via DAIV's existing eyes reaction, and user resolution trusts the verified provider+uid social account over unverified webhook-claimed username/email.
Key Changes:
resolve_user(daiv/accounts/utils.py) now resolves the verified provider+uidSocialAccountfirst; username/email matches are only fallbacks when no social account exists, preventing a platform user sharing a victim's username/email from being misattributed to the victim.validate_gitlab_webhook/validate_github_webhook) now fail closed: an unconfigured secret rejects the payload (logged at ERROR) instead of passing, andcheck_api_keys(daiv/codebase/checks.py) surfaces a missing webhook secret for the active platform as a deployment error.IssueCommentCallbackand GitLabNoteCallbackreject replays/duplicate deliveries when DAIV has already reacted with the eyes emoji on that specific comment/note.RepoClient.has_issue_reactiongained anote_idparameter (checks the comment/note's reactions instead of the issue), and a newhas_merge_request_note_reactionabstract method was added — implemented for GitHub (delegates to the issue-comment API) and GitLab (award emoji on the MR note), with SWE stubs raisingNotImplementedError.WEBHOOK_SSL_VERIFYsetting (defaultTrue) indaiv/codebase/conf.py; thesetup_webhookscron task now drivesdisable_ssl_verificationfrom it instead ofsettings.DEBUG, so a debug-shaped deployment no longer silently downgrades secure webhooks.💡 Instructions for the reviewer: