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.
@@ -0,0 +1,10 @@
1
+ import type { ScanReport, YaraMatch } from "./types";
2
+ export type ScanOptions = {
3
+ maxBytes?: number;
4
+ timeoutMs?: number;
5
+ detectMime?: boolean;
6
+ computeSha256?: boolean;
7
+ scanChunk?: (chunk: Uint8Array) => Promise<void> | void;
8
+ scanAll: (bytes: Uint8Array) => Promise<YaraMatch[]>;
9
+ };
10
+ export declare function scanStream(readable: NodeJS.ReadableStream, options: ScanOptions): Promise<ScanReport>;
@@ -0,0 +1,48 @@
1
+ /** Shared types for Pompelmi */
2
+ export type Verdict = 'clean' | 'suspicious' | 'malicious';
3
+ export interface YaraMatch {
4
+ rule: string;
5
+ namespace?: string;
6
+ tags?: string[];
7
+ meta?: Record<string, unknown>;
8
+ }
9
+ export interface Match {
10
+ rule: string;
11
+ severity?: 'low' | 'medium' | 'high' | 'critical' | 'suspicious';
12
+ meta?: Record<string, unknown>;
13
+ }
14
+ export interface FileInfo {
15
+ name?: string;
16
+ mimeType?: string;
17
+ size?: number;
18
+ sha256?: string;
19
+ }
20
+ export type ScanContext = {
21
+ filename?: string;
22
+ mimeType?: string;
23
+ size?: number;
24
+ };
25
+ export type ScanFn = (input: Uint8Array, ctx?: ScanContext) => Promise<Match[]> | Match[];
26
+ export type Scanner = ScanFn | {
27
+ name?: string;
28
+ scan: ScanFn;
29
+ };
30
+ interface BaseReport {
31
+ verdict: Verdict;
32
+ matches: YaraMatch[];
33
+ reasons?: string[];
34
+ file?: FileInfo;
35
+ durationMs?: number;
36
+ error?: string;
37
+ ok: boolean;
38
+ truncated?: boolean;
39
+ timedOut?: boolean;
40
+ engine?: string;
41
+ }
42
+ export interface NormalScanReport extends BaseReport {
43
+ }
44
+ export interface StreamScanReport extends BaseReport {
45
+ }
46
+ export type ScanReport = NormalScanReport | StreamScanReport;
47
+ export type Uint8ArrayLike = Uint8Array | ArrayBufferView;
48
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { YaraMatch, Verdict } from './types';
2
+ export declare function mapMatchesToVerdict(matches?: YaraMatch[]): Verdict;
@@ -0,0 +1,3 @@
1
+ export declare function createScanner(rulesPath?: string): {
2
+ scan(bytes: Uint8Array): Promise<unknown>;
3
+ };
@@ -0,0 +1,13 @@
1
+ export type ZipBudget = {
2
+ maxEntries: number;
3
+ maxDepth: number;
4
+ maxTotalUncompressed: number;
5
+ maxPerEntryUncompressed: number;
6
+ maxCompressionRatio: number;
7
+ };
8
+ export type ZipEntry = {
9
+ path: string;
10
+ depth: number;
11
+ data: Uint8Array;
12
+ };
13
+ export declare function iterateZip(buffer: Uint8Array, budget: ZipBudget, depth?: number): AsyncGenerator<ZipEntry>;
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "pompelmi",
3
- "version": "0.15.1",
3
+ "version": "0.16.2",
4
4
  "description": "RFI-safe file uploads for Node.js — Express/Koa/Next.js middleware with deep ZIP inspection, MIME/size checks, and optional YARA scanning.",
5
5
  "main": "./dist/pompelmi.cjs",
6
6
  "module": "./dist/pompelmi.esm.js",
7
- "types": "./dist/index.d.ts",
8
7
  "type": "module",
9
8
  "browser": {
10
9
  "yara": false,
@@ -12,7 +11,8 @@
12
11
  },
13
12
  "repository": {
14
13
  "type": "git",
15
- "url": "https://github.com/pompelmi/pompelmi"
14
+ "url": "https://github.com/pompelmi/pompelmi.git",
15
+ "directory": "packages/engine"
16
16
  },
17
17
  "homepage": "https://pompelmi.github.io/pompelmi/",
18
18
  "pnpm": {
@@ -39,53 +39,54 @@
39
39
  "predocs:deploy": "npm run docs:build",
40
40
  "docs:deploy": "gh-pages -d docs -b gh-pages",
41
41
  "yara:check": "node scripts/yara-quick-check-cli.mjs",
42
- "build:core": "pnpm -r --filter \"./packages/**\" build && pnpm -w run build"
42
+ "build:core": "pnpm -r --filter '!./examples/*' --if-present build",
43
+ "preview": "npm pack --dry-run",
44
+ "typecheck": "tsc -p tsconfig.json --noEmit || tsc -p tsconfig.build.json --noEmit",
45
+ "typecheck:strict": "tsc -p tsconfig.strict.json --noEmit",
46
+ "smoke": "node scripts/smoke.mjs",
47
+ "test:e2e": "node scripts/e2e.mjs",
48
+ "repo:doctor": "pnpm install --frozen-lockfile && pnpm -r --if-present build && pnpm -r --if-present test && npm run -s preview || true && node scripts/smoke.mjs && node scripts/e2e.mjs || true",
49
+ "audit:deps": "depcheck --skip-missing true || true",
50
+ "audit:code": "knip --reporter compact || true",
51
+ "audit:exports": "ts-prune -p tsconfig.json || true",
52
+ "repo:audit": "node scripts/audit.mjs",
53
+ "pack:check": "node scripts/pack-check.mjs",
54
+ "pack:list": "pnpm -r --filter \"@pompelmi/*\" --if-present pack --json --dry-run",
55
+ "pack:strict": "node scripts/pack-check.mjs --strict"
43
56
  },
44
57
  "license": "MIT",
45
58
  "devDependencies": {
46
- "@astrojs/mdx": "^4.3.3",
47
- "@astrojs/sitemap": "^3.4.2",
48
- "@astrojs/starlight": "^0.35.2",
49
- "@astrojs/tailwind": "^6.0.2",
50
- "@babel/core": "^7.28.0",
51
- "@babel/preset-env": "^7.28.0",
52
- "@babel/preset-typescript": "^7.27.1",
53
- "@rollup/plugin-babel": "^6.0.4",
59
+ "@biomejs/biome": "^2.2.4",
60
+ "@pompelmi/core": "workspace:*",
61
+ "@pompelmi/engine": "workspace:0.16.2-dev.6",
62
+ "@pompelmi/engine-heuristics": "workspace:^0.1.0",
54
63
  "@rollup/plugin-commonjs": "^28.0.6",
55
64
  "@rollup/plugin-node-resolve": "^16.0.1",
56
65
  "@rollup/plugin-typescript": "^12.1.4",
57
66
  "@types/cors": "^2.8.19",
58
67
  "@types/express": "^5.0.3",
59
- "@types/koa": "^2.15.0",
60
68
  "@types/multer": "^2.0.0",
61
69
  "@types/node": "^24.3.0",
62
70
  "@types/react": "^19.1.8",
63
- "@types/react-dom": "^19.1.6",
64
- "@types/supertest": "^6.0.3",
65
71
  "@types/unzipper": "^0.10.11",
66
72
  "@vitest/coverage-v8": "^2",
67
73
  "cors": "^2.8.5",
74
+ "depcheck": "^1.4.7",
68
75
  "express": "^5.1.0",
69
76
  "gh-pages": "^6.3.0",
77
+ "knip": "^5.64.0",
70
78
  "multer": "^2.0.2",
71
79
  "react": "^18.0.0",
72
- "react-dom": "^18.0.0",
73
80
  "rollup": "^4.x",
74
- "rollup-plugin-peer-deps-external": "^2.2.4",
75
- "supertest": "^7.0.0",
81
+ "ts-prune": "^0.10.3",
76
82
  "tslib": "^2.8.1",
77
83
  "tsup": "^8",
78
84
  "tsx": "^4.20.3",
79
85
  "typescript": "^5.9.2",
80
- "vitest": "2.1.9",
81
- "yazl": "^3.3.1"
86
+ "vitest": "2.1.9"
82
87
  },
83
88
  "dependencies": {
84
- "file-type": "^21.0.0",
85
- "libyara-wasm": "^1.2.1",
86
- "rollup": "^4.45.1",
87
- "wasm-feature-detect": "^1.8.0",
88
- "yara": "npm:@automattic/yara@^2.6.0-beta.2"
89
+ "rollup": "^4.45.1"
89
90
  },
90
91
  "peerDependencies": {
91
92
  "react": "^18.0.0 || ^19.0.0",
@@ -95,14 +96,16 @@
95
96
  "@litko/yara-x": "^0.2.1"
96
97
  },
97
98
  "exports": {
98
- ".": {
99
- "require": "./dist/pompelmi.cjs",
100
- "import": "./dist/pompelmi.esm.js",
101
- "types": "./dist/index.d.ts"
102
- }
99
+ ".": {},
100
+ "./package.json": "./package.json"
103
101
  },
104
102
  "files": [
105
- "dist/"
103
+ "dist/",
104
+ "dist",
105
+ "README.md",
106
+ "LICENSE*",
107
+ "package.json",
108
+ "CHANGELOG*"
106
109
  ],
107
110
  "keywords": [
108
111
  "security",
@@ -134,12 +137,15 @@
134
137
  "example": "examples"
135
138
  },
136
139
  "author": "",
137
- "private": false,
138
- "workspaces": [
139
- "packages/*"
140
- ],
141
140
  "packageManager": "pnpm@9.12.0",
142
141
  "resolutions": {
143
142
  "process": "0.11.10"
143
+ },
144
+ "sideEffects": false,
145
+ "engines": {
146
+ "node": ">=18"
147
+ },
148
+ "publishConfig": {
149
+ "access": "public"
144
150
  }
145
151
  }