pompelmi 0.35.4 → 1.0.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.
Files changed (133) hide show
  1. package/.claude/settings.local.json +40 -0
  2. package/LICENSE +12 -18
  3. package/README.md +160 -143
  4. package/eslint.config.mjs +8 -0
  5. package/package.json +26 -251
  6. package/src/ClamAVDatabaseUpdater.js +48 -0
  7. package/src/ClamAVInstaller.js +49 -0
  8. package/src/ClamAVScanner.js +31 -0
  9. package/src/InstallerCommand.js +11 -0
  10. package/src/config.js +22 -0
  11. package/src/constants.js +3 -0
  12. package/src/favicon.ico +0 -0
  13. package/src/grapefruit.png +0 -0
  14. package/src/index.js +5 -0
  15. package/CHANGELOG.md +0 -71
  16. package/dist/pompelmi.audit.cjs +0 -128
  17. package/dist/pompelmi.audit.cjs.map +0 -1
  18. package/dist/pompelmi.audit.esm.js +0 -107
  19. package/dist/pompelmi.audit.esm.js.map +0 -1
  20. package/dist/pompelmi.browser.cjs +0 -1493
  21. package/dist/pompelmi.browser.cjs.map +0 -1
  22. package/dist/pompelmi.browser.esm.js +0 -1467
  23. package/dist/pompelmi.browser.esm.js.map +0 -1
  24. package/dist/pompelmi.cjs +0 -2535
  25. package/dist/pompelmi.cjs.map +0 -1
  26. package/dist/pompelmi.esm.js +0 -2469
  27. package/dist/pompelmi.esm.js.map +0 -1
  28. package/dist/pompelmi.hooks.cjs +0 -75
  29. package/dist/pompelmi.hooks.cjs.map +0 -1
  30. package/dist/pompelmi.hooks.esm.js +0 -72
  31. package/dist/pompelmi.hooks.esm.js.map +0 -1
  32. package/dist/pompelmi.policy-packs.cjs +0 -240
  33. package/dist/pompelmi.policy-packs.cjs.map +0 -1
  34. package/dist/pompelmi.policy-packs.esm.js +0 -232
  35. package/dist/pompelmi.policy-packs.esm.js.map +0 -1
  36. package/dist/pompelmi.quarantine.cjs +0 -317
  37. package/dist/pompelmi.quarantine.cjs.map +0 -1
  38. package/dist/pompelmi.quarantine.esm.js +0 -293
  39. package/dist/pompelmi.quarantine.esm.js.map +0 -1
  40. package/dist/pompelmi.react.cjs +0 -1524
  41. package/dist/pompelmi.react.cjs.map +0 -1
  42. package/dist/pompelmi.react.esm.js +0 -1497
  43. package/dist/pompelmi.react.esm.js.map +0 -1
  44. package/dist/types/audit.d.ts +0 -84
  45. package/dist/types/browser-index.d.ts +0 -29
  46. package/dist/types/config.d.ts +0 -143
  47. package/dist/types/engines/dynamic-taint.d.ts +0 -102
  48. package/dist/types/engines/hybrid-orchestrator.d.ts +0 -65
  49. package/dist/types/engines/hybrid-taint-integration.d.ts +0 -129
  50. package/dist/types/engines/taint-policies.d.ts +0 -84
  51. package/dist/types/hipaa-compliance.d.ts +0 -110
  52. package/dist/types/hooks.d.ts +0 -89
  53. package/dist/types/index.d.ts +0 -29
  54. package/dist/types/magic.d.ts +0 -7
  55. package/dist/types/node/scanDir.d.ts +0 -30
  56. package/dist/types/policy-packs.d.ts +0 -98
  57. package/dist/types/policy.d.ts +0 -12
  58. package/dist/types/presets.d.ts +0 -72
  59. package/dist/types/quarantine/index.d.ts +0 -18
  60. package/dist/types/quarantine/storage.d.ts +0 -77
  61. package/dist/types/quarantine/types.d.ts +0 -78
  62. package/dist/types/quarantine/workflow.d.ts +0 -97
  63. package/dist/types/react-index.d.ts +0 -13
  64. package/dist/types/risk.d.ts +0 -18
  65. package/dist/types/scan/remote.d.ts +0 -12
  66. package/dist/types/scan.d.ts +0 -17
  67. package/dist/types/scanners/common-heuristics.d.ts +0 -14
  68. package/dist/types/scanners/zip-bomb-guard.d.ts +0 -9
  69. package/dist/types/scanners/zipTraversalGuard.d.ts +0 -19
  70. package/dist/types/src/audit.d.ts +0 -84
  71. package/dist/types/src/browser-index.d.ts +0 -29
  72. package/dist/types/src/config.d.ts +0 -143
  73. package/dist/types/src/engines/dynamic-taint.d.ts +0 -102
  74. package/dist/types/src/engines/hybrid-orchestrator.d.ts +0 -65
  75. package/dist/types/src/engines/hybrid-taint-integration.d.ts +0 -129
  76. package/dist/types/src/engines/taint-policies.d.ts +0 -84
  77. package/dist/types/src/hipaa-compliance.d.ts +0 -110
  78. package/dist/types/src/hooks.d.ts +0 -89
  79. package/dist/types/src/index.d.ts +0 -29
  80. package/dist/types/src/magic.d.ts +0 -7
  81. package/dist/types/src/node/scanDir.d.ts +0 -30
  82. package/dist/types/src/policy-packs.d.ts +0 -98
  83. package/dist/types/src/policy.d.ts +0 -12
  84. package/dist/types/src/presets.d.ts +0 -72
  85. package/dist/types/src/quarantine/index.d.ts +0 -18
  86. package/dist/types/src/quarantine/storage.d.ts +0 -77
  87. package/dist/types/src/quarantine/types.d.ts +0 -78
  88. package/dist/types/src/quarantine/workflow.d.ts +0 -97
  89. package/dist/types/src/react-index.d.ts +0 -13
  90. package/dist/types/src/risk.d.ts +0 -18
  91. package/dist/types/src/scan/remote.d.ts +0 -12
  92. package/dist/types/src/scan.d.ts +0 -17
  93. package/dist/types/src/scanners/common-heuristics.d.ts +0 -14
  94. package/dist/types/src/scanners/zip-bomb-guard.d.ts +0 -9
  95. package/dist/types/src/scanners/zipTraversalGuard.d.ts +0 -19
  96. package/dist/types/src/stream.d.ts +0 -10
  97. package/dist/types/src/types/decompilation.d.ts +0 -96
  98. package/dist/types/src/types/taint-tracking.d.ts +0 -495
  99. package/dist/types/src/types.d.ts +0 -48
  100. package/dist/types/src/useFileScanner.d.ts +0 -15
  101. package/dist/types/src/utils/advanced-detection.d.ts +0 -21
  102. package/dist/types/src/utils/batch-scanner.d.ts +0 -62
  103. package/dist/types/src/utils/cache-manager.d.ts +0 -95
  104. package/dist/types/src/utils/export.d.ts +0 -51
  105. package/dist/types/src/utils/performance-metrics.d.ts +0 -68
  106. package/dist/types/src/utils/threat-intelligence.d.ts +0 -96
  107. package/dist/types/src/validate.d.ts +0 -7
  108. package/dist/types/src/verdict.d.ts +0 -2
  109. package/dist/types/src/yara/browser.d.ts +0 -7
  110. package/dist/types/src/yara/index.d.ts +0 -17
  111. package/dist/types/src/yara/node.d.ts +0 -2
  112. package/dist/types/src/yara/remote.d.ts +0 -10
  113. package/dist/types/src/yara-bridge.d.ts +0 -3
  114. package/dist/types/src/zip.d.ts +0 -13
  115. package/dist/types/stream.d.ts +0 -10
  116. package/dist/types/types/decompilation.d.ts +0 -96
  117. package/dist/types/types/taint-tracking.d.ts +0 -495
  118. package/dist/types/types.d.ts +0 -48
  119. package/dist/types/useFileScanner.d.ts +0 -15
  120. package/dist/types/utils/advanced-detection.d.ts +0 -21
  121. package/dist/types/utils/batch-scanner.d.ts +0 -62
  122. package/dist/types/utils/cache-manager.d.ts +0 -95
  123. package/dist/types/utils/export.d.ts +0 -51
  124. package/dist/types/utils/performance-metrics.d.ts +0 -68
  125. package/dist/types/utils/threat-intelligence.d.ts +0 -96
  126. package/dist/types/validate.d.ts +0 -7
  127. package/dist/types/verdict.d.ts +0 -2
  128. package/dist/types/yara/browser.d.ts +0 -7
  129. package/dist/types/yara/index.d.ts +0 -17
  130. package/dist/types/yara/node.d.ts +0 -2
  131. package/dist/types/yara/remote.d.ts +0 -10
  132. package/dist/types/yara-bridge.d.ts +0 -3
  133. package/dist/types/zip.d.ts +0 -13
@@ -1,95 +0,0 @@
1
- /**
2
- * Cache management system for scan results
3
- * @module utils/cache-manager
4
- */
5
- import type { ScanReport } from "../types";
6
- export interface CacheEntry {
7
- /** Scan report */
8
- report: ScanReport;
9
- /** Timestamp when cached */
10
- timestamp: number;
11
- /** Number of times this entry was accessed */
12
- accessCount: number;
13
- }
14
- export interface CacheOptions {
15
- /** Maximum cache size in number of entries (default: 1000) */
16
- maxSize?: number;
17
- /** Time-to-live in milliseconds (default: 3600000 = 1 hour) */
18
- ttl?: number;
19
- /** Enable LRU eviction (default: true) */
20
- enableLRU?: boolean;
21
- /** Enable cache statistics (default: false) */
22
- enableStats?: boolean;
23
- }
24
- export interface CacheStats {
25
- /** Total cache hits */
26
- hits: number;
27
- /** Total cache misses */
28
- misses: number;
29
- /** Current cache size */
30
- size: number;
31
- /** Hit rate percentage */
32
- hitRate: number;
33
- /** Total evictions */
34
- evictions: number;
35
- }
36
- /**
37
- * LRU cache for scan results with TTL support
38
- */
39
- export declare class ScanCacheManager {
40
- private cache;
41
- private readonly maxSize;
42
- private readonly ttl;
43
- private readonly enableLRU;
44
- private readonly enableStats;
45
- private stats;
46
- constructor(options?: CacheOptions);
47
- /**
48
- * Generate cache key from file content
49
- */
50
- private generateKey;
51
- /**
52
- * Check if cache entry is still valid
53
- */
54
- private isValid;
55
- /**
56
- * Evict oldest or least-used entry when cache is full
57
- */
58
- private evict;
59
- /**
60
- * Store scan result in cache
61
- */
62
- set(content: Uint8Array, report: ScanReport, preset?: string): void;
63
- /**
64
- * Retrieve scan result from cache
65
- */
66
- get(content: Uint8Array, preset?: string): ScanReport | null;
67
- /**
68
- * Check if result exists in cache
69
- */
70
- has(content: Uint8Array, preset?: string): boolean;
71
- /**
72
- * Clear entire cache
73
- */
74
- clear(): void;
75
- /**
76
- * Remove expired entries
77
- */
78
- prune(): number;
79
- /**
80
- * Get cache statistics
81
- */
82
- getStats(): CacheStats;
83
- /**
84
- * Get current cache size
85
- */
86
- get size(): number;
87
- }
88
- /**
89
- * Get or create the default cache instance
90
- */
91
- export declare function getDefaultCache(options?: CacheOptions): ScanCacheManager;
92
- /**
93
- * Reset the default cache instance
94
- */
95
- export declare function resetDefaultCache(): void;
@@ -1,51 +0,0 @@
1
- /**
2
- * Export utilities for scan results
3
- * @module utils/export
4
- */
5
- import type { ScanReport } from "../types";
6
- export type ExportFormat = "json" | "csv" | "markdown" | "html" | "sarif";
7
- export interface ExportOptions {
8
- /** Include detailed match information */
9
- includeDetails?: boolean;
10
- /** Include performance metrics if available */
11
- includeMetrics?: boolean;
12
- /** Pretty print JSON output */
13
- prettyPrint?: boolean;
14
- }
15
- /**
16
- * Export scan results to various formats
17
- */
18
- export declare class ScanResultExporter {
19
- /**
20
- * Export to JSON format
21
- */
22
- toJSON(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
23
- /**
24
- * Export to CSV format
25
- */
26
- toCSV(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
27
- /**
28
- * Export to Markdown format
29
- */
30
- toMarkdown(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
31
- /**
32
- * Export to SARIF format (Static Analysis Results Interchange Format)
33
- * Useful for CI/CD integration
34
- */
35
- toSARIF(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
36
- /**
37
- * Export to HTML format
38
- */
39
- toHTML(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
40
- /**
41
- * Export to specified format
42
- */
43
- export(reports: ScanReport | ScanReport[], format: ExportFormat, options?: ExportOptions): string;
44
- private escapeCsv;
45
- private escapeHtml;
46
- private formatBytes;
47
- }
48
- /**
49
- * Quick export helper
50
- */
51
- export declare function exportScanResults(reports: ScanReport | ScanReport[], format: ExportFormat, options?: ExportOptions): string;
@@ -1,68 +0,0 @@
1
- /**
2
- * Performance monitoring utilities for pompelmi scans
3
- * @module utils/performance-metrics
4
- */
5
- export interface PerformanceMetrics {
6
- /** Total scan duration in milliseconds */
7
- totalDurationMs: number;
8
- /** Time spent in heuristic analysis */
9
- heuristicsDurationMs?: number;
10
- /** Time spent in YARA scanning */
11
- yaraDurationMs?: number;
12
- /** Time spent reading/preparing file */
13
- prepDurationMs?: number;
14
- /** Throughput in bytes per second */
15
- throughputBps?: number;
16
- /** Number of bytes scanned */
17
- bytesScanned: number;
18
- /** Timestamp when scan started */
19
- startedAt: number;
20
- /** Timestamp when scan completed */
21
- completedAt: number;
22
- }
23
- export interface ScanStatistics {
24
- /** Total number of scans performed */
25
- totalScans: number;
26
- /** Number of clean files */
27
- cleanCount: number;
28
- /** Number of suspicious files */
29
- suspiciousCount: number;
30
- /** Number of malicious files */
31
- maliciousCount: number;
32
- /** Average scan duration */
33
- avgDurationMs: number;
34
- /** Average throughput */
35
- avgThroughputBps: number;
36
- /** Total bytes scanned */
37
- totalBytesScanned: number;
38
- }
39
- /**
40
- * Track performance metrics for a scan operation
41
- */
42
- export declare class PerformanceTracker {
43
- private startTime;
44
- private checkpoints;
45
- constructor();
46
- /**
47
- * Mark a checkpoint in the scan process
48
- */
49
- checkpoint(name: string): void;
50
- /**
51
- * Get duration since start or since a specific checkpoint
52
- */
53
- getDuration(since?: string): number;
54
- /**
55
- * Generate final metrics report
56
- */
57
- getMetrics(bytesScanned: number): PerformanceMetrics;
58
- }
59
- /**
60
- * Aggregate statistics from multiple scan reports
61
- */
62
- export declare function aggregateScanStats(reports: Array<{
63
- verdict: string;
64
- durationMs?: number;
65
- file?: {
66
- size?: number;
67
- };
68
- }>): ScanStatistics;
@@ -1,96 +0,0 @@
1
- /**
2
- * Threat intelligence integration and enhanced detection
3
- * @module utils/threat-intelligence
4
- */
5
- import type { ScanReport } from "../types";
6
- export interface ThreatIntelligenceSource {
7
- /** Source name */
8
- name: string;
9
- /** Check if hash is known malicious */
10
- checkHash: (hash: string) => Promise<ThreatInfo | null>;
11
- }
12
- export interface ThreatInfo {
13
- /** Threat level (0-100) */
14
- threatLevel: number;
15
- /** Threat category */
16
- category: string;
17
- /** Source of the intelligence */
18
- source: string;
19
- /** Additional metadata */
20
- metadata?: Record<string, unknown>;
21
- /** Detection timestamp */
22
- detectedAt?: Date;
23
- }
24
- export interface EnhancedScanReport {
25
- /** Threat intelligence findings */
26
- threatIntel?: ThreatInfo[];
27
- /** File hash (SHA-256) */
28
- fileHash?: string;
29
- /** Risk score (0-100) */
30
- riskScore?: number;
31
- /** Include all properties from ScanReport */
32
- verdict: import("../types").Verdict;
33
- matches: import("../types").YaraMatch[];
34
- reasons?: string[];
35
- file?: import("../types").FileInfo;
36
- durationMs?: number;
37
- error?: string;
38
- ok: boolean;
39
- truncated?: boolean;
40
- timedOut?: boolean;
41
- engine?: string;
42
- }
43
- /**
44
- * Built-in threat intelligence - known malware hashes
45
- * In production, this would connect to real threat intel APIs
46
- */
47
- export declare class LocalThreatIntelligence implements ThreatIntelligenceSource {
48
- name: string;
49
- private knownThreats;
50
- constructor();
51
- private initializeKnownThreats;
52
- checkHash(hash: string): Promise<ThreatInfo | null>;
53
- /**
54
- * Add a known threat to the local database
55
- */
56
- addThreat(hash: string, info: ThreatInfo): void;
57
- /**
58
- * Remove a threat from the local database
59
- */
60
- removeThreat(hash: string): boolean;
61
- /**
62
- * Get all known threats
63
- */
64
- getAllThreats(): Map<string, ThreatInfo>;
65
- }
66
- /**
67
- * Threat intelligence aggregator
68
- */
69
- export declare class ThreatIntelligenceAggregator {
70
- private sources;
71
- constructor(sources?: ThreatIntelligenceSource[]);
72
- /**
73
- * Add a threat intelligence source
74
- */
75
- addSource(source: ThreatIntelligenceSource): void;
76
- /**
77
- * Check file hash against all sources
78
- */
79
- checkHash(hash: string): Promise<ThreatInfo[]>;
80
- /**
81
- * Enhance scan report with threat intelligence
82
- */
83
- enhanceScanReport(content: Uint8Array, report: ScanReport): Promise<EnhancedScanReport>;
84
- /**
85
- * Calculate overall risk score based on scan results and threat intel
86
- */
87
- private calculateRiskScore;
88
- }
89
- /**
90
- * Create default threat intelligence aggregator
91
- */
92
- export declare function createThreatIntelligence(): ThreatIntelligenceAggregator;
93
- /**
94
- * Helper to get file hash
95
- */
96
- export declare function getFileHash(content: Uint8Array): string;
@@ -1,7 +0,0 @@
1
- /**
2
- * Validates a File by MIME type and size (max 5 MB).
3
- */
4
- export declare function validateFile(file: File): {
5
- valid: boolean;
6
- error?: string;
7
- };
@@ -1,2 +0,0 @@
1
- import type { Verdict, YaraMatch } from "./types";
2
- export declare function mapMatchesToVerdict(matches?: YaraMatch[]): Verdict;
@@ -1,7 +0,0 @@
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>;
@@ -1,17 +0,0 @@
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";
@@ -1,2 +0,0 @@
1
- import type { YaraEngine } from "./index";
2
- export declare function createNodeEngine(): Promise<YaraEngine>;
@@ -1,10 +0,0 @@
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>;
@@ -1,3 +0,0 @@
1
- export declare function createScanner(rulesPath?: string): {
2
- scan(bytes: Uint8Array): Promise<unknown>;
3
- };
@@ -1,13 +0,0 @@
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>;