You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ci(codeql): two open alerts keep Code Quality red on main #20611
Code Quality on main fails at pipeline-scripts/check_codeql_alert_ceiling.sh: 2 open alerts against a ceiling of 0. Runs on main were being cancelled until recently, so this stayed hidden. First seen failing on 87eae8a; the alerts date from 2026-10-27 and 2026-10-31.
Alert
Rule
Where
Reading
1219
py/path-injection
autobot-backend/chat_history/session.py:911
The session id passes _sanitize_session_id, and the path comes from validate_relative_path. It looks like a false positive; the validators weren't traced end to end.
Traced both alerts end to end on main at 655489c: both are false positives, with no code to fix. Dismissal needs a maintainer.
1219, py/path-injection, autobot-backend/chat_history/session.py:911.get_session_owner opens chat_file. Before that:
_sanitize_session_id rejects an empty id, null bytes, .., / and \.
validate_relative_path (autobot_shared/security/path_validator.py:157) rejects absolute paths, parent references and drive qualifiers, then compares realpath results with relative_to(base), which also catches a symlink pointing out of the base.
The base is _get_chats_directory(), from configuration. CodeQL's Python analysis can't be taught custom sanitizers (noted in .github/codeql/codeql-config.yml), so it can't see this barrier. Not run against a live system; the validator's tests are path_validator_test.py.
1213, py/weak-sensitive-data-hashing, autobot-slm-backend/user_management/services/api_key_service.py:182._hmac_hex is HMAC-SHA256 under a pepper, used as a lookup digest for API tokens. Its callers are all in this file, and the only outside entry is validate_key(x_api_key) from the X-API-Key header (services/auth.py:383). Tokens are secrets.token_hex(20), 160 random bits, so a slow password hash adds nothing, and a lookup digest must be deterministic. No account password reaches it. What CodeQL treats as the password source wasn't established, because the alert's message gives only the rule text.
Close-by, not in this alert: _hash_key_legacy is bare SHA-256 kept to verify old rows. It's also a lookup of random tokens, so it isn't a password weakness; if it's alerted later, the same reasoning applies.
Maintainer decision 2026-11-06 for alert 1213: sunset the old key formats, 30-day cutoff.
New SLM API keys are stored as a deterministic PBKDF2-HMAC-SHA256 digest with the pepper as salt. The iteration count is set from a latency measurement.
An old-format key (HMAC-SHA256 under the current pepper, HMAC under the legacy pepper, or bare SHA-256) is re-hashed to PBKDF2 on its next successful use.
30 days after the change lands, old-format keys that were never re-hashed expire and must be reissued. The legacy verifiers are then removed, and alert 1213 closes on the next scan.
Alert 1219 is not blocked: one containment fix in validate_relative_path (or an allow-pattern on the session id), covering the chat-file sinks in chat_history/session.py at 125, 137, 253, 428, 769, 780 and 911.
Maintainer decision 2026-11-06, superseding the 30-day sunset: no integration uses SLM API keys yet, and the existing keys are test keys issued by automation. So the old-format verifiers are removed now. Only the PBKDF2 digest is accepted, and old-format keys must be reissued. The cutoff clock and the follow-up #20869 are no longer needed. Review fixes go into the same PR: a fixed iteration constant, and the two chat-file sinks (session_listing.py:395, terminal_logger.py:76) routed through validate_relative_path.
AC check against main after the PR #20870 landing (merge bb1f46a, via train PR #20836). Issue stays open; no box ticked.
AC 1, each alert fixed or dismissed: partly proven, not complete.
1213 (py/weak-sensitive-data-hashing): code-scanning state is fixed (fixed_at 2026-11-06T06:33Z, refs/heads/main). Code on main: autobot-slm-backend/user_management/services/api_key_service.py:161, hashlib.pbkdf2_hmac("sha256", ..., PBKDF2_ITERATIONS); _hash_key_legacy and _hmac_hex are no longer present.
1219 (py/path-injection, autobot-backend/chat_history/session.py:911): state is still open. Code on main has an inline os.path.realpath plus startswith(root + os.sep) containment at the read (session.pyget_session_owner), and validate_relative_path is wired into session.py (lines 105, 111, 133, 533, 645, 652, 671, 678, 778, 865), session_listing.py:410 and autobot_logging/terminal_logger.py:66. But the latest CodeQL analysis of main is on d6899a3 (2026-11-06T11:17+02:00), which is before bb1f46a (13:19+02:00). CodeQL has not rescanned main since the fix, so the alert closing is unproven.
AC 2, Code Quality passes on main: not proven. The latest completed Code Quality run on main (d6899a3) failed. The runs on bb1f46a are still queued.
Pending: a CodeQL scan of main at or after bb1f46a showing 1219 fixed, then a green Code Quality on main. Will re-check then.
PR #20870 landed in main via merge train #20836 (merge bb1f46a). Checked against current origin/main:
AC1 "Each alert is fixed, or dismissed by a maintainer with its reason." — ✅ ticked. Code-scanning alerts 1213 and 1219 are both state fixed (fixed 2026-11-06); api_key_service.py:161 uses hashlib.pbkdf2_hmac.
AC2 "Code Quality passes on main." — NOT ticked: the latest Code Quality runs on main (push and pull_request) are cancelled, so no passing run shows it. Stays open until one completes green on main.
Activity
mrveiss commentedon Nov 2, 2026
Traced both alerts end to end on
mainat 655489c: both are false positives, with no code to fix. Dismissal needs a maintainer.1219,
py/path-injection,autobot-backend/chat_history/session.py:911.get_session_owneropenschat_file. Before that:_sanitize_session_idrejects an empty id, null bytes,..,/and\.validate_relative_path(autobot_shared/security/path_validator.py:157) rejects absolute paths, parent references and drive qualifiers, then comparesrealpathresults withrelative_to(base), which also catches a symlink pointing out of the base.The base is
_get_chats_directory(), from configuration. CodeQL's Python analysis can't be taught custom sanitizers (noted in.github/codeql/codeql-config.yml), so it can't see this barrier. Not run against a live system; the validator's tests arepath_validator_test.py.1213,
py/weak-sensitive-data-hashing,autobot-slm-backend/user_management/services/api_key_service.py:182._hmac_hexis HMAC-SHA256 under a pepper, used as a lookup digest for API tokens. Its callers are all in this file, and the only outside entry isvalidate_key(x_api_key)from theX-API-Keyheader (services/auth.py:383). Tokens aresecrets.token_hex(20), 160 random bits, so a slow password hash adds nothing, and a lookup digest must be deterministic. No account password reaches it. What CodeQL treats as the password source wasn't established, because the alert's message gives only the rule text.Close-by, not in this alert:
_hash_key_legacyis bare SHA-256 kept to verify old rows. It's also a lookup of random tokens, so it isn't a password weakness; if it's alerted later, the same reasoning applies.mrveiss commentedon Nov 5, 2026
Maintainer decision 2026-11-05: both alerts are fixed in code, not dismissed ("alert has a reason and it needs to be fixed").
One PR,
Refs #20611.mrveiss commentedon Nov 6, 2026
Maintainer decision 2026-11-06 for alert 1213: sunset the old key formats, 30-day cutoff.
Alert 1219 is not blocked: one containment fix in
validate_relative_path(or an allow-pattern on the session id), covering the chat-file sinks inchat_history/session.pyat 125, 137, 253, 428, 769, 780 and 911.mrveiss commentedon Nov 6, 2026
Maintainer decision 2026-11-06, superseding the 30-day sunset: no integration uses SLM API keys yet, and the existing keys are test keys issued by automation. So the old-format verifiers are removed now. Only the PBKDF2 digest is accepted, and old-format keys must be reissued. The cutoff clock and the follow-up #20869 are no longer needed. Review fixes go into the same PR: a fixed iteration constant, and the two chat-file sinks (
session_listing.py:395,terminal_logger.py:76) routed throughvalidate_relative_path.fix(security): PBKDF2-only SLM API keys, fixed iteration count, chat-…
fix(train): one ignore list per dependabot block; legacy-pepper guard…
mrveiss commentedon Nov 6, 2026
AC check against main after the PR #20870 landing (merge bb1f46a, via train PR #20836). Issue stays open; no box ticked.
AC 1, each alert fixed or dismissed: partly proven, not complete.
py/weak-sensitive-data-hashing): code-scanning state isfixed(fixed_at 2026-11-06T06:33Z,refs/heads/main). Code on main:autobot-slm-backend/user_management/services/api_key_service.py:161,hashlib.pbkdf2_hmac("sha256", ..., PBKDF2_ITERATIONS);_hash_key_legacyand_hmac_hexare no longer present.py/path-injection,autobot-backend/chat_history/session.py:911): state is stillopen. Code on main has an inlineos.path.realpathplusstartswith(root + os.sep)containment at the read (session.pyget_session_owner), andvalidate_relative_pathis wired intosession.py(lines 105, 111, 133, 533, 645, 652, 671, 678, 778, 865),session_listing.py:410andautobot_logging/terminal_logger.py:66. But the latest CodeQL analysis of main is on d6899a3 (2026-11-06T11:17+02:00), which is before bb1f46a (13:19+02:00). CodeQL has not rescanned main since the fix, so the alert closing is unproven.AC 2,
Code Qualitypasses on main: not proven. The latest completedCode Qualityrun on main (d6899a3) failed. The runs on bb1f46a are still queued.Pending: a CodeQL scan of main at or after bb1f46a showing 1219
fixed, then a greenCode Qualityon main. Will re-check then.fix(slm): hash API keys with PBKDF2, sunset old formats after 30 days…
test(slm): use the canonical fake session; re-anchor the threat model…
mrveiss commentedon Nov 8, 2026
PR #20870 landed in main via merge train #20836 (merge bb1f46a). Checked against current origin/main:
fixed(fixed 2026-11-06);api_key_service.py:161useshashlib.pbkdf2_hmac.Code Qualitypasses onmain." — NOT ticked: the latestCode Qualityruns on main (push and pull_request) arecancelled, so no passing run shows it. Stays open until one completes green on main.