IntegrityCheck: tolerate UTF-8 BOM and CRLF in frontmatter parsing (#1732) - #1800
Open
PotatoFarmerBoat wants to merge 1 commit into
Open
IntegrityCheck: tolerate UTF-8 BOM and CRLF in frontmatter parsing (#1732)#1800PotatoFarmerBoat wants to merge 1 commit into
PotatoFarmerBoat wants to merge 1 commit into
Conversation
…anielmiessler#1732) Both frontmatter anchor regexes fail on Windows checkouts: a UTF-8 BOM defeats the start anchor and CRLF line endings defeat the newline match, so every affected file produces a false blocking no-frontmatter finding. Normalize the file read - strip the BOM, convert CRLF to LF - before matching. Verified A/B on Windows 11: a BOM+CRLF fixture is flagged by the current build and produces zero findings after this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fixes #1732 (the CRLF/BOM false-positive class).
Problem
Both frontmatter anchor regexes in
IntegrityCheck.ts(/^---\n([\s\S]*?)\n---/, used by the commands/agents check and the skills check) fail on Windows checkouts:^anchor---\nmatchEvery affected file then produces a false blocking
no frontmatter blockfinding.Fix
Normalize the file read (strip
, convert CRLF to LF) before matching, at both parse sites. Four lines, no behavior change for LF files.Verification
A/B on Windows 11 (bun 1.3.14): a fixture
.mdwritten with a real BOM + CRLF (EF BB BFleading bytes) is flaggedBLOCK: no frontmatter blockby the current build and produces zero findings after this change.Found while validating LifeOS native on Windows — the full hook pipeline runs there (verified against live
claude -psessions, plus awindows-latestCI probe suite). If Windows support is welcome, I have a small stack of similarly-scoped fixes ready to submit one at a time:Bun.which()for tool detection (command -vis absent from the Windows spawn shell), a directory-junction fallback insetupUserSeparation(the sibling of #1730's fix), a backslash-path normalization sweep for the hook layer (the #1119 class, with unit tests), and launcher spawn support for the.cmd/.ps1shims npm actually installs. Happy to open them in whatever order/shape you prefer.Developed with Claude (co-author trailer on the commit); every change was probed on a real Windows machine before submission.