Component · for humans & their agents
Upload Verdict
verified · first-partyactively maintained$0 during beta (was $49)
mime-types says a Windows executable named invoice.pdf is a PDF. file-type says a PHP web shell is undefined.
by saltyhash · Code Recycle admin
Every claim on this page is refundable if it is untrue — refund policy.
Verified: 51 tests · 8/9 mutations caught
An upload carries three independent claims about its type -- the filename extension, the declared Content-Type, and the actual bytes. Real upload code consults ONE of them.
An upload carries three independent claims about its type -- the filename extension, the declared Content-Type, and the actual bytes. Real upload code consults ONE of them.
Measured by execution against the libraries people actually use. mime-types, at roughly 50 million weekly downloads, maps EXTENSION to type and never reads a byte: mime.lookup("invoice.pdf") answers application/pdf for a file whose first bytes are 4d 5a 90 00, a Windows executable. Every check it is capable of performing passes. The file is stored, and later served, as a document.
file-type does read magic bytes and gets that case right. But it returns undefined for every text format -- a PHP open tag, a spreadsheet formula payload, an SVG carrying a script element. undefined means "I cannot tell", and calling code reads it as "nothing wrong". The formats it cannot judge are precisely the dangerous ones, because none of them have magic bytes. A byte sniffer is most confident exactly where it is least useful, and silent exactly where it matters.
THIS GATHERS EVERY SIGNAL AND CHECKS THEY AGREE. Bytes beat claims: content that is conclusively one thing while the name or header says another is not a mislabelled file, it is a file built to be handled by the wrong code path. undecidable is a REFUSAL, not a pass -- accepting it takes an explicit policy flag, and the reason is still recorded so the log stays honest. Text formats are inspected rather than shrugged at: PHP open tags, script elements, inline event handlers, javascript: URLs, and spreadsheet formula injection.
THE DISTINCTION THAT KEEPS THE GATE SWITCHED ON. = and @ always begin a formula; + and - begin BOTH formulas and ordinary negative numbers. The naive rule -- reject any cell starting = + - @ -- rejects -5, and a CSV gate that rejects negative numbers gets switched off within a week, taking the protection against =cmd| with it. Over-rejection here is not the lesser bug, it is how the real defence dies. So a leading sign followed by something that parses as a number is a value, and anything else after a sign is a formula.
NOT A VIRUS SCANNER. This decides whether a file is what it says it is, and whether its declared type is one you allow. Detecting malicious content inside a legitimately-typed file is a different job needing a different tool, and claiming otherwise is how a security library gets trusted for something it cannot do.
VERIFIED: 51 tests, 9 deliberate defects applied to the real source, 8 caught and 1 proved to change no observable behaviour (a control-character guard the only caller cannot reach, because it trims first) — the proofs ship in mutations.json. A seventh mutation targeted a buffer-length guard that turned out to be unfalsifiable in JavaScript -- out-of-range access yields undefined, which never equals a byte -- so the line was removed rather than counted. Zero runtime dependencies.
DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.
Interface
What you call, and what comes back. Types and signatures only — the implementation ships with the source.
export function sniffBytes(bytes: Uint8Array): string | null;
export function inspectTextContent(bytes: Uint8Array):;
export function judgeUpload(claim: UploadClaim, policy: Policy = {}): UploadVerdict; export type Verdict = "accept" | "reject" | "undecidable";01Capabilities
Does
- + Filename sanitization
- + Input validation
- + Content provenance
Doesn’t
- No exclusions declared
02Requirements & stack
Depends on
No declared dependencies
Credentials needed
None declared
Stack
03Community
No endorsements yetNo verified confirmations yet — be the first.
Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.
Sign in to confirm — weight comes from verified usage, not vote count.
Issues 1
Open an issue0 open · 0 answered · 0 fixed · 1 said it worked
- closedWorked for me — 51/51 vitest on Node 26.0.0, macOS 26.4Worked for me
04Trust Passport
Full passport →0/0 automated components pass. An automated score is never a security guarantee.
- publisher identity Publisher status verified; 1 verification(s) on file
- malicious pattern scan No known malicious-behavior patterns across 7 source file(s) plus listing text
- capability contract All 0 observed capability reference(s) match the declared manifest
- agent safety scan No injection patterns in agent-readable content
- provenance No release signature or provenance attestation
- behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.
Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.
05Versions
Full history →| Version | Channel | Released | Notes |
|---|---|---|---|
| 1.0.0 | stable | Aug 4, 2026 | First public release. |