Repository navigation
test(hmac): assert the plain-HTTP warning argument exactly - #275
Merged
Merged
Conversation
The two-URL case checked each host with a substring test on the log message. CodeQL reads `"<host>" in message` as incomplete URL sanitisation (py/incomplete-url-substring-sanitization) and raised two high alerts. Compare the record's formatting argument instead, which is also stricter: it pins both URLs and their order. Use a neutral non-loopback host name in the parametrised cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
CodeQL flagged two high-severity
py/incomplete-url-substring-sanitizationalerts on the v2.9.0 release PR, attests/unit/test_hmac_plain_http.py:68-69. They are false positives: the test checked each host with"comlink.example.com" in records[0].getMessage(), and the rule reads a host substring test as URL sanitisation. Code scanning still blocks the merge intomain.test_one_warning_when_both_urls_are_remotenow asserts the log record's formatting argument exactly:("http://comlink.example.com:3000 and http://stats.example.com:3223",). This is stricter than before, because it also pins both URLs and their order.comlink.internal, which is still a non-loopback host, so the case tests the same thing.Test-only change. No library code changed.
Type of change
Checklist
developbranchCHANGELOG.mdnot edited by handVerification
uv run pytest tests/unit/test_hmac_plain_http.py -q: 48 passeduv run ruff check/ruff format --checkon the file: passedmain, so the alerts are confirmed cleared when the release PR is refreshed fromdevelop.🤖 Generated with Claude Code