Repository navigation
Rename a test variable that CodeQL reports as sensitive - #5266
Merged
Jay W (JayDoubleu) merged 2 commits intoOct 19, 2026
Merged
Conversation
CodeQL marks the value in the variable `secret` as sensitive because of the variable name. The test sends this value into the operation polling log calls, so CodeQL reported 6 py/clear-text-logging-sensitive-data alerts in deployment.py and resource.py. The log calls redact the value, and the test makes sure of this. The new name `untrusted_value` removes the 6 alerts. The test value and the assertions do not change.
Unit Test Results0 tests 0 ✅ 0s ⏱️ Results for commit bdb0b51. |
Marcus Robinson (marrobi)
approved these changes
Oct 19, 2026
Jay W (JayDoubleu)
marked this pull request as ready for review
October 19, 2026 11:20
Chris Chapman (ChrisChapman-gh)
approved these changes
Oct 19, 2026
Collaborator
Author
|
/test-force-approve |
|
🤖 pr-bot 🤖 ✅ Marking tests as complete (for commit bdb0b51) (in response to this comment from Jay W (@JayDoubleu)) |
Max Martin (maxmartin-cgi)
approved these changes
Oct 19, 2026
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 is being addressed
CodeQL code scanning reports 6 High alerts (58 to 63) for
py/clear-text-logging-sensitive-dataonmain. The alerts are in these locations:e2e_tests/resources/deployment.py, lines 134 and 137e2e_tests/resources/resource.py, lines 174, 183, 187 and 194All 6 alerts start from one test value in
e2e_tests/unit_tests/test_polling_diagnostics.py, line 187:CodeQL marks this value as sensitive because the variable name is
secret. The value is not real data. The test sends it towait_for()as the operation endpoint and as the operation state. Then the test makes sure that the value does not go into the logs.The alerts are false positives. A false positive is an alert for a problem that does not exist. The log calls already replace unknown values with
<redacted>:operation_log_path()returns the path only if the full path matches_OPERATION_PATH, which accepts only UUIDs.operation_log_state()returns the state only if the state is in the_OPERATION_STATESset.polling_failure_details()returns only fixed data about the response, and no body, URL parameters or authentication headers.CodeQL does not know that a pattern match or a set lookup removes unsafe values. For this reason, CodeQL reports the alerts.
How is this addressed
secrettountrusted_valueintest_unknown_paths_and_states_are_redacted_and_bounded. The change is on 3 lines. The test value"response-secret"and the assertions do not change, so the test still makes sure that the value does not go into the logs.deployment.pyandresource.pydo not change.CHANGELOG.md.Test results
I ran the CodeQL CLI 2.27.2 locally. CI used the same version for the last code scanning analysis of
main. I used the same query suite as the CodeQL workflow (python-code-scanning.qls) on all 381 Python files:py/clear-text-logging-sensitive-dataalertsmain(0c5027e9)These are the commands for the local CodeQL run:
I also ran the E2E unit tests and the linters with the same Python version and dependencies as the
e2e_helper_tests.ymlworkflow (Python 3.12,e2e_tests/unit_tests/requirements.txt):mainPYTHONPATH=.:e2e_tests python -m unittest discover -s e2e_tests/unit_testsruff check(v0.15.17, as pinned in.pre-commit-config.yaml)ruff format --checkIf a later change adds a variable with a name such as
secret,passwordortoken, and its data goes into these log calls, CodeQL will report new alerts.