Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(consistency): fold CRLF before hashing FLOW lock inputs

Tobi | Nordalux6c7bad3cbd96
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e81ecb0..fc20021 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- `consistency_check.py` reported every FLOW-locked prompt file as a hash
+ mismatch on a stock Windows clone: Git for Windows checks the files out with
+ CRLF (`core.autocrlf=true`) while the lock hashes LF content. The check now
+ folds CRLF before hashing, so the lock only fails on real content changes.
- `url_safety.is_safe_ip` accepted the RFC 6598 shared address space
(100.64.0.0/10), which Python's `ipaddress` does not count as private. Alibaba
Cloud serves instance metadata at 100.100.100.200, so a crafted URL or DNS
diff --git a/scripts/consistency_check.py b/scripts/consistency_check.py
index 8f7fbb3..1857ba9 100644
--- a/scripts/consistency_check.py
+++ b/scripts/consistency_check.py
@@ -230,6 +230,18 @@ def check_agent_refs(files, texts):
return errors
+def _normalise_newlines(data):
+ """Hash lock inputs as LF text so a CRLF checkout matches the baseline.
+
+ The lock is written from LF content (sync_flow.py hashes the fetched text
+ directly). Git for Windows defaults to core.autocrlf=true, which checks the
+ same files out with CRLF, so a byte-for-byte hash flagged every locked file
+ as tampered on a stock Windows clone. Only CRLF is folded; any other change
+ still fails the check.
+ """
+ return data.replace(b"\r\n", b"\n")
+
+
def check_flow_lock(files):
errors = []
locked = {}
@@ -246,7 +258,7 @@ def check_flow_lock(files):
errors.append(f"flow lock: missing {rel}")
continue
with open(full, "rb") as fh:
- got = hashlib.sha256(fh.read()).hexdigest()
+ got = hashlib.sha256(_normalise_newlines(fh.read())).hexdigest()
if got != want:
errors.append(f"flow lock: hash mismatch {rel}")
extra = {f for f in files
diff --git a/tests/test_consistency_check.py b/tests/test_consistency_check.py
index a0f23b6..bdb4c51 100644
--- a/tests/test_consistency_check.py
+++ b/tests/test_consistency_check.py
@@ -15,6 +15,11 @@ from pathlib import Path
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SCRIPT = os.path.join(REPO, "scripts", "consistency_check.py")
+_SCRIPTS = os.path.join(REPO, "scripts")
+if _SCRIPTS not in sys.path:
+ sys.path.insert(0, _SCRIPTS)
+
+import consistency_check # noqa: E402
def run_checker():
@@ -44,3 +49,41 @@ def test_user_facing_markdown_has_no_raw_core_script_paths():
for match in pattern.finditer(path.read_text(encoding="utf-8")):
offenders.append(f"{path.relative_to(root)}: scripts/{match.group(1)}")
assert offenders == [], "raw bundled script paths:\n" + "\n".join(offenders)
+
+
+def _locked_paths() -> list:
+ lock = Path(REPO) / consistency_check.LOCK_PATH
+ return [line.split()[1] for line in lock.read_text(encoding="utf-8").splitlines()
+ if line.strip() and not line.startswith("#")]
+
+
+def _copy_with_crlf(dst: Path, rels: list) -> None:
+ """Mirror ``rels`` under ``dst`` the way core.autocrlf=true checks them out."""
+ for rel in rels:
+ data = (Path(REPO) / rel).read_bytes().replace(b"\r\n", b"\n")
+ target = dst / rel
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_bytes(data.replace(b"\n", b"\r\n"))
+
+
+def test_flow_lock_accepts_crlf_checkout(tmp_path, monkeypatch):
+ """Git for Windows defaults to core.autocrlf=true, so the locked prompt
+ files check out with CRLF while the lock was written from LF content.
+ Hashing must fold CRLF, or a stock Windows clone reports every locked
+ file as tampered."""
+ locked = _locked_paths()
+ _copy_with_crlf(tmp_path, [consistency_check.LOCK_PATH, *locked])
+ monkeypatch.setattr(consistency_check, "REPO", str(tmp_path))
+ assert consistency_check.check_flow_lock(locked) == []
+
+
+def test_flow_lock_still_detects_content_change(tmp_path, monkeypatch):
+ """Folding CRLF must not weaken the lock: any other change is caught."""
+ locked = _locked_paths()
+ _copy_with_crlf(tmp_path, [consistency_check.LOCK_PATH, *locked])
+ with open(tmp_path / locked[0], "ab") as fh:
+ fh.write(b"tampered\r\n")
+ monkeypatch.setattr(consistency_check, "REPO", str(tmp_path))
+ assert consistency_check.check_flow_lock(locked) == [
+ f"flow lock: hash mismatch {locked[0]}"
+ ]