fix(security): neutralize NUL (0x00) in log records (CWE-117 gap from #1270/#1255) - #1422
Conversation
The CWE-117 formatter hardening merged via #1270 (now on main) covers the str.splitlines() boundary set + ESC/FS/GS/RS but omits NUL (0x00). The only cluster PR that carried NUL, #1255, was closed during consolidation without the codepoint being carried over — so main's StructuredFormatter lets a raw NUL reach the sink, where a C-based log shipper can truncate the record. Add ord("\x00"): "\\u0000" to _UNSAFE_LOG_CHARS (the exact fix the cluster consolidation analysis on #1270 specified) so NUL is escaped to a JSON-valid, reversible sequence like the other separators. Adds a focused regression test; the existing table-driven tests auto-extend to cover it. Focused suite: 10 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSFzJYm5bYMuoAo9ssoiAM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Agent Completion Truth Gate: BLOCKEDReasons: Machine-readable verdict{
"details": {
"collection_errors": [
"incomplete_linked_issue_contract",
"linked_issue_not_agent_task",
"missing_intent_snapshot",
"missing_agent_run_id",
"missing_agent_login"
],
"invalid_fields": [
"policy.agent_login",
"policy.run_id"
]
},
"reasons": [
"invalid_payload"
],
"verdict": "blocked"
} |
|
Disposition: Check status on head
Next step is human: final review + merge approval to protected Generated by Claude Code |
Canonical issue
Closes #1421.
Outcome
StructuredFormatternow neutralizes NUL (0x00) alongside the other separators, closing a coverage gap that the #1270/#1255 CWE-117 consolidation left onmain. A raw NUL can no longer reach a log sink where a C-based shipper would truncate the record.Scope
src/youtube_extension/backend/config/logging_config.py— addord("\x00"): "\\u0000"to_UNSAFE_LOG_CHARS; comment updated to note NUL.tests/unit/test_logging_config_crlf.py— focusedtest_nul_byte_is_neutralized; the existing table-driven tests auto-extend to cover the new codepoint.Risk
Verification
Tied to head
7ad248f3a816ff280d19f876fea68617ec63b2b2.pytest tests/unit/test_logging_config_crlf.py→ 10 passed (9 pre-existing + NUL regression)Regression evidence:
origin/main@5934cbf_UNSAFE_LOG_CHARShas no0x00entry; #1255 (the sole NUL carrier) closed 2026-08-04, #1270 merged 2026-08-07 without it. See #1421.Production evidence
Not applicable to runtime behavior: Python-only logging change with no web surface; the
apps/webVercel preview does not exercise it. Correctness is proven by the rendered-output regression suite, including a NUL round-trip and a JSON-parse check.Agent handoff
Closes.Agent provenance
Produced by a scheduled, unattended PR-remediation routine running under the repo owner's account, as a follow-up after #1270 merged. Provenance is disclosed truthfully, but — consistent with the directive established on #810/#1270 not to weaken or impersonate
agent-completion/truth-gate— this PR does not fabricate a frozen pre-dispatch intent snapshot or a trusted terminal-agent-result (it was not opened via the agent dispatch workflow). It therefore HALTS at the human/governance gate by design, kept as draft pending final human review and merge approval to protectedmain.Generated by Claude Code