Skip to content

IntegrityCheck: tolerate UTF-8 BOM and CRLF in frontmatter parsing (#1732) - #1800

Open
PotatoFarmerBoat wants to merge 1 commit into
danielmiessler:mainfrom
PotatoFarmerBoat:fix/integritycheck-bom-crlf
Open

IntegrityCheck: tolerate UTF-8 BOM and CRLF in frontmatter parsing (#1732)#1800
PotatoFarmerBoat wants to merge 1 commit into
danielmiessler:mainfrom
PotatoFarmerBoat:fix/integritycheck-bom-crlf

Conversation

@PotatoFarmerBoat

Copy link
Copy Markdown

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:

  • a UTF-8 BOM defeats the ^ anchor
  • CRLF line endings defeat the ---\n match

Every affected file then produces a false blocking no frontmatter block finding.

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 .md written with a real BOM + CRLF (EF BB BF leading bytes) is flagged BLOCK: no frontmatter block by 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 -p sessions, plus a windows-latest CI 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 -v is absent from the Windows spawn shell), a directory-junction fallback in setupUserSeparation (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/.ps1 shims 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.

…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>
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.

v7.28.3: IntegrityCheck opens red on a stock install: 239-ref payload debt (#1541 regrown), unshipped replay corpus, BOM/CRLF-blind frontmatter probes

1 participant