Skip to content

fix(openvas): retain scanner-reported IP address and remove dead hostname branch - #16734

Open
happymode-25 wants to merge 1 commit into
DefectDojo:masterfrom
happymode-25:fix-openvas-parser-ip-hostname-retention
Open

happymode-25 wants to merge 1 commit into
DefectDojo:masterfrom
happymode-25:fix-openvas-parser-ip-hostname-retention

Conversation

@happymode-25

Copy link
Copy Markdown

Summary

Closes #16002

This PR addresses the issue where the OpenVAS parser dropped scanner-reported IP addresses when hostnames were present, and reconciles the parsing behavior between v1 and v2.

Changes

  1. dojo/tools/openvas/parser_v1/xml_parser.py:
    • Removed unreachable if field.tag == 'hostname': dead code (in Greenbone/OpenVAS XML output, <hostname> is always nested inside <host>, never a direct child of <result>).
    • Extract <hostname> from <host> when present and append **Hostname**: <name> to finding description.
  2. dojo/tools/openvas/parser_v2/xml_parser.py & csv_parser.py:
    • When resolving host endpoints, store both ip_address and hostname in aux_info.
    • In postprocess_finding (common.py), if both ip_address and hostname are present and distinct, append **IP Address**: <ip> to finding description so scanner-reported IP addresses are never lost.
  3. unittests/tools/test_openvas_parser.py:
    • Added assertions ensuring scanner-reported IP addresses and hostnames are preserved in finding descriptions across both v1 and v2 tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenVAS XML parser loses scanner-reported IP address when hostname is present

1 participant