-
Notifications
You must be signed in to change notification settings - Fork 1.8k
🎉 Advance reimport to update fix_available field #12633 #12922
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
base: dev
Are you sure you want to change the base?
🎉 Advance reimport to update fix_available field #12633 #12922
Conversation
@valentijnscholten is this the right direction for updating fix_available in reimport? |
Yes |
Shall I target this against bugfix, or do we want a longer testphase and keep it against dev? |
🔴 Risk threshold exceeded.This pull request modifies several sensitive files (e.g., dojo/importers/default_reimporter.py, dojo/models.py, templates and migrations), and the scanner flags risky edits to those codepaths; it also introduces two substantive issues: a potential denial-of-service where anchore_grype can create a fix_version string longer than the DB field (causing a DataError during import), and a re-import business logic flaw that allows users who can import scans to change fix_available/fix_version on existing findings, enabling privilege escalation.
🔴 Configured Codepaths Edit in
|
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/importers/default_reimporter.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/importers/default_reimporter.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/templates/dojo/view_finding.html
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/importers/default_reimporter.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/templates/dojo/view_finding.html
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
🔴 Configured Codepaths Edit in dojo/db_migrations/0245_finding_fix_version.py
Vulnerability | Configured Codepaths Edit |
---|---|
Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml . |
Denial of Service via DataError in dojo/tools/anchore_grype/parser.py
Vulnerability | Denial of Service via DataError |
---|---|
Description | The fix_version field in the Finding model has a max_length of 100 characters. The anchore_grype parser constructs the fix_version string by joining multiple fix versions with a comma and space (, ). If a Grype report contains a vulnerability with a list of fix versions that, when joined, exceed 100 characters, attempting to save this Finding object to the database will result in a DataError . This error is not explicitly handled in the get_findings method of the parser, which means the entire scan import process could fail, leading to a denial of service. |
django-DefectDojo/dojo/tools/anchore_grype/parser.py
Lines 133 to 136 in 95bf03a
fix_version = ", ".join(vuln_fix_versions) | |
for fix_version in vuln_fix_versions: | |
finding_mitigation += f"\n- {fix_version}" | |
Business Logic Flaw (Privilege Escalation) in dojo/importers/default_reimporter.py
Vulnerability | Business Logic Flaw (Privilege Escalation) |
---|---|
Description | The re-import process in DefectDojo allows a user with permissions to import scans to update the fix_available and fix_version fields of existing findings. This means that if a user has the ability to re-import a scan, they can potentially alter the fix status and version of a vulnerability, even if they lack direct permissions to manually edit these fields on a finding. This could bypass intended review or approval workflows for vulnerability remediation. |
django-DefectDojo/dojo/importers/default_reimporter.py
Lines 482 to 484 in 95bf03a
if existing_finding.fix_available != unsaved_finding.fix_available: | |
existing_finding.fix_available = unsaved_finding.fix_available | |
existing_finding.fix_version = unsaved_finding.fix_version |
We've notified @mtesauro.
All finding details can be found in the DryRun Security Dashboard.
The main reason fields are not updated during reimport is that there's a risk it overwrites fields that were changed by the user. At least that's what I think the reason is. And this could be an issue here are the user may have set the |
I mean that is what is requested also in the linked issue explicitly. |
We've discussed this and since this is sort of a "status" field or "meta" field it's OK to let
|
I agree with this approach |
7b12ecf
to
f32fa7a
Compare
Please review @valentijnscholten |
Another point @valentijnscholten : |
Maybe start with just the |
Could we release this for the next release on Monday @mtesauro ? |
c8edad7
to
cc73836
Compare
The |
Then, @valentijnscholten I would suggest to remove it as only a small number of vuln scanners post multiple fixed versions. Also, we can put that information to mitigation |
What do you want the remove? I think the |
Ok, sounds legid |
fyi @kiblik |
c5d2390
to
c94b6e6
Compare
Would be awesome if we could get this on the road for this release @mtesauro |
@manuel-sommer Looks good. Can you update the docs/content/en/connecting_your_tools/import_scan_files/using_reimport.md doc file to also mention the fix_version field. (And rebase the migration) |
Co-authored-by: valentijnscholten <[email protected]>
96605ef
to
a8bd413
Compare
done @valentijnscholten |
#12633 (comment)