Skip to content

Potential fix for code scanning alert no. 10: Imprecise assert#333

Open
neiljhowell wants to merge 1 commit into
masterfrom
alert-autofix-10
Open

Potential fix for code scanning alert no. 10: Imprecise assert#333
neiljhowell wants to merge 1 commit into
masterfrom
alert-autofix-10

Conversation

@neiljhowell

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/Accruent/owasp-zap-historic-parser/security/code-scanning/10

Replace the imprecise membership assertion with assertIn in test/function_test.py at the test_compare_zap_results_resolved test (line 150 in the provided snippet).

  • General fix approach: convert assertTrue(x in y) to assertIn(x, y) (or assertNotIn for negated forms) when no custom message is provided.
  • Best specific fix here: change:
    • self.assertTrue(check_text in result)
    • to self.assertIn(check_text, result)
  • Scope: only the flagged line in test/function_test.py.
  • No imports/dependencies/methods are needed; assertIn is already part of unittest.TestCase.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@neiljhowell neiljhowell marked this pull request as ready for review April 22, 2026 12:21
@neiljhowell neiljhowell self-assigned this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant