Skip to content

fix(scan): no malware flag for one env variable or a minified-line sink - #298

Merged
ralyodio merged 1 commit into
masterfrom
fix-env-exfil-bracket
Oct 13, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix-env-exfil-bracket

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Two false malware indicators that flagged MoonshotAI/kimi-code on w3bs.org/packages (w3bs.org now scans every catalog package with ThreatCrush, profullstack/w3bs.org#13).

  • js-environment-exfiltration: the pattern excluded process.env.X but not process.env['X'] / process.env?.X. JSON.stringify(process.env['KIMI_CODE_CHANNEL'] ?? '') in a tsdown define read as serialising the whole environment.
  • js-encoded-payload-execution (and every requires rule): context is a line window, so on a minified bundle it is the whole program, and an atob() joined an unrelated constructor far away. Lines over 1000 chars now use the 200 chars around the match.

Paired tests in false-positives.test.ts: each quiet case has a still-fires neighbour (JSON.stringify(process.env), {...process.env}, eval(atob(x)) inside a minified line). 364/364 scan tests pass.

Real input: kimi-code HEAD went from 3 malware indicators to 0, with all other counts unchanged (high 4, medium 71, low 80).

🤖 Generated with Claude Code

js-environment-exfiltration excluded process.env.X but not process.env['X'] or
process.env?.X, so JSON.stringify(process.env['KIMI_CODE_CHANNEL'] ?? '') in a
build config read as serialising the whole environment.

js-encoded-payload-execution checked its CODE_SINK requirement against a
line-based window; on a minified bundle that window is the whole program, and
an atob() joined an unrelated constructor 30 KB away. Lines over 1000 chars now
use the 200 chars around the match as context. eval(atob(x)) on a minified
line still fires.

Both flagged MoonshotAI/kimi-code as malware on w3bs.org/packages. Verified on
its real source: 3 indicators -> 0, all other counts unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

18 finding(s)

HIGH/CRITICAL: 1 | MEDIUM: 9 | LOW: 8

Severity Rule Location
HIGH secret-aws-access-key prd/0003-detect-hardcoded-secrets-before-they-are-committed-or-served.md:126
MEDIUM sql-string-concatenation .github/workflows/migrate-dev2.yml:128
MEDIUM js-uninitialized-buffer apps/cli/src/core/log-tail.ts:58
MEDIUM js-open-redirect apps/web/src/app/auth/login/page.tsx:67
MEDIUM js-unescaped-html-sink apps/web/src/app/hire/page.tsx:104
MEDIUM js-unescaped-html-sink apps/web/src/app/hire/page.tsx:108
MEDIUM js-open-redirect apps/web/src/app/invite/[token]/invite-client.tsx:55
MEDIUM js-open-redirect apps/web/src/components/funding/FundingClient.tsx:97
MEDIUM js-unescaped-html-sink apps/web/src/components/GuideReader.tsx:265
MEDIUM js-uninitialized-buffer packages/scan/src/node-rules.ts:456
LOW secret-generic-credential apps/web/src/app/api/auth/refresh/route.ts:17
LOW secret-generic-credential apps/web/src/app/api/auth/reset-password/route.ts:26
LOW secret-generic-credential apps/web/src/app/api/auth/reset-password/route.ts:27
LOW secret-generic-credential PRD.md:269
LOW tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:121
LOW tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:122
LOW sh-remote-script-execution scripts/smoke-test.sh:72
LOW secret-aws-access-key scripts/smoke-test.sh:150

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 306b319 into master Oct 13, 2026
12 checks passed
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.

1 participant