Commit 28af4c5
committed
chore: env allowlist + path-guard + token-guard + hooks .mts conversion
Consolidates the work previously split across PRs #620 (env allowlist),
#621 (path-guard infra), and #622 (.sh→.mts hook conversion) into a
single commit on chore/harden-env-allowlist.
What's included:
Env allowlist + .cache/ + CLAUDE.md
- Drop NODE_COMPILE_CACHE-equivalent stale env entries
- Allow .env.precommit at any depth in commit-msg hook
- Skip hook scripts in scanners (they contain the literal regex)
- Exclude .cache/** in tsconfig.check.json
- Propagate CLAUDE.md sorting + open-PR + paths + inclusive-language
rules; Set constructor sort rule; don't-revert-untouched rule;
replace whitelist/blacklist with allowlist/denylist
Path-guard infra (.claude/hooks/path-guard/, scripts/check-paths.mts,
.github/paths-allowlist.yml, .claude/skills/path-guard/)
- Mantra: 1 path, 1 reference. PreToolUse hook on Edit|Write blocks
multi-stage build paths constructed inline; companion gate runs
in pnpm check
- Template-literal path detection
- Drift-resistant allowlist via exact-line OR snippet_hash match
- --show-hashes CLI flag for authoring allowlist entries
- Centralized vocabulary in segments.mts (hook + gate share one
source for stage / build-root / mode / sibling-package sets)
- Paren-balanced parser handles nested function-call args
- Multi-line YAML reasons (| and > block scalars)
Token-guard renamed from token-hygiene
- Word-boundary match for sensitive env names (no more false
positives on substring matches inside identifiers)
- Step 1 (ALWAYS_DANGEROUS) now gates on hasRedaction so
'env | sed s/=.*/=<redacted>/' (the suggested fix) actually passes
.sh → .mts hook conversion (Node 25+)
- .git-hooks/_helpers.mts (was _helpers.sh) — exports
filterAllowedApiKeys + scanners for personal paths, AWS keys,
GitHub tokens, private keys, AI attribution
- .git-hooks/{commit-msg,pre-commit,pre-push}.mts (were .sh)
- _helpers.mts hard-fails at module load if Node < 25 (relies on
stable type stripping, no flag)
- Husky shims invoke node directly
Hook package rename
- Drop @socketsecurity/ scope from internal hook packages
(hook-path-guard, hook-token-guard, hook-check-new-deps); they
are private:true and never published to npm
Dep
- Add @sinclair/typebox 0.34.49 to devDependencies (used by
scripts/xport-schema.mts)1 parent 9d5f189 commit 28af4c5
44 files changed
Lines changed: 6626 additions & 474 deletions
File tree
- .claude
- agents
- hooks
- check-new-deps
- path-guard
- test
- token-guard
- test
- skills
- path-guard
- reference
- security-scan
- .config
- .git-hooks
- .github
- .husky
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments