Skip to content

fix(scan): take notice of a gosec G101 annotation already on the line - #108

Open
ralyodio wants to merge 1 commit into
masterfrom
worktree-nolint-aware
Open

fix(scan): take notice of a gosec G101 annotation already on the line#108
ralyodio wants to merge 1 commit into
masterfrom
worktree-nolint-aware

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Closes #106.

A repository that has already triaged a finding did so in the one place a reviewer will look, which is the line itself. Re-raising it at full severity asks the operator to make the same decision a second time in another tool. On thecodearcher/limen the excerpt printed with the finding literally read G101 false positive: HTTP header name, not a credential.

The two guards

The rule has to be named. A bare //nolint suppresses nothing here — it is a statement about something, and there is no reason to think it is about credentials. Only nolint:gosec or nosec naming G101 counts, which is a statement about hardcoded credentials specifically.

It downgrades rather than drops. The finding lands at low the way isTestPath already downgrades a fixture, so it stays in the report for anyone auditing the suppressions themselves, and it stops dominating the first page.

Checked against the file from the report

before:  high secret-generic-credential response.go:11
         high secret-generic-credential response.go:12
after:   low  secret-generic-credential response.go:11
         low  secret-generic-credential response.go:12

Run against limen's real response.go, not a copy of it. A live-looking key appended to that same file is still reported at its own severity — that is one of the four tests.

pnpm test in packages/scan: 161 passing. pnpm typecheck clean. Pre-commit hook (CLI + landing page build) passed.

A repository that has triaged a finding did so in the one place a reviewer
will look, which is the line itself. Re-raising it at full severity asks the
operator to decide the same thing a second time in another tool, and the
excerpt printed with it read "G101 false positive: HTTP header name, not a
credential", which is the clearest possible sign that nothing read it.

Two things keep this from becoming a way to hide real findings. The rule has
to be named, so a bare //nolint suppresses nothing: it is a statement about
something and there is no reason to think it is about credentials. And the
finding is downgraded rather than dropped, the way isTestPath already
downgrades a fixture, so it stays in the report for anyone auditing the
suppressions themselves.

Checked against the file in the report: thecodearcher/limen response.go went
from two high findings to two low ones, and a real key added to that same
file is still reported at its own severity.

Closes #106
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

67 finding(s)

HIGH/CRITICAL: 11 | MEDIUM: 55 | LOW: 1

Severity Rule Location
HIGH secret-aws-access-key prd/0003-detect-hardcoded-secrets-before-they-are-committed-or-served.md:126
HIGH sh-eval-expansion .githooks/pre-commit:26
HIGH sh-remote-script-execution apps/web/public/install.sh:272
HIGH sh-remote-script-execution apps/web/public/install.sh:320
HIGH secret-generic-credential modules/spend-guard/config/example.conf.toml:13
HIGH secret-generic-credential modules/spend-guard/README.md:84
HIGH secret-generic-credential PRD.md:268
HIGH tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:121
HIGH tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:122
HIGH sh-remote-script-execution scripts/smoke-test.sh:46
HIGH sh-remote-script-execution scripts/smoke-test.sh:47
MEDIUM insecure-temp-file .githooks/commit-msg:16
MEDIUM insecure-temp-file .githooks/post-commit:20
MEDIUM js-shell-exec-interpolation apps/cli/src/commands/init.ts:70
MEDIUM js-shell-exec-interpolation apps/cli/src/commands/init.ts:79
MEDIUM js-shell-exec-interpolation apps/cli/src/commands/service.ts:88
MEDIUM js-shell-exec-interpolation apps/cli/src/commands/service.ts:111
MEDIUM sql-template-interpolation apps/cli/src/core/state.ts:121
MEDIUM sql-template-interpolation apps/cli/src/core/state.ts:125
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:31
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:33
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:34
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:35
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:36
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:43
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:49
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:56
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:63
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:82
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:84
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:85
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:93
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:98
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:105
MEDIUM js-shell-exec-interpolation apps/cli/src/daemon/firewall/adapters.ts:112
MEDIUM js-shell-exec-interpolation apps/cli/src/index.ts:419
MEDIUM js-unescaped-html-sink apps/web/src/app/about/page.tsx:180
MEDIUM js-unescaped-html-sink apps/web/src/app/about/page.tsx:184
MEDIUM js-open-redirect apps/web/src/app/auth/login/page.tsx:50
MEDIUM js-unescaped-html-sink apps/web/src/app/blog/[slug]/page.tsx:125
MEDIUM js-unescaped-html-sink apps/web/src/app/blog/[slug]/page.tsx:153
MEDIUM js-unescaped-html-sink apps/web/src/app/blog/[slug]/page.tsx:157
MEDIUM js-unescaped-html-sink apps/web/src/app/get-whitepaper/page.tsx:346
MEDIUM js-unescaped-html-sink apps/web/src/app/layout.tsx:211
MEDIUM js-unescaped-html-sink apps/web/src/app/layout.tsx:215
MEDIUM js-unescaped-html-sink apps/web/src/app/layout.tsx:219
MEDIUM js-unescaped-html-sink apps/web/src/app/page.tsx:120
MEDIUM js-unescaped-html-sink apps/web/src/app/store/[slug]/page.tsx:107
MEDIUM js-open-redirect apps/web/src/components/funding/FundingClient.tsx:97
MEDIUM manifest-install-lifecycle-script package.json:24

…and 17 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Findings already suppressed with //nolint:gosec are re-raised at full severity

1 participant