add management command to import all unit test sample scans#12700
Merged
valentijnscholten merged 2 commits intoJul 3, 2025
Merged
add management command to import all unit test sample scans#12700valentijnscholten merged 2 commits into
valentijnscholten merged 2 commits into
Conversation
|
This pull request contains a hardcoded administrator account in a test utility file, which is marked as experimental and intended for unittest scenarios, with minimal security risk due to its specific context and clear warnings.
Hardcoded Administrator Account in
|
| Vulnerability | Hardcoded Administrator Account |
|---|---|
| Description | This is a valid concern in a test utility. While the code is marked as 'EXPERIMENTAL' and intended for unittest scenarios, hardcoding an admin username creates a potential security anti-pattern. However, since this is explicitly a unittest management command with clear experimental warnings, the risk is minimal in this specific context. |
All finding details can be found in the DryRun Security Dashboard.
11e7873 to
9be1206
Compare
Maffooch
approved these changes
Jun 30, 2025
hblankenship
approved these changes
Jul 2, 2025
dogboat
approved these changes
Jul 3, 2025
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.
I needed a way to load some realistic data into Defect Dojo. Not just one or two big scans, but ideally a couple of products + engagements + tests.
As an experiment I created this management command that imports all unit test sample scans present in the repository.
It's a naive first implementation:
I am committing it anyway as it might be useful for others or maybe other can improve upon it :-)
A similar approach could be just to have an end-to-end test in the test suite that imports all sample scans and ensures there are no errors ("smoke test").
It can also be used for users to just get the import process going and see how the system holds up and/or scales up.
There are about 20 files that needs special attention. Some for example are intentionally malformed, so should not be imported. What could work in the future maybe is to have a copanion file for the scan report named
<scan_report>.json.propertiesor something that holds a json blob with instructions like{"skip_on_all_import": true}or{"scan_type": "parser2"}.With smart defaults this would only be needed for these 20 "special" files.