feat(enrichment): secrets-in-logs & PII-egress scanner - #1614
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary
Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. Adds a secrets-in-logs / PII-egress analyzer that correctly distinguishes sensitive-value data flow into sinks from string literals that merely mention sensitive words. The `codeOnly` linear pass is well-implemented — the escape-aware single/double-quoted branch and the depth-tracking `${…}` interpolation keeper are both correct. Hunk-header line-citation matches the established pattern; the `ANALYZERS` registry wiring, `BriefFindings` key, and `renderBrief` block are all consistent with prior analyzers. No blocking defects found. Nits (5)
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Adds a REES analyzer that flags added lines passing sensitive data into a
logging or stdout sink — console.log(req.headers.authorization),
logger.info(`token=${apiKey}`), console.log(req) — distinct from the
hardcoded-secret scan (which inspects literal values; this inspects the data
flow into a sink). Pure compute, no network.
Precision-first: string-literal messages are blanked by a linear hand-scan
before matching, so console.log("password reset") is not flagged; only a
sensitive name used as code (property access, a ${…} interpolation, or a dumped
request/session object) fires. Innocuous request scalars (req.method/url/path)
are excluded. All matchers are flat, linear-time regexes.
Closes JSONbored#1507.
68cf7b4 to
b73f860
Compare
Closes #1507.
Adds a REES analyzer that flags added lines passing sensitive data into a logging or stdout sink —
console.log(req.headers.authorization),logger.info(\token=${apiKey}`),console.log(req)`. This is distinct from the shipped hardcoded-secret scan: that inspects literal values; this inspects the data flow into a sink (a secret reaching a log is a leak even when the value isn't a literal). It's exactly the kind of pass the no-checkout in-prompt reviewer can't reliably do.Approach
Pure compute, no network, no new dependency (a structural detector, not a bundled Semgrep). Precision-first so it doesn't generate noise:
codeOnly()hand-scan blanks string-literal messages (keeping${…}interpolation bodies, which are real code) before matching — soconsole.log("password reset")is not flagged..authorization), a${…}interpolation (${apiKey}), or a dumped request/session object (req,req.headers/body/cookies/session). Innocuous request scalars (req.method/url/path) are excluded.Files (all inside
review-enrichment/, per the established analyzer pattern)src/types.ts—SecretLogFindingtype +secretLogBriefFindingskeysrc/analyzers/secret-log.ts— the analyzer (codeOnly+detectSecretLog+scanSecretLog)src/brief.ts— registered inANALYZERSsrc/render.ts— public-safe brief blocktest/enrichment.test.ts—codeOnly, classifier (incl. false-positive guards), line-cited scan, render, and abuildBriefintegration testValidation
npm test(build +node --test) insidereview-enrichment/: 50/50 pass (6 new).git diff --checkclean; prettier-clean; enginesrc/**untouched (outside the engine tsc/vitest/codecov scope — zero conflict).