(feat) gosec parser: parse cwe_id and swap references if possible#14581
Open
maxi-bee wants to merge 4 commits intoDefectDojo:devfrom
Open
(feat) gosec parser: parse cwe_id and swap references if possible#14581maxi-bee wants to merge 4 commits intoDefectDojo:devfrom
maxi-bee wants to merge 4 commits intoDefectDojo:devfrom
Conversation
- changes the parser to take on CWE data when available - falls back to hardcoded url + rule_id when the above isn't present (latest gosec versions)
- adds cwe data
Contributor
Author
valentijnscholten
requested changes
Mar 23, 2026
Member
valentijnscholten
left a comment
There was a problem hiding this comment.
Thanks for the PR and updated unit tests! One small comment posted above.
- Added a protection on the cwe_id assignment via the integer convertion from string
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.
We don't want to waste your time, so if you're unsure whether your hypothetical enhancement meets the criteria for approval, please file an issue to get pre-approval before beginning work on a PR.
Learn more here: https://github.com/DefectDojo/django-DefectDojo/blob/master/readme-docs/CONTRIBUTING.md#submission-pre-approval
Description
Adds to the gosec parser to further add information about the vulnerability found. This tool relied on a URL + RULE_ID to build the reference test, but this is broken, most links coming from it are not maintained and do not help developers. Because of this https://github.com/securego/gosec/releases/tag/v2.25.0 and some previous releases are now adding such CWE information
Test results
Added tests for testing this new data (Claude tested)
Documentation
Please update any documentation when needed in the documentation folder)
No need to update the above, but it should be expected that a new hash is created given that we are changing the CWE field
Checklist
This checklist is for your information.
dev.dev.bugfixbranch.Extra information
Please clear everything below when submitting your pull request, it's here purely for your information.
Moderators: Labels currently accepted for PRs:
Contributors: Git Tips
Rebase on dev branch
If the dev branch has changed since you started working on it, please rebase your work after the current dev.
On your working branch
mybranch:In case of conflict:
When everything's fine on your local branch, force push to your
myOriginremote:To cancel everything:
Squashing commits
pickbyfixupon the commits you want squashed outpickbyrewordon the first commit if you want to change the commit messageForce push to your
myOriginremote: