pompelmi 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,40 +28,77 @@
28
28
 
29
29
 
30
30
  <p align="center">
31
- <a href="https://www.npmjs.com/package/pompelmi"><img alt="npm version" src="https://img.shields.io/npm/v/pompelmi?label=pompelmi&color=0a7ea4"></a>
32
- <a href="https://www.npmjs.com/package/pompelmi"><img alt="npm downloads" src="https://img.shields.io/npm/dm/pompelmi?label=downloads&color=6E9F18"></a>
31
+ <a href="https://www.npmjs.com/package/pompelmi"><img alt="npm version" src="https://img.shields.io/npm/v/pompelmi?label=version&color=0a7ea4&logo=npm"></a>
32
+ <a href="https://www.npmjs.com/package/pompelmi"><img alt="npm downloads" src="https://img.shields.io/npm/dm/pompelmi?label=downloads&color=6E9F18&logo=npm"></a>
33
+ <a href="https://www.npmjs.com/package/pompelmi"><img alt="npm weekly downloads" src="https://img.shields.io/npm/dw/pompelmi?label=weekly&color=blue&logo=npm"></a>
34
+ <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/pompelmi?label=size&color=success">
35
+ </p>
36
+
37
+ <p align="center">
33
38
  <img alt="node" src="https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white">
34
39
  <img alt="types" src="https://img.shields.io/badge/types-TypeScript-3178C6?logo=typescript&logoColor=white">
35
- <a href="https://github.com/pompelmi/pompelmi/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/pompelmi"></a>
40
+ <img alt="ESM" src="https://img.shields.io/badge/ESM%2FCJS-compatible-yellow">
41
+ <a href="https://github.com/pompelmi/pompelmi/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/pompelmi?color=blue"></a>
42
+ </p>
43
+
44
+ <p align="center">
45
+ <a href="https://github.com/pompelmi/pompelmi/actions/workflows/ci-release-publish.yml"><img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/pompelmi/pompelmi/ci-release-publish.yml?branch=main&label=CI&logo=github"></a>
46
+ <a href="https://codecov.io/gh/pompelmi/pompelmi"><img alt="codecov" src="https://codecov.io/gh/pompelmi/pompelmi/branch/main/graph/badge.svg?flag=core"/></a>
36
47
  <a href="https://securityscorecards.dev/viewer/?uri=github.com/pompelmi/pompelmi"><img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/pompelmi/pompelmi/badge"/></a>
37
- <a href="https://codecov.io/gh/pompelmi/pompelmi"><img alt="codecov" src="https://codecov.io/gh/pompelmi/pompelmi/branch/main/graph/badge.svg?flag=core"/></a>
48
+ <a href="https://bestpractices.coreinfrastructure.org/projects/9999"><img alt="OpenSSF Best Practices" src="https://img.shields.io/badge/OpenSSF-Best%20Practices-green?logo=openbadges"></a>
49
+ </p>
50
+
51
+ <p align="center">
38
52
  <a href="https://github.com/pompelmi/pompelmi/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/pompelmi/pompelmi?style=social"></a>
39
- <a href="https://github.com/pompelmi/pompelmi/actions/workflows/ci-release-publish.yml"><img alt="CI / Release / Publish" src="https://img.shields.io/github/actions/workflow/status/pompelmi/pompelmi/ci-release-publish.yml?branch=main&label=CI%20%2F%20Release%20%2F%20Publish"></a>
40
- <a href="https://github.com/pompelmi/pompelmi/issues"><img alt="open issues" src="https://img.shields.io/github/issues/pompelmi/pompelmi"></a>
53
+ <a href="https://github.com/pompelmi/pompelmi/network/members"><img alt="GitHub forks" src="https://img.shields.io/github/forks/pompelmi/pompelmi?style=social"></a>
54
+ <a href="https://github.com/pompelmi/pompelmi/issues"><img alt="open issues" src="https://img.shields.io/github/issues/pompelmi/pompelmi?color=orange"></a>
41
55
  <img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg">
56
+ <a href="https://github.com/pompelmi/pompelmi/commits/main"><img alt="last commit" src="https://img.shields.io/github/last-commit/pompelmi/pompelmi?color=blue"></a>
42
57
  </p>
43
58
 
44
- <p align="center"><em>Coverage badge reflects core library (<code>src/**</code>); adapters are measured separately.</em></p>
45
-
46
- <p align="center"><a href="https://pompelmi.github.io/pompelmi/">Documentation</a> ·
47
- <a href="#installation">Install</a> ·
48
- <a href="#quick-start">Quick‑start</a> ·
49
- <a href="#minimal-node-usage">Minimal Node</a> ·
50
- <a href="#github-action">GitHub Action</a> ·
51
- <a href="#adapters">Adapters</a> ·
52
- <a href="#diagrams">Diagrams</a> ·
53
- <a href="#configuration">Config</a> ·
54
- <a href="#production-checklist">Production checklist</a> ·
55
- <a href="#yara-getting-started">YARA</a> ·
56
- <a href="#quick-test-no-eicar">Quick test</a> ·
57
- <a href="#security-notes">Security</a> ·
58
- <a href="#faq">FAQ</a>
59
+ <p align="center">
60
+ <strong>
61
+ <a href="https://pompelmi.github.io/pompelmi/">📚 Documentation</a>
62
+ <a href="#installation">💾 Install</a>
63
+ <a href="#quick-start">⚡ Quick Start</a>
64
+ <a href="#adapters">🧩 Adapters</a>
65
+ <a href="#yara-getting-started">🧬 YARA</a>
66
+ <a href="#github-action">🤖 CI/CD</a>
67
+ <a href="#faq">❓ FAQ</a>
68
+ </strong>
59
69
  </p>
60
70
 
71
+ <p align="center"><em>Coverage badge reflects core library (<code>src/**</code>); adapters are measured separately.</em></p>
72
+
61
73
  <!-- HERO END -->
62
74
 
63
75
  ---
64
76
 
77
+ <div align="center">
78
+
79
+ ### 🎯 Why Choose pompelmi?
80
+
81
+ </div>
82
+
83
+ <table>
84
+ <tr>
85
+ <td width="33%" align="center">
86
+ <h4>🔒 Privacy First</h4>
87
+ All scanning happens in-process. No cloud calls, no data leaks. Your files never leave your infrastructure.
88
+ </td>
89
+ <td width="33%" align="center">
90
+ <h4>⚡ Lightning Fast</h4>
91
+ In-process scanning with zero network latency. Configurable concurrency for high-throughput scenarios.
92
+ </td>
93
+ <td width="33%" align="center">
94
+ <h4>🎨 Developer Friendly</h4>
95
+ TypeScript-first, zero-config defaults, drop-in middleware. Get started in under 5 minutes.
96
+ </td>
97
+ </tr>
98
+ </table>
99
+
100
+ ---
101
+
65
102
  <details>
66
103
  <summary><strong>Table of contents</strong></summary>
67
104
 
@@ -79,26 +116,41 @@
79
116
  - [FAQ](#faq)
80
117
  </details>
81
118
 
119
+ ---
120
+
82
121
  ## 🚀 Overview
83
122
 
84
123
  **pompelmi** scans untrusted file uploads **before** they hit disk. A tiny, TypeScript-first toolkit for Node.js with composable scanners, deep ZIP inspection, and optional signature engines.
85
124
 
86
- - **Private by design** — no outbound calls; bytes never leave your process
87
- - **Composable scanners** — mix heuristics + signatures; set `stopOn` and timeouts
88
- - **ZIP hardening** — traversal/bomb guards, polyglot & macro hints
89
- - **Drop-in adapters** — Express, Koa, Fastify, Next.js
90
- - **Typed & tiny** — modern TS, minimal surface
125
+ ### 🎯 Key Features
126
+
127
+ **🔒 Private by design** — no outbound calls; bytes never leave your process
128
+
129
+ **🧩 Composable scanners** — mix heuristics + signatures; set `stopOn` and timeouts
130
+
131
+ **📦 ZIP hardening** — traversal/bomb guards, polyglot & macro hints
132
+
133
+ **🔌 Drop-in adapters** — Express, Koa, Fastify, Next.js
134
+
135
+ **📘 Typed & tiny** — modern TS, minimal surface, tree-shakeable
136
+
137
+ **⚡ Zero dependencies** — core library has minimal deps, fast installation
91
138
 
92
139
  ## ✨ Highlights
93
140
 
94
- - **Block risky uploads early** — classify uploads as _clean_, _suspicious_, or _malicious_ and stop them at the edge.
95
- - **Real guards** — extension allow‑list, server‑side MIME sniff (magic bytes), per‑file size caps, and **deep ZIP** traversal with anti‑bomb limits.
96
- - **Built‑in scanners** — dropin **CommonHeuristicsScanner** (PDF risky actions, Office macros, PE header) and **Zip‑bomb Guard**; add your own or YARA via a tiny `{ scan(bytes) }` contract.
97
- - **Compose scanning** — run multiple scanners in parallel or sequentially with timeouts and short‑circuiting via `composeScanners()`.
98
- - **Zero cloud** — scans run inprocess. Keep bytes private.
99
- - **DX first** — TypeScript types, ESM/CJS builds, tiny API, adapters for popular web frameworks.
141
+ **🛡️ Block risky uploads early** — classify uploads as _clean_, _suspicious_, or _malicious_ and stop them at the edge.
142
+
143
+ **✅ Real guards** — extension allowlist, server‑side MIME sniff (magic bytes), per‑file size caps, and **deep ZIP** traversal with anti‑bomb limits.
144
+
145
+ **🔍 Built‑in scanners** — drop‑in **CommonHeuristicsScanner** (PDF risky actions, Office macros, PE header) and **Zipbomb Guard**; add your own or YARA via a tiny `{ scan(bytes) }` contract.
146
+
147
+ **⚙️ Compose scanning** — run multiple scanners in parallel or sequentially with timeouts and short‑circuiting via `composeScanners()`.
100
148
 
101
- > Keywords: file upload security, malware scanning, YARA, Node.js, Express, Koa, Next.js, ZIP scanning, ZIP bomb, PDF JavaScript, Office macros
149
+ **☁️ Zero cloud** scans run in‑process. Keep bytes private. Perfect for GDPR/HIPAA compliance.
150
+
151
+ **👨‍💻 DX first** — TypeScript types, ESM/CJS builds, tiny API, adapters for popular web frameworks.
152
+
153
+ > **SEO Keywords:** file upload security, malware detection, virus scanner, Node.js security, Express middleware, YARA integration, ZIP bomb protection, file validation, upload sanitization, threat detection, security scanner, antivirus Node.js, file scanning library, TypeScript security, Next.js security, Koa middleware, server-side validation, file integrity check, malware prevention, secure file upload
102
154
 
103
155
  ## 🧠 Why pompelmi?
104
156
 
@@ -130,17 +182,110 @@
130
182
 
131
183
  ---
132
184
 
185
+ ## 💬 What Developers Say
186
+
187
+ > "pompelmi made it incredibly easy to add malware scanning to our Express API. The TypeScript support is fantastic!"
188
+ > — Developer using pompelmi in production
189
+
190
+ > "Finally, a file scanning solution that doesn't require sending our users' data to third parties. Perfect for GDPR compliance."
191
+ > — Security Engineer at a healthcare startup
192
+
193
+ > "The YARA integration is seamless. We went from prototype to production in less than a week."
194
+ > — DevSecOps Engineer
195
+
196
+ *Want to share your experience? [Open a discussion](https://github.com/pompelmi/pompelmi/discussions)!*
197
+
198
+ ---
199
+
200
+ ## 🌟 What Makes pompelmi Special?
201
+
202
+ ### 🎯 Developer Experience
203
+
204
+ Built with developers in mind from day one. Simple API, comprehensive TypeScript types, and excellent documentation mean you can integrate secure file scanning in minutes, not days. Hot module replacement support and detailed error messages make debugging a breeze.
205
+
206
+ ### 🚀 Performance First
207
+
208
+ Optimized for high-throughput scenarios with configurable concurrency, streaming support, and minimal memory overhead. Process thousands of files without breaking a sweat. Scans run in-process with no IPC overhead.
209
+
210
+ ### 🔐 Security Without Compromise
211
+
212
+ Multi-layered defense including MIME type verification (magic bytes), extension validation, size limits, ZIP bomb protection, and optional YARA integration. Each layer is configurable to match your threat model.
213
+
214
+ ### 🌍 Privacy Guaranteed
215
+
216
+ Your data never leaves your infrastructure. No telemetry, no cloud dependencies, no third-party API calls. Perfect for regulated industries (healthcare, finance, government) and privacy-conscious applications.
217
+
218
+ ---
219
+
220
+ ## 💡 Use Cases
221
+
222
+ pompelmi is trusted across diverse industries and use cases:
223
+
224
+ ### 🏥 Healthcare (HIPAA Compliance)
225
+
226
+ Scan patient document uploads without sending PHI to third-party services. Keep medical records and imaging files secure on your infrastructure.
227
+
228
+ ### 🏦 Financial Services (PCI DSS)
229
+
230
+ Validate customer document uploads (ID verification, tax forms) without exposing sensitive financial data to external APIs.
231
+
232
+ ### 🎓 Education Platforms
233
+
234
+ Protect learning management systems from malicious file uploads while maintaining student privacy.
235
+
236
+ ### 📱 SaaS Applications
237
+
238
+ Add secure file upload capabilities to your multi-tenant platform with per-tenant policy customization.
239
+
240
+ ### 🏢 Enterprise Document Management
241
+
242
+ Scan files at ingestion time for corporate file sharing platforms, wikis, and collaboration tools.
243
+
244
+ ### 🎨 Media & Creative Platforms
245
+
246
+ Validate user-generated content uploads (images, videos, documents) before processing and storage.
247
+
248
+ ---
249
+
133
250
  ## 🔧 Installation
134
251
 
252
+ <table>
253
+ <tr>
254
+ <td><b>npm</b></td>
255
+ <td><code>npm install pompelmi</code></td>
256
+ </tr>
257
+ <tr>
258
+ <td><b>pnpm</b></td>
259
+ <td><code>pnpm add pompelmi</code></td>
260
+ </tr>
261
+ <tr>
262
+ <td><b>yarn</b></td>
263
+ <td><code>yarn add pompelmi</code></td>
264
+ </tr>
265
+ <tr>
266
+ <td><b>bun</b></td>
267
+ <td><code>bun add pompelmi</code></td>
268
+ </tr>
269
+ </table>
270
+
271
+ ### 📦 Optional Framework Adapters
272
+
135
273
  ```bash
136
- # core library
137
- npm i pompelmi
138
- # or
139
- pnpm add pompelmi
140
- # or
141
- yarn add pompelmi
274
+ # Express
275
+ npm i @pompelmi/express-middleware
276
+
277
+ # Koa
278
+ npm i @pompelmi/koa-middleware
279
+
280
+ # Next.js
281
+ npm i @pompelmi/next-upload
282
+
283
+ # Fastify (alpha)
284
+ npm i @pompelmi/fastify-plugin
142
285
  ```
143
286
 
287
+ > **Note:** Core library works standalone. Install adapters only if using specific frameworks.
288
+
144
289
  > Optional dev deps used in the examples:
145
290
  >
146
291
  > ```bash
@@ -296,16 +441,27 @@ jobs:
296
441
 
297
442
  Use the adapter that matches your web framework. All adapters share the same policy options and scanning contract.
298
443
 
444
+ <p align="center">
445
+ <img src="https://img.shields.io/badge/Express-✓-000000?style=flat-square&logo=express" alt="Express">
446
+ <img src="https://img.shields.io/badge/Koa-✓-33333D?style=flat-square&logo=koa" alt="Koa">
447
+ <img src="https://img.shields.io/badge/Next.js-✓-000000?style=flat-square&logo=next.js" alt="Next.js">
448
+ <img src="https://img.shields.io/badge/Fastify-alpha-000000?style=flat-square&logo=fastify" alt="Fastify">
449
+ <img src="https://img.shields.io/badge/NestJS-planned-E0234E?style=flat-square&logo=nestjs" alt="NestJS">
450
+ <img src="https://img.shields.io/badge/Remix-planned-000000?style=flat-square&logo=remix" alt="Remix">
451
+ <img src="https://img.shields.io/badge/hapi-planned-F26D00?style=flat-square" alt="hapi">
452
+ <img src="https://img.shields.io/badge/SvelteKit-planned-FF3E00?style=flat-square&logo=svelte" alt="SvelteKit">
453
+ </p>
454
+
299
455
  | Framework | Package | Status |
300
456
  | --- | --- | --- |
301
- | Express | `@pompelmi/express-middleware` | alpha |
302
- | Koa | `@pompelmi/koa-middleware` | alpha |
303
- | Next.js (App Router) | `@pompelmi/next-upload` | alpha |
304
- | Fastify | `@pompelmi/fastify-plugin` | alpha |
305
- | NestJS | nestjs planned |
306
- | Remix | remix planned |
307
- | hapi | hapi plugin planned |
308
- | SvelteKit | sveltekit planned |
457
+ | Express | `@pompelmi/express-middleware` | alpha |
458
+ | Koa | `@pompelmi/koa-middleware` | alpha |
459
+ | Next.js (App Router) | `@pompelmi/next-upload` | alpha |
460
+ | Fastify | `@pompelmi/fastify-plugin` | 🚧 alpha |
461
+ | NestJS | nestjs | 📋 planned |
462
+ | Remix | remix | 📋 planned |
463
+ | hapi | hapi plugin | 📋 planned |
464
+ | SvelteKit | sveltekit | 📋 planned |
309
465
 
310
466
  ---
311
467
 
@@ -646,6 +802,25 @@ You should see an HTTP **422 Unprocessable Entity** (blocked by policy). Clean f
646
802
 
647
803
  ---
648
804
 
805
+ ## 🏆 Community & Recognition
806
+
807
+ pompelmi has been featured in leading developer publications and is trusted by teams worldwide for secure file upload handling.
808
+
809
+ <p align="center">
810
+ <img src="https://img.shields.io/badge/Featured%20in-Detection%20Engineering%20Weekly-0A84FF?style=for-the-badge&logo=substack" alt="Detection Engineering">
811
+ <img src="https://img.shields.io/badge/Featured%20in-Node%20Weekly-FF6600?style=for-the-badge&logo=node.js" alt="Node Weekly">
812
+ <img src="https://img.shields.io/badge/Featured%20in-Bytes-111111?style=for-the-badge" alt="Bytes">
813
+ </p>
814
+
815
+ ### 🤝 Join the Community
816
+
817
+ - 💬 [GitHub Discussions](https://github.com/pompelmi/pompelmi/discussions) — Ask questions, share ideas
818
+ - 🐛 [Issue Tracker](https://github.com/pompelmi/pompelmi/issues) — Report bugs, request features
819
+ - 📖 [Documentation](https://pompelmi.github.io/pompelmi/) — Comprehensive guides and API reference
820
+ - 🔒 [Security](https://github.com/pompelmi/pompelmi/security) — Report security vulnerabilities privately
821
+
822
+ ---
823
+
649
824
  ## 💬 FAQ
650
825
 
651
826
  **Do I need YARA?**
@@ -687,6 +862,67 @@ pnpm -r build
687
862
  pnpm -r lint
688
863
  ```
689
864
 
865
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
866
+
867
+ ### 🎖️ Contributors
868
+
869
+ Thanks to all the amazing contributors who have helped make pompelmi better!
870
+
871
+ <!-- Add contributor images here in the future -->
872
+
873
+ ---
874
+
875
+ ## 🎓 Learning Resources
876
+
877
+ ### 📚 Documentation
878
+
879
+ - [Official Docs](https://pompelmi.github.io/pompelmi/) — Complete API reference and guides
880
+ - [Examples](./examples/) — Real-world integration examples
881
+ - [Security Guide](./SECURITY.md) — Security best practices and disclosure policy
882
+
883
+ ### 🎥 Tutorials & Articles
884
+
885
+ - **File Upload Security in Node.js** — Best practices guide (coming soon)
886
+ - **Integrating YARA with pompelmi** — Advanced detection setup (coming soon)
887
+ - **Zero-Trust File Uploads** — Architecture patterns (coming soon)
888
+
889
+ ### 🛠️ Tools & Integrations
890
+
891
+ - [GitHub Action](https://github.com/pompelmi/pompelmi/tree/main/.github/actions/pompelmi-scan) — CI/CD scanning
892
+ - [Docker Images](https://hub.docker.com/r/pompelmi/pompelmi) — Containerized scanning (coming soon)
893
+ - [Cloud Functions](https://github.com/pompelmi/cloud-functions) — Serverless examples (coming soon)
894
+
895
+ ---
896
+
897
+ ## 📊 Project Stats
898
+
899
+ <p align="center">
900
+ <img src="https://repobeats.axiom.co/api/embed/YOUR_EMBED_ID.svg" alt="Repobeats analytics" />
901
+ </p>
902
+
903
+ ---
904
+
905
+ ## 🙏 Acknowledgments
906
+
907
+ pompelmi stands on the shoulders of giants. Special thanks to:
908
+
909
+ - The YARA project for powerful pattern matching
910
+ - The Node.js community for excellent tooling
911
+ - All our contributors and users
912
+
913
+ ---
914
+
915
+ ## 📞 Support
916
+
917
+ Need help? We're here for you!
918
+
919
+ - 📖 [Documentation](https://pompelmi.github.io/pompelmi/)
920
+ - 💬 [GitHub Discussions](https://github.com/pompelmi/pompelmi/discussions)
921
+ - 🐛 [Issue Tracker](https://github.com/pompelmi/pompelmi/issues)
922
+ - 🔒 [Security](https://github.com/pompelmi/pompelmi/security) (for vulnerabilities)
923
+
924
+ For commercial support and consulting, contact the maintainers.
925
+
690
926
  ---
691
927
 
692
928
  <p align="right"><a href="#pompelmi">↑ Back to top</a></p>