Repository navigation
Conversation
Contributor
Author
|
@santi-webflow I think you probably have a good idea of the leak shape that this hopes to cover so I'd love a bit of feedback! |
arr-wf
force-pushed
the
feat/redis-auth-rules
branch
from
October 27, 2026 18:41
e527710 to
dbc2f21
Compare
Merged
Contributor
Author
|
Cherry-picked into the v0.1.2 release PR #22 so it ships with this release. Please keep the rule review here. I'll close this PR once #22 merges. 🤖 Generated with Claude Code |
Upstream betterleaks has a structural gap for Redis: a bare AUTH password carries no token prefix and no key=value shape, so the plain AUTH command line, the node-redis structured error form, redis-cli -a/--pass invocations, and RESP protocol dumps all passed through unredacted. Port the four redis-auth rules from webflow/secrets-scrubber (built around a real Redis key leak into an AI session), adapted from JS to RE2 + CEL-filter semantics: its reference-value heuristic becomes a per-rule filter, its tempered-dot becomes a whitespace/backslash-excluding class, and the RESP rule additionally requires the *N array header (all of its fixtures carry it) to keep prose dollar-amounts from matching. Every rule carries a minimum-length floor: a sub-8-char finding trips Splices over-redact backstop against unrelated lines carrying the same short form, which is a worse failure than over-redacting a short password. Co-authored-by: Pi <noreply@pi.dev> Signed-off-by: Andrew Rose <andrew.rose@webflow.com>
arr-wf
force-pushed
the
feat/redis-auth-rules
branch
from
October 27, 2026 18:51
dbc2f21 to
c8bee52
Compare
Contributor
Author
|
Shipped in #22 (v0.1.2). The commit was cherry-picked there and is now on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes a structural detection gap for Redis credentials: a bare Redis
AUTH password has no token prefix and no
key=valueshape — the two formsgitleaks-class rules can detect — so four common leak shapes passed through
unredacted (upstream betterleaks v1.2 + embedded pack as of v0.1.1):
AUTH [user] <password>command line as error logs and pastedshell history show it
args: [ 'AUTH', … ]arrays andtheir JSON rendering, with or without an ACL username)
redis-cli-a/--passinvocationsescaped CRLF, space-flattened)
The four embedded rules are ported rule-for-rule from
webflow/secrets-scrubber
(@santi-webflow — your project inspired this, and the four gates below are
yours; requesting your review specifically on the JS→RE2 fidelity).
RE2 + CEL adaptations from the JS originals (RE2 has no lookaheads, betterleaks
has no replace-callbacks):
$VARrefs,process.env.*chains, templateplaceholders must pass) → per-rule CEL
filter(matchesAnyonfinding["secret"]).[a-z]*[A-Z0-9]prefix, keeping the secret-span start anchored.[^\s\\]+(bulk strings can't contain CRLF;the escaped encoding reserves the backslash).
*Narray header — all ofsecrets-scrubber's RESP fixtures carry it; without the anchor, a
dollar-amount next to the literal word "auth" in prose would redact an
innocent trailing word. Recall on the leak shapes is unchanged.
minimum-length floor (16 plain-AUTH, 8 elsewhere) — a sub-8-char finding
trips Splice's over-redact backstop against unrelated lines carrying the
same short form (a stray
/swept every slash-bearing line duringdevelopment). Over-redacting a short password is safe; the cascade is not.
Span semantics follow the bearer-token rule's house style: the whole match is
redacted (AUTH verb, RESP framing, ACL username vanish with the password).
Test plan
internal/rules/redis_auth_rules_test.go: 21 table-driven cases through thereal detector (race-clean) — all positive leak shapes, secrets-scrubber's
own false-positive suite, and the port gates.
path, no
CTXCOP_RULES): 19 positives (incl. viactxcop runBash-wrapperpath), 14 negatives, idempotency ×2, span behavior ×3, self-scan ×5
byte-identical (run-order nondeterminism guard).
go test -race -count=1 ./...— clean.gofmt -w .clean;go vet ./...clean.ctxcop scan < internal/rules/embedded/ctxcop.tomlbyte-identical ×5 (thefile must never self-match).
Security checklist
the same PR: new residual-risk bullet ("Bare Redis AUTH residuals" —
shorter passwords,
$0-bulk empty ACL usernames, and non-AUTH RESPcommands pass; floors exist because of the Splice backstop cascade).
covered by the skip-list — test literals are split via the existing
join()helper; tokens built at runtime.rules to the existing composed ruleset; existing redact paths log as before.
Reviewer notes
internal/rules/embedded/ctxcop.toml(rules + provenance comments),internal/rules/redis_auth_rules_test.go(table cases),docs/detection.md(eight→twelve table),
THREATMODEL.md,CHANGELOG.md.empty (
$0-bulk) ACL username leak — needs a zero-length bulk alternativethat would also weaken the header anchor; deferred until a real-world
shape justifies it.
occurrences of the same secret value are swept whole-line but carry the
first-fired rule's ID (stale label) — worth its own issue.
hooks/register.tsx+ its testsuite; leak-shape taxonomy matches Santi's tests one-for-one.