Skip to content

fix: skip Qualys XML findings whose QID has no glossary entry - #16638

Open
Goldloli wants to merge 2 commits into
DefectDojo:devfrom
Goldloli:fix/qualys-parser-missing-glossary-crash
Open

Goldloli wants to merge 2 commits into
DefectDojo:devfrom
Goldloli:fix/qualys-parser-missing-glossary-crash

Conversation

@Goldloli

Copy link
Copy Markdown

Fixes #16633

Description

The Qualys XML parser aborted the whole import with AttributeError: 'NoneType' object has no attribute 'findtext' as soon as any finding's QID had no matching VULN_DETAILS entry in the report's GLOSSARY: the severity lookup that runs after the guarded block dereferenced vuln_item unconditionally.

A finding whose QID is missing from the glossary is now skipped with a warning that names the QID, and the rest of the report imports normally. Of the two behaviors the issue sketches, this takes the skip: the glossary entry is the only source for the finding's severity and title, so there is nothing to import for that finding without inventing values.

Adds a regression test that deletes the qid_6 glossary entry from the sample report and asserts the 8 findings that report QID 6 are skipped with a warning while the remaining 293 import unchanged.

Touches the same lookup that #16632 refactors; the two combine with at most a trivial rebase.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Resolve the conflict with DefectDojo#16632 (linear-time Qualys parsing): upstream now
builds a glossary dict and looks each QID up with glossary.get(), so keep that
lookup and re-apply the missing-glossary guard on top of it — a finding whose
QID has no VULN_DETAILS entry is skipped with a warning instead of crashing the
whole import on vuln_item.findtext('SEVERITY').

Verified after the merge: manage.py test unittests.tools.test_qualys_parser
-> Ran 15 tests OK (includes upstream's 2 new perf tests and our regression
test), ruff 0.16.10 clean.
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

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.

1 participant