Skip to content

Commit 99d1cec

Browse files
devopamclaude
andcommitted
security: suppress CodeQL clear-text-logging false positive on the fixed line
CodeQL's default query pack doesn't model first-party functions as sanitizers, so it keeps flagging the logger.error(...) call in _execute_with_connection even after both arguments are routed through obfuscate_password (the actual fix, landed in 038b5dd/cca7e50) -- the static analyzer can't trace that the returned value is safe. Suppressed with an inline `# codeql[py/clear-text-logging-sensitive-data]` comment, following the exact convention already used in this repo (tests/unit/test_secrets.py:234) -- GitHub's own supported suppression syntax, not a custom workaround. The comment documents why it's safe: the redaction is verified by tests/unit/test_sql_kernel_{obfuscate, driver}.py, including the SQL-escaped-embedded-quote edge case independently corroborated by gemini-code-assist's review on this PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESh2w9n8kzbLskHoq9w2UH
1 parent 657e4ae commit 99d1cec

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/mcpg/sql/driver.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ async def _execute_with_connection( # pragma: no cover - real psycopg execution
296296
# alert #5).
297297
logger.error(
298298
"Error executing query (%s): %s",
299+
# codeql[py/clear-text-logging-sensitive-data]: obfuscate_password
300+
# IS the sanitizer for this taint flow -- CodeQL's default query
301+
# pack doesn't model first-party functions as sanitizers, so it
302+
# keeps flagging the pre-sanitization taint even after the fix.
303+
# Verified redacted (including the SQL-literal-with-embedded-quote
304+
# edge case) in tests/unit/test_sql_kernel_{obfuscate,driver}.py.
299305
obfuscate_password(str(query)),
300306
obfuscate_password(str(e)),
301307
)

0 commit comments

Comments
 (0)