Skip to content

ci: add automatic PR malware scan - #178

Merged
afeezorobsco-cyber merged 1 commit into
mainfrom
ci/pr-malware-scan
Oct 20, 2026
Merged

afeezorobsco-cyber merged 1 commit into
mainfrom
ci/pr-malware-scan

Conversation

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

What changed

Adds an automatic PR malware scan: .github/workflows/pr-malware-scan.yml and .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:

HIGH: fails the check WARN: noted for the reviewer
.vscode/tasks.json with runOn: folderOpen; devcontainer initializeCommand Other editor/devcontainer config changes
preinstall / install / postinstall scripts; prepare that does more than build prepare that just runs the package build
Typosquatted npm packages; dependencies from URLs/git; lockfile entries not from registry.npmjs.org Local file: workspace packages, git crates
GitHub Actions from publishers outside the allowlist (flags lookalikes like dtolstech → dtolnay); pull_request_target Any workflow change; workflow secret use
JavaScript hidden in font/image/unknown-extension files; node run on a non-JS file build.rs changes (HIGH if it spawns processes or uses the network)
Files committed as base64; code hidden in whitespace or pushed off-screen eval / new Function; credential/wallet file access
curl … | sh, reverse shells, Discord/Telegram/pastebin exfiltration, env dumps, decode-and-eval, char-code/hex obfuscation, miners Pipe-to-shell inside docs (READMEs show install one-liners)

On findings: it posts a single comment on the PR, edited in place on every push. With HIGH findings, the Malware scan check fails, the PR is labelled security-review, and the author is @mentioned. When the findings are fixed, the comment switches to ✅ and the label is removed.

Security

pull_request_target is 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 of main. Token permissions are limited to contents: read plus write on issues and PRs (for the comment and label), with persist-credentials: false. actions/github-script is pinned to the v9.0.0 commit SHA.

Testing

All tests ran locally with every write call stubbed out:

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, per AGENTS.md.

🤖 Generated with Claude Code

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>
@afeezorobsco-cyber
afeezorobsco-cyber merged commit 63291fa into main Oct 20, 2026
1 check passed
@afeezorobsco-cyber
afeezorobsco-cyber deleted the ci/pr-malware-scan branch October 20, 2026 09:16
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