Repository navigation
ci: add automatic PR malware scan - #178
Merged
Merged
Conversation
Scans every PR as data (never checks out or executes it) for editor and devcontainer autorun tasks, npm install hooks, typosquatted packages and Actions, non-registry dependency sources, payloads disguised as fonts or images, base64/whitespace obfuscation, exfiltration endpoints, reverse shells and miners. HIGH findings fail the check, add the security-review label and @mention the author in a single comment updated on each push. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
Adds an automatic PR malware scan:
.github/workflows/pr-malware-scan.ymland.github/scripts/pr-malware-scan.js. It runs on every PR open and every push.It checks for the techniques used against these repos (escrow #163's VS Code autorun payload, escrow #176's typosquatted action, the base64-replaced files) plus the common malware patterns:
.vscode/tasks.jsonwithrunOn: folderOpen; devcontainerinitializeCommandpreinstall/install/postinstallscripts;preparethat does more than buildpreparethat just runs the package buildfile:workspace packages, git cratesdtolstech→dtolnay);pull_request_targetnoderun on a non-JS filebuild.rschanges (HIGH if it spawns processes or uses the network)eval/new Function; credential/wallet file accesscurl … | sh, reverse shells, Discord/Telegram/pastebin exfiltration, env dumps, decode-and-eval, char-code/hex obfuscation, minersOn findings: it posts a single comment on the PR, edited in place on every push. With HIGH findings, the
Malware scancheck fails, the PR is labelledsecurity-review, and the author is @mentioned. When the findings are fixed, the comment switches to ✅ and the label is removed.Security
pull_request_targetis used deliberately. It's the only trigger that runs on fork PRs without a maintainer approving the run first, so the scan has finished before anyone decides whether to approve CI. It's safe here because the job never checks out, installs or executes PR code. The PR is read as data through the API, and the scanner is a sparse checkout ofmain. Token permissions are limited tocontents: readplus write on issues and PRs (for the comment and label), withpersist-credentials: false.actions/github-scriptis pinned to the v9.0.0 commit SHA.Testing
All tests ran locally with every write call stubbed out:
noderunning a non-JS file, and JS disguised as a font. escrow feat(consultations): close an appointment's consultation exactly once… #176 is flagged as a typosquat ofdtolnay. The six base64-corrupted PRs (feat(auth): email verification on signup, with restricted access for unverified accounts #137, feat(auth): login brute-force protection with per-account and per-IP throttling #138, feat(payments): add platform signer abstraction #175, fix(docs-site): rewrite relative links in local synced files (fixes docs deploy on main) #182, feat(orders): add patient orders read endpoint #201, Feat/5 referral model creation #202) are all flagged.curl | bash, reverse shell,pull_request_target, and a typosquatted Action all hit HIGH. A READMEcurl | shstays WARN.Recommended follow-up
Once this is on
main, make Malware scan a required status check in branch protection, so a flagged PR can't be merged by mistake.Which ROADMAP.md item does this close/progress?
Adds a completed CI item to
ROADMAP.md, perAGENTS.md.🤖 Generated with Claude Code