pompelmi 0.30.0 โ 0.31.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 +100 -134
- package/package.json +14 -2
package/README.md
CHANGED
|
@@ -82,13 +82,14 @@
|
|
|
82
82
|
<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>
|
|
83
83
|
<a href="https://github.com/pompelmi/pompelmi/watchers"><img alt="GitHub watchers" src="https://img.shields.io/github/watchers/pompelmi/pompelmi?style=social"></a>
|
|
84
84
|
<a href="https://github.com/pompelmi/pompelmi/issues"><img alt="open issues" src="https://img.shields.io/github/issues/pompelmi/pompelmi?color=orange"></a>
|
|
85
|
+
<a href="https://github.com/sponsors/pompelmi"><img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/pompelmi?style=social&label=Sponsor"></a>
|
|
85
86
|
</p>
|
|
86
87
|
|
|
87
88
|
<p align="center">
|
|
88
89
|
<strong>
|
|
89
90
|
<a href="https://pompelmi.github.io/pompelmi/">๐ Documentation</a> โข
|
|
90
91
|
<a href="#-installation">๐พ Install</a> โข
|
|
91
|
-
<a href="#-
|
|
92
|
+
<a href="#-quickstart">โก Quickstart</a> โข
|
|
92
93
|
<a href="#-adapters">๐งฉ Adapters</a> โข
|
|
93
94
|
<a href="#-yara-getting-started">๐งฌ YARA</a> โข
|
|
94
95
|
<a href="#-github-action">๐ค CI/CD</a>
|
|
@@ -101,6 +102,37 @@
|
|
|
101
102
|
|
|
102
103
|
---
|
|
103
104
|
|
|
105
|
+
## ๐ฆ Installation
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install pompelmi
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> Node.js 18+ required. No daemon, no cloud API keys, no configuration files needed to get started.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## โก Quickstart
|
|
116
|
+
|
|
117
|
+
Scan a file and act on the result in three lines:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { scanFile } from 'pompelmi';
|
|
121
|
+
|
|
122
|
+
const result = await scanFile('path/to/upload.pdf');
|
|
123
|
+
// result.verdict โ "clean" | "suspicious" | "malicious"
|
|
124
|
+
|
|
125
|
+
if (result.verdict !== 'clean') {
|
|
126
|
+
console.error('Blocked:', result.verdict, result.reasons);
|
|
127
|
+
} else {
|
|
128
|
+
console.log('Safe to process.');
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
That's it. No server required, no framework dependency โ works standalone in any Node.js script or service.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
104
136
|
## ๐ฌ Demo
|
|
105
137
|
|
|
106
138
|

|
|
@@ -130,78 +162,29 @@ npm i pompelmi @pompelmi/express-middleware
|
|
|
130
162
|
|
|
131
163
|
---
|
|
132
164
|
|
|
133
|
-
## โก Quick Start
|
|
134
|
-
|
|
135
|
-
Get secure file upload scanning running in **under 5 minutes**.
|
|
136
|
-
|
|
137
|
-
### Express Integration
|
|
138
|
-
|
|
139
|
-
```ts
|
|
140
|
-
import express from 'express';
|
|
141
|
-
import multer from 'multer';
|
|
142
|
-
import { createUploadGuard } from '@pompelmi/express-middleware';
|
|
143
|
-
import { CommonHeuristicsScanner, createZipBombGuard, composeScanners } from 'pompelmi';
|
|
144
|
-
|
|
145
|
-
const app = express();
|
|
146
|
-
const upload = multer({ storage: multer.memoryStorage() });
|
|
147
|
-
|
|
148
|
-
// Configure your security policy
|
|
149
|
-
const scanner = composeScanners(
|
|
150
|
-
[
|
|
151
|
-
['zipGuard', createZipBombGuard({ maxEntries: 512, maxCompressionRatio: 12 })],
|
|
152
|
-
['heuristics', CommonHeuristicsScanner],
|
|
153
|
-
],
|
|
154
|
-
{ parallel: false, stopOn: 'suspicious', timeoutMsPerScanner: 1500 }
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
app.post('/upload',
|
|
158
|
-
upload.single('file'),
|
|
159
|
-
createUploadGuard({
|
|
160
|
-
includeExtensions: ['pdf', 'zip', 'png', 'jpg'],
|
|
161
|
-
allowedMimeTypes: ['application/pdf', 'application/zip', 'image/png', 'image/jpeg'],
|
|
162
|
-
maxFileSizeBytes: 20 * 1024 * 1024, // 20MB
|
|
163
|
-
scanner,
|
|
164
|
-
failClosed: true
|
|
165
|
-
}),
|
|
166
|
-
(req, res) => {
|
|
167
|
-
// File is safe - proceed with your logic
|
|
168
|
-
res.json({ success: true, message: 'File uploaded successfully' });
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
app.listen(3000, () => console.log('๐ Server running on http://localhost:3000'));
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**Test it:**
|
|
176
|
-
```bash
|
|
177
|
-
curl -X POST http://localhost:3000/upload -F "file=@test.pdf"
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
โ
**Done!** Your app now blocks malicious uploads before they hit disk.
|
|
181
|
-
|
|
182
|
-
๐ **[Explore full documentation โ](https://pompelmi.github.io/pompelmi/)** | **[See more examples โ](./examples/)**
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
165
|
## Table of Contents
|
|
187
166
|
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
190
|
-
- [
|
|
191
|
-
- [
|
|
192
|
-
- [
|
|
193
|
-
- [
|
|
194
|
-
- [
|
|
195
|
-
- [
|
|
196
|
-
- [
|
|
197
|
-
- [
|
|
198
|
-
- [
|
|
199
|
-
- [
|
|
200
|
-
- [Production Checklist](
|
|
201
|
-
- [
|
|
202
|
-
- [
|
|
203
|
-
- [
|
|
204
|
-
- [
|
|
167
|
+
- [Installation](#-installation)
|
|
168
|
+
- [Quickstart](#-quickstart)
|
|
169
|
+
- [Demo](#-demo)
|
|
170
|
+
- [Features](#-features)
|
|
171
|
+
- [Why pompelmi?](#-why-pompelmi)
|
|
172
|
+
- [Use Cases](#-use-cases)
|
|
173
|
+
- [Getting Started](#-getting-started)
|
|
174
|
+
- [Code Examples](#-code-examples)
|
|
175
|
+
- [Adapters](#-adapters)
|
|
176
|
+
- [GitHub Action](#-github-action)
|
|
177
|
+
- [Diagrams](#๏ธ-diagrams)
|
|
178
|
+
- [Configuration](#๏ธ-configuration)
|
|
179
|
+
- [Production Checklist](#-production-checklist)
|
|
180
|
+
- [YARA Getting Started](#-yara-getting-started)
|
|
181
|
+
- [Security Notes](#-security-notes)
|
|
182
|
+
- [Releases & Security](#-releases--security)
|
|
183
|
+
- [Community & Recognition](#-community--recognition)
|
|
184
|
+
- [FAQ](#-faq)
|
|
185
|
+
- [Tests & Coverage](#-tests--coverage)
|
|
186
|
+
- [Contributing](#-contributing)
|
|
187
|
+
- [License](#-license)
|
|
205
188
|
|
|
206
189
|
---
|
|
207
190
|
|
|
@@ -298,71 +281,11 @@ Validate user-generated content uploads (images, videos, documents) before proce
|
|
|
298
281
|
|
|
299
282
|
---
|
|
300
283
|
|
|
301
|
-
## ๐ฆ Installation
|
|
302
|
-
|
|
303
|
-
**pompelmi** is a privacy-first Node.js library for local file scanning.
|
|
304
|
-
|
|
305
|
-
**Requirements:**
|
|
306
|
-
- Node.js 18+
|
|
307
|
-
- Optional: ClamAV binaries (for signature-based scanning)
|
|
308
|
-
- Optional: YARA libraries (for custom rules)
|
|
309
|
-
|
|
310
|
-
<table>
|
|
311
|
-
<tr>
|
|
312
|
-
<td><b>npm</b></td>
|
|
313
|
-
<td><code>npm install pompelmi</code></td>
|
|
314
|
-
</tr>
|
|
315
|
-
<tr>
|
|
316
|
-
<td><b>pnpm</b></td>
|
|
317
|
-
<td><code>pnpm add pompelmi</code></td>
|
|
318
|
-
</tr>
|
|
319
|
-
<tr>
|
|
320
|
-
<td><b>yarn</b></td>
|
|
321
|
-
<td><code>yarn add pompelmi</code></td>
|
|
322
|
-
</tr>
|
|
323
|
-
<tr>
|
|
324
|
-
<td><b>bun</b></td>
|
|
325
|
-
<td><code>bun add pompelmi</code></td>
|
|
326
|
-
</tr>
|
|
327
|
-
</table>
|
|
328
|
-
|
|
329
|
-
#### ๐ฆ Framework Adapters
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
# Express
|
|
333
|
-
npm i @pompelmi/express-middleware
|
|
334
|
-
|
|
335
|
-
# Koa
|
|
336
|
-
npm i @pompelmi/koa-middleware
|
|
337
|
-
|
|
338
|
-
# Next.js
|
|
339
|
-
npm i @pompelmi/next-upload
|
|
340
|
-
|
|
341
|
-
# NestJS
|
|
342
|
-
npm i @pompelmi/nestjs-integration
|
|
343
|
-
|
|
344
|
-
# Fastify (alpha)
|
|
345
|
-
npm i @pompelmi/fastify-plugin
|
|
346
|
-
|
|
347
|
-
# Standalone CLI
|
|
348
|
-
npm i -g @pompelmi/cli
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
> **Note:** Core library works standalone. Install adapters only if using specific frameworks.
|
|
352
|
-
|
|
353
|
-
---
|
|
354
|
-
|
|
355
284
|
## ๐ Getting Started
|
|
356
285
|
|
|
357
286
|
Get secure file scanning running in under 5 minutes with pompelmi's zero-config defaults.
|
|
358
287
|
|
|
359
|
-
### Step 1:
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
npm install pompelmi
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### Step 2: Create Security Policy
|
|
288
|
+
### Step 1: Create Security Policy
|
|
366
289
|
|
|
367
290
|
Create a reusable security policy and scanner configuration:
|
|
368
291
|
|
|
@@ -399,7 +322,7 @@ export const scanner = composeScanners(
|
|
|
399
322
|
);
|
|
400
323
|
```
|
|
401
324
|
|
|
402
|
-
### Step
|
|
325
|
+
### Step 2: Choose Your Integration
|
|
403
326
|
|
|
404
327
|
Pick the integration that matches your framework:
|
|
405
328
|
|
|
@@ -490,7 +413,7 @@ if (result.verdict === 'malicious') {
|
|
|
490
413
|
}
|
|
491
414
|
```
|
|
492
415
|
|
|
493
|
-
### Step
|
|
416
|
+
### Step 3: Test It
|
|
494
417
|
|
|
495
418
|
Upload a test file to verify everything works:
|
|
496
419
|
|
|
@@ -693,6 +616,28 @@ Use the adapter that matches your web framework. All adapters share the same pol
|
|
|
693
616
|
| **SvelteKit** | - | ๐ Planned | Coming soon |
|
|
694
617
|
| **hapi** | - | ๐ Planned | Coming soon |
|
|
695
618
|
|
|
619
|
+
```bash
|
|
620
|
+
# Express
|
|
621
|
+
npm i @pompelmi/express-middleware
|
|
622
|
+
|
|
623
|
+
# Koa
|
|
624
|
+
npm i @pompelmi/koa-middleware
|
|
625
|
+
|
|
626
|
+
# Next.js
|
|
627
|
+
npm i @pompelmi/next-upload
|
|
628
|
+
|
|
629
|
+
# NestJS
|
|
630
|
+
npm i @pompelmi/nestjs-integration
|
|
631
|
+
|
|
632
|
+
# Fastify (alpha)
|
|
633
|
+
npm i @pompelmi/fastify-plugin
|
|
634
|
+
|
|
635
|
+
# Standalone CLI
|
|
636
|
+
npm i -g @pompelmi/cli
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
> **Note:** Core library works standalone. Install adapters only if using a specific framework.
|
|
640
|
+
|
|
696
641
|
See the [๐ Code Examples](#-code-examples) section above for integration examples.
|
|
697
642
|
|
|
698
643
|
๐ **[View adapter documentation โ](https://pompelmi.github.io/pompelmi/)** | **[Browse all examples โ](./examples/)**
|
|
@@ -1131,6 +1076,7 @@ _Want to share your experience? [Open a discussion](https://github.com/pompelmi/
|
|
|
1131
1076
|
- ๐ **[Issue Tracker](https://github.com/pompelmi/pompelmi/issues)** โ Report bugs, request features
|
|
1132
1077
|
- ๐ **[Security Policy](https://github.com/pompelmi/pompelmi/security)** โ Report security vulnerabilities privately
|
|
1133
1078
|
- ๐ผ **Commercial Support** โ For enterprise support and consulting, contact the maintainers
|
|
1079
|
+
- ๐ **[Sponsor pompelmi](https://github.com/sponsors/pompelmi)** โ Support ongoing development via GitHub Sponsors
|
|
1134
1080
|
|
|
1135
1081
|
**Supported Frameworks:**
|
|
1136
1082
|
- โ
Express
|
|
@@ -1160,6 +1106,26 @@ Thanks to all the amazing contributors who have helped make pompelmi better!
|
|
|
1160
1106
|
|
|
1161
1107
|
---
|
|
1162
1108
|
|
|
1109
|
+
## ๐ Sponsors
|
|
1110
|
+
|
|
1111
|
+
Pompelmi is free and open-source. If it saves you time or helps protect your users, consider supporting its development!
|
|
1112
|
+
|
|
1113
|
+
<p align="center">
|
|
1114
|
+
<a href="https://github.com/sponsors/pompelmi">
|
|
1115
|
+
<img src="https://img.shields.io/badge/Sponsor-pompelmi-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="Sponsor pompelmi on GitHub" />
|
|
1116
|
+
</a>
|
|
1117
|
+
</p>
|
|
1118
|
+
|
|
1119
|
+
Your sponsorship helps fund:
|
|
1120
|
+
- ๐งฌ New detection engine integrations
|
|
1121
|
+
- ๐งช Expanded test coverage and CI infrastructure
|
|
1122
|
+
- ๐ Documentation and examples
|
|
1123
|
+
- ๐ Security audits and CVE response
|
|
1124
|
+
|
|
1125
|
+
Thank you to all current and future sponsors for keeping this project alive!
|
|
1126
|
+
|
|
1127
|
+
---
|
|
1128
|
+
|
|
1163
1129
|
## โญ Star History
|
|
1164
1130
|
|
|
1165
1131
|
<p align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pompelmi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Fast, private malware scanner for Node.js file uploads. TypeScript-first library with Express, Koa, Fastify, Next.js & Nuxt/Nitro adapters. Features deep ZIP inspection, YARA integration, ZIP bomb protection, and real-time threat detection. Zero cloud dependencies - scan files in-process before they hit disk. Perfect for GDPR/HIPAA compliance.",
|
|
5
5
|
"main": "./dist/pompelmi.cjs",
|
|
6
6
|
"module": "./dist/pompelmi.esm.js",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"url": "https://github.com/pompelmi/pompelmi.git"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://pompelmi.github.io/pompelmi/",
|
|
17
|
+
"funding": {
|
|
18
|
+
"type": "github",
|
|
19
|
+
"url": "https://github.com/sponsors/pompelmi"
|
|
20
|
+
},
|
|
17
21
|
"pnpm": {
|
|
18
22
|
"overrides": {
|
|
19
23
|
"process": "0.11.10",
|
|
@@ -53,7 +57,12 @@
|
|
|
53
57
|
"mdast-util-to-hast@>=13.0.0 <13.2.1": ">=13.2.1",
|
|
54
58
|
"next@>=16.0.0-canary.0 <16.0.7": ">=16.0.7",
|
|
55
59
|
"next@>=16.0.0-beta.0 <16.0.9": ">=16.0.9",
|
|
56
|
-
"qs@<6.14.
|
|
60
|
+
"qs@<6.14.2": ">=6.14.2",
|
|
61
|
+
"multer@<2.0.2": ">=2.0.2",
|
|
62
|
+
"@isaacs/brace-expansion@<=5.0.0": ">=5.0.1",
|
|
63
|
+
"ajv@<8.18.0": ">=8.18.0",
|
|
64
|
+
"fastify@<5.7.3": ">=5.7.3",
|
|
65
|
+
"next@>=16.0.9 <16.1.5": ">=16.1.5",
|
|
57
66
|
"preact@>=10.28.0 <10.28.2": ">=10.28.2",
|
|
58
67
|
"devalue@>=5.1.0 <5.6.2": ">=5.6.2",
|
|
59
68
|
"h3@<=1.15.4": ">=1.15.5",
|
|
@@ -65,6 +74,9 @@
|
|
|
65
74
|
},
|
|
66
75
|
"scripts": {
|
|
67
76
|
"build": "rollup -c",
|
|
77
|
+
"test": "vitest run --passWithNoTests",
|
|
78
|
+
"test:coverage": "vitest run --coverage --passWithNoTests",
|
|
79
|
+
"test:coverage:ci": "vitest run --coverage --reporter=verbose --passWithNoTests",
|
|
68
80
|
"prepublishOnly": "npm run build && npm run pack:strict",
|
|
69
81
|
"yara:node:smoke": "tsx scripts/yara-node-smoke.ts",
|
|
70
82
|
"yara:int:smoke": "tsx scripts/yara-integration-smoke.ts",
|