Repository navigation
Conversation
Store the host OS a scanner reports on each finding/location reference (LocationFindingReference.relationship_data["os"]) so a scan's findings can be filtered by the operating system of the affected hosts. - LocationData gains an optional association; AbstractLocation.from_location_data applies it, so parsers can attach host data to the locations they emit. - LocationManager builds finding refs from each finding's own association data and, on reimport, merges changed association data into existing refs (supplied keys overwrite, omitted keys are kept). - Qualys, Qualys Infrascan WebGUI, Nmap (best osmatch) and Nexpose (most certain fingerprint) parsers attach the host OS. - "Host OS" filter on the UI finding filters and `location_os` on the findings API; host_os_* filters on the location finding reference API. - Hosts popover shows each host's OS and highlights hosts matching the filter. Refs DefectDojo#16281
|
This pull request contains multiple low-severity findings where the author 'cvas22' modified several sensitive codepaths, including filters, templates, and models, without being on the allowed authors list. These issues are non-blocking and do not prevent the merge.
Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/filters.py' matches configured sensitive codepath pattern 'dojo/filters.py' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/importers/location_manager.py (drs_a83b51ec)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/location_manager.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/findings_list_snippet.html (drs_27da6976)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/findings_list_snippet.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/view_test.html (drs_3e4f2881)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/view_test.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templatetags/display_tags.py (drs_a0595bda)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templatetags/display_tags.py' matches configured sensitive codepath pattern 'dojo/templatetags/*.py' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templatetags/filter_tags.py (drs_05511ae0)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templatetags/filter_tags.py' matches configured sensitive codepath pattern 'dojo/templatetags/*.py' and was modified by 'cvas22' (commit 73ea562) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/db_migrations/0299_finding_test_numsev_index.py (drs_ecd69bb0)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/db_migrations/0299_finding_test_numsev_index.py' matches configured sensitive codepath pattern 'dojo/db_migrations/*.py' and was modified by 'cvas22' (commit 6c5b178) who is not in the allowed authors list. |
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/finding/models.py (drs_2efbee0b)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/finding/models.py' matches configured sensitive codepath pattern 'dojo/finding/*.py' and was modified by 'cvas22' (commit 6c5b178) who is not in the allowed authors list. |
Comment to provide feedback on these findings.
Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]
Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing
All finding details can be found in the DryRun Security Dashboard.
This branch has not been deployed
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.
Closes #16281
Description
Infrastructure scanners often report each host's operating system, but DefectDojo dropped it (or buried it in the description), so there was no way to narrow an imported scan to e.g. "findings on Windows hosts". This PR keeps the host OS from the report and adds a filter for it.
Where the OS is stored: on each finding↔host reference, in the existing
LocationFindingReference.relationship_dataJSON field ({"os": "..."}). No migration is needed.This placement makes the value per scan, which is what filtering an imported scan needs:
Location/location_meta) would be shared by every product, and the last import would win. Importing an Nmap scan ("Linux 3.X") and then a Qualys scan ("Ubuntu 22.04") would silently change what the Nmap test's filter matches.If maintainers would rather have a dedicated column than a key in
relationship_data, the plumbing below stays the same.Changes
LocationDatagets an optionalassociation(LocationAssociationData), plus aLocationAssociationData.host_os(...)helper.AbstractLocation.from_location_dataapplies it, so any parser can attach per-host data to the locations it emits.LocationManager._persist_locations:osmatch.fingerprints/os, picking the most certain fingerprint. It previously always sethost["os"] = "".location_os, case-insensitive contains) on the UI finding filters. It matches together with the host and location-status filters on the same host, and usesExists()so findings aren't duplicated.location_oson/api/v2/findings/.host_os_*filters on the location finding reference API.data-html="true").V3_FEATURE_LOCATIONSoff) are unchanged; there the OS isn't stored and the filter isn't offered.Test results
unittests/test_location_host_os.py(12 tests):UPDATEwhen nothing changed;nmap_os_detection.xml, since no existing sample had OS detection), Nexpose (including fingerprint selection), Qualys and Qualys WebGUI.location_manager.pyreverted, the per-finding, reimport-update and merge tests fail.test_bulk_locations, location filter/authz/prefetch, API finding filter, filter tags and the four parser modules: 176 tests OK (1 legacy-endpoint test skipped);makemigrations --check: no changes;spectacular --fail-on-warn: OK.Documentation
Added a "Host Operating System" section to
docs/content/asset_modelling/engagements_tests/OS__findings.md(English only).Checklist
dev.dev.bugfixbranch. (n/a, feature)