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
[Bug]: Literal NUL bytes make TypeScript sources opaque to Git review #347
origin/main at 7972185, source inspection on macOS. No runtime behavior was executed.
Minimal reproduction
Several tracked TypeScript files embed a literal U+0000 byte inside regex character classes intended to reject control characters. For example:
git show origin/main:src/site.ts | file -
# /dev/stdin: data
git show origin/main:src/site.ts | tr -cd "\000"| wc -c
# 4
The same scan finds one literal NUL in each of:
src/policies/security.ts
src/scaffold.ts
packages/ui/test/theme.test.ts
src/site.ts therefore appears as Bin in Git diffs, including the recent site.notFound change, rather than exposing a reviewable TypeScript patch.
Relevant output
The bytes occur only in regex ranges such as [^\s<NUL>-\x1f\x7f] and /<NUL>-\x1f\x7f/, so they appear to be an accidental source encoding choice rather than required data. Node accepts the source, but Git classifies every affected file as binary.
Replace literal control bytes with textual JavaScript escapes (for example \u0000-\u001f\u007f) while preserving regex semantics and adversarial control-character tests. Add a lightweight repository guard that rejects literal NUL bytes in tracked source/test text files, so future code reviews stay textual.
Progress: PR #351 opened: literal NUL bytes replaced by \x00 escapes in src/site.ts, src/policies/security.ts, src/scaffold.ts and packages/ui/test/theme.test.ts, proven equivalent over all non-surrogate code units, plus scripts/nul-scan.ts wired into npm run check.
Fixed in #351: the literal NUL bytes in src/site.ts, src/policies/security.ts, src/scaffold.ts and packages/ui/test/theme.test.ts are now \x00 escapes (regexes checked identical over all non-surrogate UTF-16 code units; lone surrogates were not covered), and scripts/nul-scan.ts, run by npm run check, fails on a literal NUL in any tracked text-extension file. The same character classes also held literal U+001F and U+007F, which are escaped too.
Activity
jimhoyd commentedon Sep 20, 2026
Progress: an agent has started on this; a PR will be linked here when it opens.
jimhoyd commentedon Sep 21, 2026
Progress: PR #351 opened: literal NUL bytes replaced by \x00 escapes in src/site.ts, src/policies/security.ts, src/scaffold.ts and packages/ui/test/theme.test.ts, proven equivalent over all non-surrogate code units, plus scripts/nul-scan.ts wired into npm run check.
Replace literal NUL bytes in sources with \x00 escapes and guard agai…
Replace literal NUL bytes in sources with \x00 escapes and guard agai…
jimhoyd commentedon Sep 21, 2026
Fixed in #351: the literal NUL bytes in src/site.ts, src/policies/security.ts, src/scaffold.ts and packages/ui/test/theme.test.ts are now \x00 escapes (regexes checked identical over all non-surrogate UTF-16 code units; lone surrogates were not covered), and scripts/nul-scan.ts, run by npm run check, fails on a literal NUL in any tracked text-extension file. The same character classes also held literal U+001F and U+007F, which are escaped too.