Skip to content

Commit 8ad29da

Browse files
committed
fix(token-guard): skip ALWAYS_DANGEROUS check when redaction is already present
1 parent 82aeebc commit 8ad29da

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.claude/hooks/token-guard/index.mts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ const check = (command: string): void => {
158158
}
159159
}
160160

161-
// 1. Always-dangerous patterns.
161+
// 1. Always-dangerous patterns. Skip when the command already has a
162+
// redaction pipeline — the suggested fix here is `env | sed ...`,
163+
// which would itself match ALWAYS_DANGEROUS without this guard.
162164
const dangerous = matchesAlwaysDangerous(command)
163-
if (dangerous) {
165+
if (dangerous && !hasRedaction(command)) {
164166
throw new BlockError(
165167
`\`${dangerous.source}\` dumps env to stdout`,
166168
'Pipe through redaction, e.g. `env | sed "s/=.*/=<redacted>/"` or filter specific keys.',

0 commit comments

Comments
 (0)