Skip to content

jira webhook: fix incoming author name check - #3606

Merged
valentijnscholten merged 8 commits into
DefectDojo:devfrom
valentijnscholten:jira-fix-comment-author-check
Jan 17, 2021
Merged

valentijnscholten merged 8 commits into
DefectDojo:devfrom
valentijnscholten:jira-fix-comment-author-check

Conversation

@valentijnscholten

@valentijnscholten valentijnscholten commented Jan 10, 2021 •

Copy link
Copy Markdown
Member

On an incoming comment from JIRA, the webhook checks for the author of the comment. If it matches a username used in one of the JIRA instances, it assumes that the incoming comment is actually a comment that was entered as note in defect dojo and pushed to jira. Which triggers a webhook back to defect dojo. The webhook needs to be ignored, because the comment is already in defect dojo.

This intention is correct.

However, the check was done on JIRA displayName instead of the JIRA key field. So the check only succeeded if the displayname in JIRA was the same as the username used in defect dojo. In my setup it was:

username: defect.dojo
displayname: Defect Dojo

So it never matches. The check was also doing a if jira_username_in_dojo in comment_author_from_jira which is not always correct.

This PR changes the matching logic to use the JIRA username field instead of the displayname, and uses an exact match. And adds a unit test.

[10/Jan/2021 10:47:52] DEBUG [dojo.jira_link.views:184] skipping incoming JIRA comment as the user id of the comment in JIRA (defect.dojo) matches the JIRA username in Defect Dojo (defect.dojo)

@valentijnscholten valentijnscholten changed the title jira webhook: fix incomming author name check jira webhook: fix incoming author name check Jan 10, 2021
Comment thread dojo/jira_link/views.py Resolved
Comment thread dojo/jira_link/views.py Resolved

@madchap madchap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find.

@madchap
madchap requested a review from damiencarol January 17, 2021 15:26

@damiencarol damiencarol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think big object dumps of JIRA hook should be removed from code

Comment thread dojo/jira_link/views.py Resolved
@valentijnscholten
valentijnscholten merged commit 4875cd4 into DefectDojo:dev Jan 17, 2021
@madchap madchap mentioned this pull request Jan 19, 2021
9alexx3 pushed a commit to 9alexx3/django-DefectDojo that referenced this pull request Aug 12, 2026
* jira: fix author check on incoming comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants