pompelmi 0.15.1 → 0.16.2

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
@@ -1,14 +1,17 @@
1
+ <!-- HERO START -->
1
2
 
2
3
  <p align="center">
3
4
 
4
5
  <br/>
5
- <a href="https://www.producthunt.com/products/pompelmi?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-pompelmi" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1010722&theme=light&t=1756653468504" alt="pompelmi - free&#0044;&#0032;open&#0045;source&#0032;file&#0032;scanner | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
6
+ <a href="https://www.producthunt.com/products/pompelmi?embed=true&utm_source=badge-pompelmi&utm_medium=badge" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1010722&theme=light&t=1756653468504" alt="pompelmi - free&#0044;&#0032;open&#0045;source&#0032;file&#0032;scanner | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
6
7
  <br/>
7
8
  <a href="https://github.com/pompelmi/pompelmi" target="_blank" rel="noopener noreferrer">
8
- <img src="https://raw.githubusercontent.com/pompelmi/pompelmi/refs/heads/main/assets/logo.svg" alt="pompelmi logo" width="360" height="280" />
9
+ <img src="https://raw.githubusercontent.com/pompelmi/pompelmi/refs/heads/main/assets/logo.svg" alt="pompelmi logo" width="360" />
9
10
  </a>
10
11
  <br/>
11
12
  <a href="https://www.detectionengineering.net/p/det-eng-weekly-issue-124-the-defcon"><img alt="Featured in Detection Engineering Weekly #124" src="https://img.shields.io/badge/featured-Detection%20Engineering%20Weekly-0A84FF?logo=substack"></a>
13
+ <a href="https://nodeweekly.com/issues/594"><img alt="Featured in Node Weekly #594" src="https://img.shields.io/badge/featured-Node%20Weekly%20%23594-FF6600?logo=node.js"></a>
14
+ <a href="https://bytes.dev/archives/429"><img alt="Featured in Bytes #429" src="https://img.shields.io/badge/featured-Bytes%20%23429-111111"></a>
12
15
  <br/>
13
16
 
14
17
  </p>
@@ -18,13 +21,10 @@
18
21
 
19
22
 
20
23
  <p align="center">
21
- <img src="assets/video.gif" alt="pompelmi demo" width="920" />
22
- <br/>
23
- <br/>
24
+
24
25
  <strong>Fast file‑upload malware scanning for Node.js</strong> — optional <strong>YARA</strong> integration, ZIP deep‑inspection, and drop‑in adapters for <em>Express</em>, <em>Koa</em>, and <em>Next.js</em>. Private by design. Typed. Tiny.
25
26
  </p>
26
27
 
27
- assets/video.mp4
28
28
 
29
29
 
30
30
  <p align="center">
@@ -51,14 +51,32 @@ assets/video.mp4
51
51
  <a href="#configuration">Config</a> ·
52
52
  <a href="#production-checklist">Production checklist</a> ·
53
53
  <a href="#yara-getting-started">YARA</a> ·
54
- <a href="#quick-test-eicar">Quick test</a> ·
54
+ <a href="#quick-test-no-eicar">Quick test</a> ·
55
55
  <a href="#security-notes">Security</a> ·
56
56
  <a href="#faq">FAQ</a>
57
57
  </p>
58
58
 
59
+ <!-- HERO END -->
60
+
59
61
  ---
60
62
 
61
- ## Overview
63
+ <details>
64
+ <summary><strong>Table of contents</strong></summary>
65
+
66
+ - [Install](#installation)
67
+ - [Quick‑start](#quick-start)
68
+ - [GitHub Action](#github-action)
69
+ - [Adapters](#adapters)
70
+ - [Diagrams](#diagrams)
71
+ - [Config](#configuration)
72
+ - [Production checklist](#production-checklist)
73
+ - [YARA](#yara-getting-started)
74
+ - [Quick test](#quick-test-no-eicar)
75
+ - [Security](#security-notes)
76
+ - [FAQ](#faq)
77
+ </details>
78
+
79
+ ## 🚀 Overview
62
80
 
63
81
  **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.
64
82
 
@@ -68,7 +86,7 @@ assets/video.mp4
68
86
  - **Drop-in adapters** — Express, Koa, Fastify, Next.js
69
87
  - **Typed & tiny** — modern TS, minimal surface
70
88
 
71
- ## Highlights
89
+ ## Highlights
72
90
 
73
91
  - **Block risky uploads early** — classify uploads as _clean_, _suspicious_, or _malicious_ and stop them at the edge.
74
92
  - **Real guards** — extension allow‑list, server‑side MIME sniff (magic bytes), per‑file size caps, and **deep ZIP** traversal with anti‑bomb limits.
@@ -79,9 +97,37 @@ assets/video.mp4
79
97
 
80
98
  > Keywords: file upload security, malware scanning, YARA, Node.js, Express, Koa, Next.js, ZIP scanning, ZIP bomb, PDF JavaScript, Office macros
81
99
 
100
+ ## 🧠 Why pompelmi?
101
+
102
+ - **On‑device, private scanning** – no outbound calls, no data sharing.
103
+ - **Blocks early** – runs *before* you write to disk or persist anything.
104
+ - **Fits your stack** – drop‑in adapters for Express, Koa, Next.js (Fastify plugin in alpha).
105
+ - **Defense‑in‑depth** – ZIP traversal limits, ratio caps, server‑side MIME sniffing, size caps.
106
+ - **Pluggable detection** – bring your own engine (e.g., YARA) via a tiny `{ scan(bytes) }` contract.
107
+
108
+ ### Who is it for?
109
+
110
+ - Teams who can’t send uploads to third‑party AV APIs.
111
+ - Apps that need predictable, low‑latency decisions inline.
112
+ - Developers who want simple, typed building blocks instead of a daemon.
113
+
114
+ ## 🔍 How it compares
115
+
116
+ | Capability | pompelmi | ClamAV / node‑clam | Cloud AV APIs |
117
+ | --- | --- | --- | --- |
118
+ | Runs fully in‑process | ✅ | ❌ (separate daemon) | ❌ (network calls) |
119
+ | Bytes stay private | ✅ | ✅ | ❌ |
120
+ | Deep ZIP limits & MIME sniff | ✅ | ✅ (archive scan) | ❓ varies |
121
+ | YARA integration | ✅ optional | ❌* | ❓ varies |
122
+ | Framework adapters | ✅ Express/Koa/Next.js | ❌ | ❌ |
123
+ | Works in CI on artifacts | ✅ | ✅ | ❓ varies |
124
+ | Licensing | MIT | GPL (engine) | Proprietary |
125
+
126
+ \* You can run YARA alongside ClamAV, but it’s not built‑in.
127
+
82
128
  ---
83
129
 
84
- ## Installation
130
+ ## 🔧 Installation
85
131
 
86
132
  ```bash
87
133
  # core library
@@ -100,7 +146,7 @@ yarn add pompelmi
100
146
 
101
147
  ---
102
148
 
103
- ## Quick‑start
149
+ ## Quick‑start
104
150
 
105
151
  **At a glance (policy + scanners)**
106
152
 
@@ -182,7 +228,7 @@ export const POST = createNextUploadHandler({ ...policy, scanner });
182
228
 
183
229
  ---
184
230
 
185
- ## GitHub Action
231
+ ## 🤖 GitHub Action
186
232
 
187
233
  Run **pompelmi** in CI to scan repository files or built artifacts.
188
234
 
@@ -228,7 +274,7 @@ jobs:
228
274
 
229
275
  ---
230
276
 
231
- ## Adapters
277
+ ## 🧩 Adapters
232
278
 
233
279
  Use the adapter that matches your web framework. All adapters share the same policy options and scanning contract.
234
280
 
@@ -245,7 +291,7 @@ Use the adapter that matches your web framework. All adapters share the same pol
245
291
 
246
292
  ---
247
293
 
248
- ## Diagrams
294
+ ## 🗺️ Diagrams
249
295
 
250
296
  ### Upload scanning flow
251
297
  ```mermaid
@@ -371,7 +417,7 @@ flowchart LR
371
417
 
372
418
  ---
373
419
 
374
- ## Configuration
420
+ ## ⚙️ Configuration
375
421
 
376
422
  All adapters accept a common set of options:
377
423
 
@@ -399,7 +445,7 @@ failClosed: true,
399
445
 
400
446
  ---
401
447
 
402
- ## Production checklist
448
+ ## Production checklist
403
449
 
404
450
  - [ ] **Limit file size** aggressively (`maxFileSizeBytes`).
405
451
  - [ ] **Restrict extensions & MIME** to what your app truly needs.
@@ -414,7 +460,7 @@ failClosed: true,
414
460
 
415
461
  ---
416
462
 
417
- ## YARA Getting Started
463
+ ## 🧬 YARA Getting Started
418
464
 
419
465
  YARA lets you detect suspicious or malicious content using pattern‑matching rules.
420
466
  **pompelmi** treats YARA matches as signals that you can map to your own verdicts
@@ -532,7 +578,7 @@ export const scanner = composeScanners(
532
578
 
533
579
  Combine YARA with MIME sniffing, ZIP safety limits, and strict size/time caps.
534
580
 
535
- ## Quick test (no EICAR)
581
+ ## 🧪 Quick test (no EICAR)
536
582
 
537
583
  Use the examples above, then send a **minimal PDF** that contains risky tokens (this triggers the built‑in heuristics).
538
584
 
@@ -559,7 +605,7 @@ You should see an HTTP **422 Unprocessable Entity** (blocked by policy). Clean f
559
605
 
560
606
  ---
561
607
 
562
- ## Security notes
608
+ ## 🔒 Security notes
563
609
 
564
610
  - The library **reads** bytes; it never executes files.
565
611
  - YARA detections depend on the **rules you provide**; expect some false positives/negatives.
@@ -568,13 +614,21 @@ You should see an HTTP **422 Unprocessable Entity** (blocked by policy). Clean f
568
614
 
569
615
  ---
570
616
 
571
- ## Star history
617
+ [...]
618
+
619
+ ## 🔔 Releases & security
620
+
621
+ - **Changelog / releases:** see [GitHub Releases](https://github.com/pompelmi/pompelmi/releases).
622
+ - **Security disclosures:** please use [GitHub Security Advisories](https://github.com/pompelmi/pompelmi/security/advisories). We’ll coordinate a fix before public disclosure.
623
+ - **Production users:** open a [Discussion](https://github.com/pompelmi/pompelmi/discussions) to share requirements or request adapters.
624
+
625
+ ## ⭐ Star history
572
626
 
573
627
  [![Star History Chart](https://api.star-history.com/svg?repos=pompelmi/pompelmi&type=Date)](https://star-history.com/#pompelmi/pompelmi&Date)
574
628
 
575
629
  ---
576
630
 
577
- ## FAQ
631
+ ## 💬 FAQ
578
632
 
579
633
  **Do I need YARA?**
580
634
  No. `scanner` is pluggable. The examples use a minimal scanner for clarity; you can call out to a YARA engine or any other detector you prefer.
@@ -590,7 +644,7 @@ Archives are traversed with limits to reduce archive‑bomb risk. Keep your size
590
644
 
591
645
  ---
592
646
 
593
- ## Tests & Coverage
647
+ ## 🧪 Tests & Coverage
594
648
 
595
649
  Run tests locally with coverage:
596
650
 
@@ -606,7 +660,7 @@ If you integrate Codecov in CI, upload `coverage/lcov.info` and you can use this
606
660
  [![codecov](https://codecov.io/gh/pompelmi/pompelmi/branch/main/graph/badge.svg?flag=core)](https://codecov.io/gh/pompelmi/pompelmi)
607
661
  ```
608
662
 
609
- ## Contributing
663
+ ## 🤝 Contributing
610
664
 
611
665
  PRs and issues welcome! Start with:
612
666
 
@@ -617,6 +671,8 @@ pnpm -r lint
617
671
 
618
672
  ---
619
673
 
620
- ## License
674
+ <p align="right"><a href="#pompelmi">↑ Back to top</a></p>
675
+
676
+ ## 📜 License
621
677
 
622
678
  [MIT](./LICENSE) © 2025‑present pompelmi contributors