
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@pompelmi/express-middleware
Advanced tools
Guard your Express upload routes with pompelmi — a local-first, no-cloud file pre‑quarantine that checks uploads before they touch your app logic or storage.
Privacy-first: no outbound calls. Scans run in-process.
npm i pompelmi express multer
# or: pnpm add pompelmi express multer
# or: yarn add pompelmi express multer
import express from "express";
import multer from "multer";
import { createUploadGuard } from "@pompelmi/express-middleware";
import {
CommonHeuristicsScanner,
createZipBombGuard,
composeScanners,
} from "pompelmi";
// Policy (tweak to your needs)
const policy = {
includeExtensions: ["zip", "png", "jpg", "jpeg", "pdf", "txt"],
allowedMimeTypes: [
"application/zip",
"image/png",
"image/jpeg",
"application/pdf",
"text/plain",
],
maxFileSizeBytes: 20 * 1024 * 1024, // 20MB
failClosed: true, // block on scanner/parse errors
};
// Compose scanners (stop as soon as something becomes suspicious)
const scanner = composeScanners(
[
[
"zipGuard",
createZipBombGuard({
maxEntries: 512,
maxTotalUncompressedBytes: 100 * 1024 * 1024,
maxCompressionRatio: 12,
}),
],
["heuristics", CommonHeuristicsScanner],
],
{ stopOn: "suspicious" }
);
const app = express();
const upload = multer({
storage: multer.memoryStorage(),
limits: { fileSize: policy.maxFileSizeBytes },
});
// Protect your upload route(s)
app.post(
"/upload",
upload.any(),
createUploadGuard({ ...policy, scanner }),
(req, res) => {
// The guard attaches the scan result to the request
const scan = (req as any).pompelmi ?? null;
res.json({ ok: true, scan });
}
);
app.listen(3000, () => console.log("Listening on http://localhost:3000"));
Run the server and in another terminal:
# Clean file
curl -F file=@README.md http://localhost:3000/upload | jq
# EICAR test (if you have it) – this should be flagged as suspicious/malicious
# Replace with your own path; the repo often ships a sample under tests/samples/
# curl -F file=@tests/samples/eicar.zip http://localhost:3000/upload | jq
You’ll receive JSON containing a per‑file decision plus any notes from scanners.
createUploadGuard(options)Returns an Express middleware (req, res, next) that:
multer (buffer/stream)req.pompelmiOptions (forwarded to core + a few middleware specifics):
allowedMimeTypes: string[]includeExtensions: string[]maxFileSizeBytes: numberfailClosed: boolean — if true, unexpected errors result in a blockscanner: Scanner — from composeScanners([...])mapErrorToStatus?: (reason) => number — customize HTTP codesCore option details live in the main docs: https://pompelmi.github.io/pompelmi/#configuration
By default the middleware maps common cases to HTTP errors:
Override via mapErrorToStatus to fit your API contract.
app.post("/upload", upload.single("file"), createUploadGuard({ ...policy, scanner }), (req, res) => {
const scan = (req as any).pompelmi; // { files: [...], summary: {...} }
// Log, metrics, auditing, etc.
res.json({ ok: true, scan });
});
Multiple fields
app.post("/avatar", upload.single("avatar"), createUploadGuard({ ...policy, scanner }), handler)
app.post("/docs", upload.array("docs", 8), createUploadGuard({ ...policy, scanner }), handler)
Deny‑list a hot type (e.g., block scripts entirely):
const policy = {
...base,
allowedMimeTypes: base.allowedMimeTypes.filter((m) => !m.startsWith("text/javascript")),
};
PayloadTooLargeError from multer – increase limits.fileSize and maxFileSizeBytes consistently.failClosed: false temporarily and inspect req.pompelmi in logs.maxEntries / maxCompressionRatio in createZipBombGuard.This package ships TypeScript types. The middleware augments Request at runtime via req.pompelmi (typed as any in the example; feel free to define your own interface extension in your codebase).
pompelmi@pompelmi/koa-middleware@pompelmi/next-uploadMIT
FAQs
Express middleware to scan uploads with pompelmi (YARA).
We found that @pompelmi/express-middleware demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.