UNPKG

pompelmi

Version:

RFI-safe file uploads for Node.js — Express/Koa/Next.js middleware with deep ZIP inspection, MIME/size checks, and optional YARA scanning.

50 lines (49 loc) 1.31 kB
/** Shared types for Pompelmi */ export type Verdict = 'clean' | 'suspicious' | 'malicious'; export interface YaraMatch { rule: string; namespace?: string; tags?: string[]; meta?: Record<string, unknown>; } export * from './types/decompilation'; export * from './hipaa-compliance'; export interface Match { rule: string; severity?: 'low' | 'medium' | 'high' | 'critical' | 'suspicious'; meta?: Record<string, unknown>; } export interface FileInfo { name?: string; mimeType?: string; size?: number; sha256?: string; } export type ScanContext = { filename?: string; mimeType?: string; size?: number; }; export type ScanFn = (input: Uint8Array, ctx?: ScanContext) => Promise<Match[]> | Match[]; export type Scanner = ScanFn | { name?: string; scan: ScanFn; }; interface BaseReport { verdict: Verdict; matches: YaraMatch[]; reasons?: string[]; file?: FileInfo; durationMs?: number; error?: string; ok: boolean; truncated?: boolean; timedOut?: boolean; engine?: string; } export interface NormalScanReport extends BaseReport { } export interface StreamScanReport extends BaseReport { } export type ScanReport = NormalScanReport | StreamScanReport; export type Uint8ArrayLike = Uint8Array | ArrayBufferView;