@@ -182,6 +182,25 @@ describe('token-guard hook', () => {
182182 } )
183183 } )
184184
185+ describe ( 'does not false-positive on substring of sensitive name' , ( ) => {
186+ // Regression: `PATHS-ALLOWLIST.YML` toUpperCase()d contains `PASS`
187+ // as a substring, which the pre-fix unbounded match treated as
188+ // a sensitive env reference. Word-boundary fix means `PASS` must
189+ // be a standalone token (or at a `_`/`-`/`.`/`/` boundary).
190+ it ( 'paths-allowlist.yml does not trip PASS' , ( ) => {
191+ assert . equal ( runHook ( 'cat .github/paths-allowlist.yml' ) . code , 0 )
192+ } )
193+ it ( 'AUTHOR_NAME does not trip AUTH' , ( ) => {
194+ // AUTHOR ends with R; the boundary-after match correctly skips
195+ // it because the next char is `_`, but `AUTH` followed by `O`
196+ // (alphanumeric) is not a token boundary.
197+ assert . equal ( runHook ( 'echo $AUTHOR_NAME' ) . code , 0 )
198+ } )
199+ it ( 'PASSAGE_TIME does not trip PASS' , ( ) => {
200+ assert . equal ( runHook ( 'echo $PASSAGE_TIME' ) . code , 0 )
201+ } )
202+ } )
203+
185204 describe ( 'fails open on malformed input' , ( ) => {
186205 it ( 'empty stdin' , ( ) => {
187206 const r = spawnSync ( nodeBin , [ hookScript ] , {
0 commit comments