Skip to content

Replace literal NUL bytes in sources with escapes; add NUL guard (refs #347) - #351

Merged
jimhoyd merged 1 commit into
mainfrom
fix/nul-bytes-347
Sep 21, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
fix/nul-bytes-347

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Refs #347 (does not close it).

Fixes 4 tracked files that Git classified as binary because of literal U+0000: src/site.ts (4 occurrences), src/policies/security.ts, src/scaffold.ts, packages/ui/test/theme.test.ts. Each NUL is now the escape \x00, and the adjacent literal U+001F/U+007F in the same character classes are escaped too. The adversarial tests keep their intent.

Equivalence: every changed regex was compiled old vs new and compared over all 63488 non-surrogate UTF-16 code units, identical. The changed test string is identical via eval.

Guard: scripts/nul-scan.ts, called from scripts/check.ts (so npm run check and verify cover it). It only inspects text extensions, so binary assets are untouched. Test: test/nul-scan.test.ts.

The diff for these four files shows as Bin in this PR because the old side is binary; later diffs are text. npm run verify passes locally. No docs changed.

🤖 Generated with Claude Code

…nst them (refs #347)

Git treated src/site.ts, src/policies/security.ts, src/scaffold.ts and
packages/ui/test/theme.test.ts as binary. Also escapes the adjacent literal
U+001F/U+007F in the same character classes. Adds a NUL scan to check.ts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd merged commit 6a79c6b into main Sep 21, 2026
20 checks passed
@jimhoyd
jimhoyd deleted the fix/nul-bytes-347 branch September 21, 2026 00:20
jimhoyd added a commit that referenced this pull request Sep 21, 2026
… in the checks (#363)

The candidate container mounts the source under another owner, so git refuses
it as dubious ownership. #351 and #284 added git calls that had never run
there; the 0.4.3 candidate failed on the first.

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant