feat(binary-scan): differentiate suspicious string labels with per-label severity - #3
Merged
Merged
Conversation
…bel severity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lachaib
force-pushed
the
feat/binary-scan-labeled-severity
branch
from
June 16, 2026 16:29
164ce1d to
e216d4e
Compare
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
The binary scanner previously treated all suspicious string matches as a single
binary:new-stringlabel, and any binary finding mapped to HIGH severity. This meant a crypto library upgrade adding 47 new algorithm constants (ML-KEM, ML-DSA OIDs, Camellia key schedules) produced the same HIGH alarm as a package injecting a new C2 URL — a significant source of noise.This PR splits the detection into distinct labels with calibrated severity levels:
binary:sensitive-path/etc/passwdetc. hardcoded in a compiled lib is almost always maliciousbinary:url-other-schemews://,dns://,udp://,tcp://,smtp://,irc://,socks5://etc. have no legitimate reason to be embedded in a library binarybinary:url-httpbinary:ip-v4binary:ip-v6binary:tmppath/tmp/pathsbinary:base64binary:high-entropynative:*binary-scan.ts: patterns are now ordered most-to-least specific (sensitive path first, base64 last); first match wins per string so the highest-signal label is assigned.severity.ts: replaces the bluntany binary delta → HIGHblock with a per-labelbinaryFindingSeverity()function, matching the approach used for source pattern hits.Motivation
A
cryptography46.0.7 → 48.0.1 upgrade was flagging HIGH due to 47 new strings in_rust.abi3.so, all of which were legitimate cryptographic constants and algorithm identifiers from ML-KEM and ML-DSA support. With this change those strings matchbinary:base64→ LOW, and the package correctly resolves below the HIGH threshold.Test plan
cryptography46→48 lockfile diff — overall binary severity should no longer be HIGH from string matches alonews://ordns://URL in its binary still triggers HIGH/etc/passwdreference still triggers HIGHpnpm tsc --noEmitpasses (pre-existing unrelated error inanalyzer.tsexcluded)🤖 Generated with Claude Code