Repository navigation
Conversation
Signed-off-by: Muhammad Adnan <muhammad1414114@gmail.com>
kmlyz
left a comment
There was a problem hiding this comment.
Thanks for working on #2478! A few things stood out while testing:
- In
vulnerabilities/views.py, the other three curation views (package, severity, weakness) still indexissue_detail["curation_items"]directly and raise a KeyError when empty, so.get("curation_items", [])could help there too. - In
AdvisoryMitigationCurationView, if the first advisory has no summary and a second one does,avidcomes from the second whilecuration_itemsstill reads from the first. - The anchor test only checks the opening
has-text-infotag, so it still passes without a closing</a>.
Signed-off-by: Muhammad Adnan <muhammad1414114@gmail.com>
|
Thanks for the thorough review @kmlyz! I have pushed commit
|
kmlyz
left a comment
There was a problem hiding this comment.
Thanks for the update, @Adnan9-63. The curation view KeyError guards and advisory selection consistency look good now and the 5 AdvisoryCurationViewTestCase tests pass.
One small catch on the anchor test: BeautifulSoup with html.parser auto-closes unclosed anchor tags when serializing str(td), so checking </a> on the parsed soup still passes even if the closing tag is missing in the template. Checking the raw response content directly (for example per raw td cell) would catch a regression.
Signed-off-by: Muhammad Adnan <muhammad1414114@gmail.com>
|
Good catch @kmlyz — |
kmlyz
left a comment
There was a problem hiding this comment.
Thanks for updating the test, @Adnan9-63. Checked commit a50beff and verified that reverting the closing anchor tag now fails the raw cell assertion while all five AdvisoryCurationViewTestCase tests pass.
Everything looks good from my side.
What changes does this PR introduce?
This PR addresses issue #2478 by fixing crashes in
AdvisoryMitigationCurationViewand resolving broken table markup inadvisory_todos.html.Specifically:
AdvisoryMitigationCurationView:adv.summary and adv.summary.strip()to preventAttributeErrorwhensummaryisNone.next(iter(advisory_summaries))by falling back tofirst_advisory.avidorNoneif summaries are empty.first_advisory.impacted_packagesso TODO items with 0 advisories return an emptycuration_itemslist rather than raising anAttributeError.advisory_todos.html:</a>tag is rendered forCONFLICTING_SEVERITY_SCORES,CONFLICTING_WEAKNESSES, andMISSING_FIXED_BY_PACKAGE(previously onlysupported_curationtypes closed</a>, leaving the other types unclosed).mitigation_curation.html:{% if avid %}to avoid reverse URL lookup errors whenavidisNone.AdvisoryCurationViewTestCaseinvulnerabilities/tests/test_view.pytesting mitigation curation with empty/whitespace summaries, 0 advisories, and full anchor tag closure across all issue types inadvisory_todos.html.Fixes #2478
Checklist
black --checkandisort --checkpytest vulnerabilities/tests/test_view.py -k AdvisoryCurationViewTestCase