-
Notifications
You must be signed in to change notification settings - Fork 1.7k
🎉 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 makes multiple edits to sensitive files (models, templates, importers, and a DB migration) and raises two security concerns: a potential denial-of-service where anchore_grype may create a fix_version string exceeding the Finding.fix_version 100-char DB limit causing DataError on import, and a business-logic flaw where the re-importer can update fix_available/fix_version on existing findings without granular permission checks or explicit audit logging, allowing authorized users to misrepresent remediation status.
🔴 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/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/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/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/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/0243_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 . |
🔴 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 . |
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 concatenates multiple fix versions into a comma-separated string for this field. If the combined length of these versions exceeds 100 characters, attempting to save the Finding object will result in a DataError at the database level. This error will cause the entire scan import process to fail, leading to a denial of service for the import functionality. |
django-DefectDojo/dojo/tools/anchore_grype/parser.py
Lines 133 to 136 in b47805e
fix_version = ", ".join(vuln_fix_versions) | |
for fix_version in vuln_fix_versions: | |
finding_mitigation += f"\n- {fix_version}" | |
Business Logic Flaw - Insufficient Controls on Re-imported Fields in dojo/importers/default_reimporter.py
Vulnerability | Business Logic Flaw - Insufficient Controls on Re-imported Fields |
---|---|
Description | The re-import process allows an authorized user to update the fix_available and fix_version fields of existing findings directly from an uploaded scan file. The code in process_matched_mitigated_finding and process_matched_active_finding applies these changes if the values differ, without additional granular permission checks specifically for these fields or explicit audit logging of these modifications. This allows an authorized user to potentially misrepresent the remediation status of vulnerabilities. |
django-DefectDojo/dojo/importers/default_reimporter.py
Lines 482 to 484 in b47805e
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 |
Business Logic Flaw in dojo/importers/default_reimporter.py
Vulnerability | Business Logic Flaw |
---|---|
Description | The re-import process allows an authorized user to update the fix_available and fix_version fields of existing findings based on the content of an uploaded scan file. While the re-import process itself requires specific permissions (e.g., 'dojo.add_finding' or 'dojo.change_finding'), there are no additional, granular permission checks specifically for modifying the fix_available or fix_version fields. Furthermore, the current implementation does not appear to generate explicit audit log entries for changes to these specific fields during a re-import. This means a user with re-import permissions could potentially manipulate these fields to misrepresent the remediation status of vulnerabilities, impacting reporting and compliance, without a clear audit trail for these specific changes. |
django-DefectDojo/dojo/importers/default_reimporter.py
Lines 595 to 597 in b47805e
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
Yeah, I made an error while rebasing and had two migrations point to the same db migration. Since that rebase, these unit test errors persist. |
done |
I synced the migration with the text change made earlier, now they are green. |
Ah, ok. Thank you. :-) |
A question here @Maffooch and @valentijnscholten : Shall I rename "fix_version" to "fix_description"? |
I'm afraid I'm not following, could you give some more context? |
Dynamic Finding: Static Finding: Thus, fix_version is not really a version fix in static finding, or we rather point on the mitigation field in this regard or leave it open. |
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
#12633 (comment)