pompelmi 0.15.0-dev.27 → 0.15.0-dev.28
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.js +277 -319
- package/dist/pompelmi.cjs.js.map +1 -1
- package/dist/pompelmi.esm.js +274 -317
- package/dist/pompelmi.esm.js.map +1 -1
- package/dist/types/browser-index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -3
- package/dist/types/scan.d.ts +11 -40
- package/dist/types/useFileScanner.d.ts +2 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export { scanFiles } from './scan';
|
|
2
2
|
export { validateFile } from './validate';
|
|
3
3
|
export { useFileScanner } from './useFileScanner';
|
|
4
|
-
export { scanFilesWithYara } from './scan';
|
|
5
|
-
export { scanFilesWithHeuristicsAndYara, prefilterBrowser } from './scan';
|
|
6
|
-
export type { BrowserPolicy, PrefilterResult } from './scan';
|
|
7
4
|
export type { YaraMatch } from './yara/index';
|
|
8
5
|
export type { NodeScanOptions, NodeFileEntry } from './node/scanDir';
|
|
9
6
|
export { scanFilesWithRemoteYara } from './scan/remote';
|
|
@@ -12,3 +9,5 @@ export { mapMatchesToVerdict } from './verdict';
|
|
|
12
9
|
export { CommonHeuristicsScanner } from './scanners/common-heuristics';
|
|
13
10
|
export { createZipBombGuard } from './scanners/zip-bomb-guard';
|
|
14
11
|
export { definePolicy, DEFAULT_POLICY } from './policy';
|
|
12
|
+
export { createPresetScanner, composeScanners, type PresetName, type PresetOptions } from './presets';
|
|
13
|
+
export { scanBytes, scanFile, type ScanOptions } from './scan';
|
package/dist/types/scan.d.ts
CHANGED
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
type
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
maxFileSizeBytes: number;
|
|
7
|
-
denyScriptableSvg?: boolean;
|
|
1
|
+
import { type PresetName } from './presets';
|
|
2
|
+
import type { ScanContext, ScanReport } from './types';
|
|
3
|
+
export type ScanOptions = {
|
|
4
|
+
preset?: PresetName;
|
|
5
|
+
ctx?: ScanContext;
|
|
8
6
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare function
|
|
15
|
-
/**
|
|
16
|
-
* Reads an array of File objects via FileReader and returns their text.
|
|
17
|
-
*/
|
|
18
|
-
export declare function scanFiles(files: File[]): Promise<Array<{
|
|
19
|
-
file: File;
|
|
20
|
-
content: string;
|
|
21
|
-
}>>;
|
|
22
|
-
export declare function scanFilesWithYara(files: File[], rulesSource: string): Promise<Array<{
|
|
23
|
-
file: File;
|
|
24
|
-
content: string;
|
|
25
|
-
yara: {
|
|
26
|
-
matches: YaraMatch[];
|
|
27
|
-
};
|
|
28
|
-
}>>;
|
|
29
|
-
/**
|
|
30
|
-
* Scan files with fast browser heuristics + optional YARA.
|
|
31
|
-
* Returns content, prefilter verdict, and YARA matches.
|
|
32
|
-
*/
|
|
33
|
-
export declare function scanFilesWithHeuristicsAndYara(files: File[], rulesSource: string, policy: BrowserPolicy): Promise<Array<{
|
|
34
|
-
file: File;
|
|
35
|
-
content: string;
|
|
36
|
-
prefilter: PrefilterResult;
|
|
37
|
-
yara: {
|
|
38
|
-
matches: YaraMatch[];
|
|
39
|
-
};
|
|
40
|
-
}>>;
|
|
41
|
-
export {};
|
|
7
|
+
/** Scan di bytes (browser/node) usando preset (default: zip-basic) */
|
|
8
|
+
export declare function scanBytes(input: Uint8Array, opts?: ScanOptions): Promise<ScanReport>;
|
|
9
|
+
/** Scan di un file su disco (Node). Import dinamico per non vincolare il bundle browser. */
|
|
10
|
+
export declare function scanFile(filePath: string, opts?: Omit<ScanOptions, 'ctx'>): Promise<ScanReport>;
|
|
11
|
+
/** Scan multipli File (browser) usando scanBytes + preset di default */
|
|
12
|
+
export declare function scanFiles(files: ArrayLike<File>, opts?: Omit<ScanOptions, 'ctx'>): Promise<ScanReport[]>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ScanReport } from './types';
|
|
1
2
|
/**
|
|
2
3
|
* React Hook: handles <input type="file" onChange> with validation + scanning.
|
|
3
4
|
*/
|
|
4
5
|
export declare function useFileScanner(): {
|
|
5
6
|
results: {
|
|
6
7
|
file: File;
|
|
7
|
-
|
|
8
|
+
report: ScanReport;
|
|
8
9
|
}[];
|
|
9
10
|
errors: {
|
|
10
11
|
file: File;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pompelmi",
|
|
3
|
-
"version": "0.15.0-dev.
|
|
3
|
+
"version": "0.15.0-dev.28",
|
|
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.js",
|
|
6
6
|
"module": "dist/pompelmi.esm.js",
|