Skip to content

fix(security): neutralize NUL (0x00) in log records (CWE-117 gap from #1270/#1255) - #1422

Merged
groupthinking merged 2 commits into
mainfrom
claude/determined-maxwell-gbxcgj
Aug 7, 2026
Merged

fix(security): neutralize NUL (0x00) in log records (CWE-117 gap from #1270/#1255)#1422
groupthinking merged 2 commits into
mainfrom
claude/determined-maxwell-gbxcgj

Conversation

@groupthinking

Copy link
Copy Markdown
Owner

Canonical issue

Closes #1421.

Outcome

StructuredFormatter now neutralizes NUL (0x00) alongside the other separators, closing a coverage gap that the #1270/#1255 CWE-117 consolidation left on main. A raw NUL can no longer reach a log sink where a C-based shipper would truncate the record.

Scope

  • Included:
    • src/youtube_extension/backend/config/logging_config.py — add ord("\x00"): "\\u0000" to _UNSAFE_LOG_CHARS; comment updated to note NUL.
    • tests/unit/test_logging_config_crlf.py — focused test_nul_byte_is_neutralized; the existing table-driven tests auto-extend to cover the new codepoint.
  • Explicitly excluded:
    • No change to the escaping scheme, the other separators, or call sites. This is purely the one missing codepoint.

Risk

  • Risk level: low
  • Failure mode: a NUL in log content now renders as the literal `` escape (content preserved, reversible, JSON-valid) instead of a raw byte. JSON logging is improved (a raw NUL is not valid inside a JSON string).
  • Rollback: revert this commit; the table returns to its post-fix(security): neutralize CR/LF in rendered log records (CWE-117) #1270 state.

Verification

Tied to head 7ad248f3a816ff280d19f876fea68617ec63b2b2.

  • Focused tests — pytest tests/unit/test_logging_config_crlf.py10 passed (9 pre-existing + NUL regression)
  • Required CI — pending on this head
  • Review threads resolved — n/a (new PR)

Regression evidence: origin/main @ 5934cbf _UNSAFE_LOG_CHARS has no 0x00 entry; #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/web Vercel 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

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 protected main.


Generated by Claude Code

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
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-uvai Ready Ready Preview, v0 Aug 7, 2026 8:48pm

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • [‘architecture-gap’, ‘bug’, ‘ci-cd’, ‘ci/cd’, ‘copilot-rabbit’, ‘documentation’, ‘duplicate’, ‘enhancement’, ‘frontend’, ‘github_actions’, ‘good first issue’, ‘help wanted’, ‘high-priority’, ‘invalid’, ‘javascript’, ‘ml-model’, ‘needs-triage’, ‘pipeline-critical’, ‘placeholder-code’, ‘priority:high’, ‘python’, ‘python:uv’, ‘question’, ‘styling’, ‘tests’, ‘v0’]

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f1cc0589-0d54-44dc-9a2c-b1f3d3bfce92

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the python label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 923a04d.
Ensure 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 Files

None

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Agent Completion Truth Gate: BLOCKED

Reasons: invalid_payload

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"
}

Workflow evidence

Copy link
Copy Markdown
Owner Author

Disposition: HALTED(awaiting_human_governance_gate) — engineering-green, no autonomous merge.

Check status on head 7ad248f:

Next step is human: final review + merge approval to protected main (this closes the NUL/0x00 CWE-117 gap #1270 left behind — see #1421). I won't re-post on subsequent truth-gate re-runs of the same by-design block; if a real engineering check fails I'll fix it and push.


Generated by Claude Code

@groupthinking
groupthinking marked this pull request as ready for review August 7, 2026 20:46
@groupthinking
groupthinking merged commit c0cdd96 into main Aug 7, 2026
19 of 22 checks passed
@groupthinking
groupthinking deleted the claude/determined-maxwell-gbxcgj branch August 7, 2026 20:46
@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

GRV-368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CWE-117: StructuredFormatter does not neutralize NUL (0x00) after #1270/#1255 consolidation

2 participants