Conversation
PolicyEnforcer.java carried two raw NUL (U+0000) bytes on the dedupKey line in missingReferenceLogger, written as literal control characters rather than as unicode escapes. NUL is a fine separator choice there - it cannot collide with a policy id, entry label or entry reference - but as a raw byte it makes the whole file binary to any tool that scans for NUL. The practical damage is silent search failure: `grep -n <pattern> PolicyEnforcer.java` prints *nothing* for a 650-line Java file, because grep classifies a file containing NUL as binary and suppresses matches. Not an error, no diagnostic - it reads exactly like "no matches". ripgrep at least says "binary file matches". I hit this while reviewing an unrelated change and initially mistook it for a broken tool. It survived review because git's binary heuristic only inspects the first 8000 bytes, and these NULs sit at roughly offset 8340 - just past the window. So git diff, git blame and the GitHub web view all rendered the file as normal text while grep silently ignored it. Replaces each raw byte with the six-character unicode escape. Unicode escapes are resolved by the Java lexer, so the string literal still contains exactly one NUL character and nothing about runtime behaviour changes: recompiling the module before and after produces byte-for-byte identical class files (verified for PolicyEnforcer.class and all five sibling classes). No new test - there is no behavioural delta to pin, and the dedup path is unchanged. Scanned every git-tracked text file in the repository; this was the only one affected. policies/enforcement 278 tests green, license:check clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PolicyEnforcer.javacarries two raw NUL (U+0000) bytes on thededupKeyline inmissingReferenceLogger-- written as literal control characters instead of unicode escapes.This replaces each with the six-character escape
\u0000.Why
NUL is a perfectly good separator here -- it cannot collide with a policy id, entry label or
entry reference. The problem is only that it was written as a raw byte, which makes the whole
file binary to any tool that scans for NUL.
The practical damage is silent search failure:
grepclassifies a file containing NUL as binary and suppresses matches. No error, nodiagnostic -- it reads exactly like "no matches".
ripgrepis only marginally better,reporting
binary file matches (found "\0" byte around offset 8340)instead of thematching lines.
I hit this while reviewing an unrelated change to this file and initially mistook it for a
broken tool.
Why it went unnoticed
Git's binary heuristic only inspects the first 8000 bytes of a file. These NULs sit at
roughly offset 8340 -- just past the window. So
git diff,git blameand the GitHub webview all render the file as ordinary text, while
grepsilently ignores it. Introduced in3ab05665e8(2026-04-30).Behaviour
Unchanged, verified at the artifact level. Unicode escapes are resolved by the Java lexer,
so the string literal still contains exactly one NUL character. Compiling the module before and
after the change produces byte-for-byte identical class files -- checked with
cmpforPolicyEnforcer.classand all five sibling classes in the package.No new test: there is no behavioural delta to pin, and a test asserting "this source file
contains no NUL bytes" would be testing the toolchain rather than the code.
Scope
I scanned every git-tracked text file in the repository (
.java,.conf,.yml,.xml,.md,.tpl,.sh,.json,.properties,.js,.ts,.html,.css) for NUL bytes --this was the only affected file.
policies/enforcement278 tests green,mvn license:checkclean.