Skip to content

feat(path-guard): drift-resistant allowlist + centralized segment vocabulary#190

Merged
John-David Dalton (jdalton) merged 4 commits into
mainfrom
path-guard-sync
Apr 26, 2026
Merged

feat(path-guard): drift-resistant allowlist + centralized segment vocabulary#190
John-David Dalton (jdalton) merged 4 commits into
mainfrom
path-guard-sync

Conversation

@jdalton

Copy link
Copy Markdown
Collaborator

Summary

Propagates path-guard + token-guard updates from socket-repo-template@bb21ab5.

Mantra: 1 path, 1 reference. Every build/test/runtime path is constructed exactly once; everywhere else references the constructed value.

What's new

  • token-guard: word-boundary match for sensitive env names — eliminates false positives where short fragments matched mid-identifier.
  • Template-literal path detection: hook + gate now flag template-string build paths that were invisible to a path.join-only scanner.
  • Drift-resistant allowlist: replaces ±2-line tolerance with exact-line OR snippet_hash match. snippet_hash is a 12-char SHA-256 prefix of the whitespace-normalized snippet, surviving reformatting but invalidated by content-changing edits.
  • --show-hashes flag: print the hash for each finding when authoring an allowlist entry.
  • Centralized vocabulary (.claude/hooks/path-guard/segments.mts): stage / build-root / mode / sibling-package sets are now imported by both the hook and the gate from one canonical file. The two can no longer drift on what counts as a build-output path.
  • oxfmt sweep across the repo (no behavior change).

Companion propagations

Repo Status
socket-btm merged on main (0960ee27)
socket-repo-template merged on main (bb21ab5)
socket-tui merged on main (8a0ab67)
socket-sdxgen merged on main (f4fd9c6)
ultrathink merged on main (e77b1e849)
socket-packageurl-js merged on main (dcf5d12)
socket-registry merged on main (#278 → f710dd8a)
socket-cli PR #1280 open
socket-sdk-js PR #621 open

Test plan

  • gate runs clean (node scripts/check-paths.mts exits 0)
  • CI passes

…te literal detection

Sync from template@000943d. Hook + gate now flag template-literal build
paths; allowlist replaces ±2 line tolerance with exact-line OR
snippet_hash match. New --show-hashes flag prints SHA-256 prefix for
allowlist entries that survive reformatting.
…ents.mts

Sync from socket-repo-template@bb21ab5. Mantra: 1 path, 1 reference.
Hook and gate now both import STAGE_SEGMENTS, BUILD_ROOT_SEGMENTS,
MODE_SEGMENTS, and KNOWN_SIBLING_PACKAGES from a single canonical
.claude/hooks/path-guard/segments.mts so they can no longer drift on
what counts as a build-output path.
Pre-existing format drift in 7 files — collapsed multi-line array/arg
literals where oxfmt would have inlined them. No semantic changes.
Surfaced by the pre-commit hook running `oxfmt --check .` against the
whole repo.
@jdalton John-David Dalton (jdalton) merged commit 2337a9d into main Apr 26, 2026
10 of 11 checks passed
@jdalton John-David Dalton (jdalton) deleted the path-guard-sync branch April 26, 2026 21:57
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.

1 participant