pompelmi 0.18.0 → 0.19.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/dist/pompelmi.cjs +2340 -0
- package/dist/pompelmi.cjs.map +1 -0
- package/dist/pompelmi.esm.js +2326 -0
- package/dist/pompelmi.esm.js.map +1 -0
- package/dist/types/browser-index.d.ts +3 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/magic.d.ts +7 -0
- package/dist/types/node/scanDir.d.ts +30 -0
- package/dist/types/policy.d.ts +12 -0
- package/dist/types/presets.d.ts +7 -0
- package/dist/types/risk.d.ts +18 -0
- package/dist/types/scan/remote.d.ts +12 -0
- package/dist/types/scan.d.ts +12 -0
- package/dist/types/scanners/common-heuristics.d.ts +14 -0
- package/dist/types/scanners/zip-bomb-guard.d.ts +9 -0
- package/dist/types/scanners/zipTraversalGuard.d.ts +19 -0
- package/dist/types/stream.d.ts +10 -0
- package/dist/types/types.d.ts +48 -0
- package/dist/types/useFileScanner.d.ts +15 -0
- package/dist/types/validate.d.ts +7 -0
- package/dist/types/verdict.d.ts +2 -0
- package/dist/types/yara/browser.d.ts +7 -0
- package/dist/types/yara/index.d.ts +17 -0
- package/dist/types/yara/node.d.ts +2 -0
- package/dist/types/yara/remote.d.ts +10 -0
- package/dist/types/yara-bridge.d.ts +3 -0
- package/dist/types/zip.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ScanReport } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* React Hook: handles <input type="file" onChange> with validation + scanning.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useFileScanner(): {
|
|
6
|
+
results: {
|
|
7
|
+
file: File;
|
|
8
|
+
report: ScanReport;
|
|
9
|
+
}[];
|
|
10
|
+
errors: {
|
|
11
|
+
file: File;
|
|
12
|
+
error: string;
|
|
13
|
+
}[];
|
|
14
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { YaraEngine } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Engine YARA lato browser — NO WASM.
|
|
4
|
+
* È un no-op sicuro: non produce match e non richiede dipendenze native.
|
|
5
|
+
* Se vuoi YARA in browser senza WASM, userai un adapter remoto (vedi step successivo).
|
|
6
|
+
*/
|
|
7
|
+
export declare function createBrowserEngine(): Promise<YaraEngine>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface YaraMatch {
|
|
2
|
+
rule: string;
|
|
3
|
+
tags?: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface YaraCompiled {
|
|
6
|
+
scan(data: Uint8Array): Promise<YaraMatch[]>;
|
|
7
|
+
scanFile?: (filePath: string) => Promise<YaraMatch[]>;
|
|
8
|
+
scanFileAsync?: (filePath: string) => Promise<YaraMatch[]>;
|
|
9
|
+
}
|
|
10
|
+
export interface YaraEngine {
|
|
11
|
+
compile(rulesSource: string): Promise<YaraCompiled>;
|
|
12
|
+
compileFile?: (rulesPath: string) => Promise<YaraCompiled>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createYaraEngine(): Promise<YaraEngine>;
|
|
15
|
+
export declare function createYaraScannerFromRules(rulesSource: string): Promise<YaraCompiled>;
|
|
16
|
+
export declare function createYaraScannerFromFile(rulesPath: string): Promise<YaraCompiled>;
|
|
17
|
+
export { createRemoteEngine } from './remote';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { YaraEngine } from './index';
|
|
2
|
+
export interface RemoteEngineOptions {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
rulesField?: string;
|
|
6
|
+
fileField?: string;
|
|
7
|
+
mode?: 'multipart' | 'json-base64';
|
|
8
|
+
rulesAsBase64?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function createRemoteEngine(opts: RemoteEngineOptions): Promise<YaraEngine>;
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pompelmi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
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",
|