Improve v3 rules#764
Merged
Merged
Conversation
7e21527 to
1261014
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6865b1e687
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
sobregosodd
previously approved these changes
Jun 15, 2026
sobregosodd
approved these changes
Jun 15, 2026
572279e to
2690f47
Compare
Tighten 18 threat-* YARA rules that fired on top npm/PyPI packages without any real threat: require command/call context instead of bare strings, add word boundaries, exclude metadata/charset/test data, and pair weak signals (e.g. OpenProcess only with ReadProcessMemory). Detection intent is preserved. Rename threat_process_spawn_sysinfo -> threat_process_sysinfo and threat_network_outbound -> threat_network_exfiltration so the rule names match their file ids (the no-false-positive test keys on this). Add tests/rule_fp_review: a malicious+benign fixture pair per rule and a validator to confirm fixes keep true positives while dropping the FPs.
False-positive reductions (repeat patterns from the benign benchmark): - runtime-environment-read: drop os.environ.copy() / dict(os.environ) / os.Environ() (benign subprocess plumbing, not exfiltration) - filesystem-autostart: match .profile only as a path/string, not as a `.profile` attribute access - process-download-exec: anchor requests.get and treat exec(/eval( as bare builtins, so JS map access and regex.exec()/.eval() no longer leak in - obfuscation-base64exec / obfuscation-steganography: exec(/eval( as bare builtins; steganography no longer triggers on plain PIL.Image use - runtime-dynamic-loader: require an execution sink alongside import+download (the bare co-occurrence fired on many large legit packages) - keylogging: require an actual capture call, not a bare `import keyboard` False-negative recovery: - Scan *.pth files with the Python rules (.pth startup-code injection, e.g. the compromised litellm release) - New rule obfuscation-hidden-code: require aliased through a global, or a payload pushed off-screen by a long whitespace run (react-native-aria / Shai-Hulud injected payloads) Reliability: - obfuscation: rewrite the base64 string so the base64-only marker sits in a bounded prefix instead of between two open-ended runs, which exploded into millions of candidate matches on large base64 blobs (ERROR_TOO_MANY_MATCHES) Adds benign and positive regression fixtures for the changed/added rules.
2690f47 to
e22a091
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.
Note: based on
v3; the parentv3-better-console-outputcommits will drop off once that branch merges.Iteration 4 includes a new rule that I've confirmed does catch some real-world malware, although not in this eval sampling.