Commit bd48523
committed
fix(hooks): align pre-push .env detection + fix sed redaction regex (Bugbot)
Two issues from Cursor Bugbot's review of cli #1279:
1. token-guard sed redaction regex couldn't cross delimiter boundary
(high). The pattern /\bsed\b[^|]*s[/|#][^/|#]*=[^/|#]*<?redact/i
used [^/|#]* which stops at the / between sed pattern and
replacement, so 'sed s/=.*/=<redacted>/' (the canonical fix the
error message suggests) never matched. Replaced with [\s\S]*? to
reach across the delimiter.
2. pre-push.mts .env detection only matched root-level .env / .env.local
(high). commit-msg.mts and pre-commit.mts both use basename() with
a broader pattern. pre-push is the mandatory enforcement layer for
--no-verify bypasses; weaker detection there meant a nested
packages/cli/.env.local would slip through. Aligned to basename-
based matching with the same allowlist (.env.example/.env.test/
.env.precommit).1 parent d0d004a commit bd48523
2 files changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | | - | |
46 | | - | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
193 | | - | |
194 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
0 commit comments