/** * Skills-guard threat pattern table — verbatim TypeScript port of * Hermes `tools/skills_guard.py::THREAT_PATTERNS` (120 entries). * * Each entry preserves `pattern_id`, `severity`, `category`, and * `description` exactly so the security verdict for a given fixture matches * the Hermes scanner — see {@link ./__tests__/skills-guard.test.ts} for the * parity test that asserts this invariant. * * Pattern source-of-truth: `/mnt/projects/hermes-agent/tools/skills_guard.py` * lines 86–488 (commit pinned in ADR-075). When Hermes adds a pattern, port * it here byte-for-byte and bump the table version in tests. * * @task T9730 * @epic T9564 * @saga T9560 */ /** * Severity assigned to a single regex hit. * * Critical findings always force a `dangerous` overall verdict; high findings * force `caution`; medium/low never escalate alone. Mirrors the Hermes * `_determine_verdict` rule. */ export type FindingSeverity = 'critical' | 'high' | 'medium' | 'low'; /** * Threat category for a finding. * * Categories match Hermes — when adding a new pattern, prefer reusing one of * these labels rather than inventing a new bucket so the CLI report stays * grep-able across both implementations. */ export type FindingCategory = 'exfiltration' | 'injection' | 'destructive' | 'persistence' | 'network' | 'obfuscation' | 'execution' | 'traversal' | 'mining' | 'supply_chain' | 'privilege_escalation' | 'credential_exposure' | 'structural'; /** * One entry in the threat-pattern table. * * The regex is compiled at scan time with the `i` flag (case-insensitive), * matching the Hermes call site `re.search(pattern, line, re.IGNORECASE)`. */ export interface ThreatPattern { /** Stable identifier — used by tests + audit logs. */ readonly patternId: string; /** Regex source (no flags — `i` is applied by the scanner). */ readonly regex: RegExp; /** Severity assigned to any line that matches `regex`. */ readonly severity: FindingSeverity; /** Threat category. */ readonly category: FindingCategory; /** Human-readable description rendered in scan reports. */ readonly description: string; } /** * Complete 120-pattern threat table, ordered identically to the Hermes source * so a parity diff between the two implementations is a stable, reviewable * artifact. */ export declare const THREAT_PATTERNS: readonly ThreatPattern[]; /** * Structural limits for skill directories. Identical to the Hermes constants * `MAX_FILE_COUNT`, `MAX_TOTAL_SIZE_KB`, `MAX_SINGLE_FILE_KB`. */ export declare const STRUCTURAL_LIMITS: { /** Skills shouldn't have 50+ files. */ readonly maxFileCount: 50; /** 1 MB total is suspicious for a skill. */ readonly maxTotalSizeKb: 1024; /** Individual file > 256 KB is suspicious. */ readonly maxSingleFileKb: 256; }; /** * Text-file extensions the scanner inspects. Other suffixes are skipped so * binary blobs never blow up the regex engine. */ export declare const SCANNABLE_EXTENSIONS: ReadonlySet; /** * File extensions that should never be present inside a skill bundle. * Triggers a `binary_file` finding when encountered. */ export declare const SUSPICIOUS_BINARY_EXTENSIONS: ReadonlySet; /** * Zero-width and bi-di unicode characters that have been used to smuggle * hidden instructions into otherwise innocuous-looking skill markdown. * * Same set as `INVISIBLE_CHARS` in `skills_guard.py`. */ export declare const INVISIBLE_CHARS: ReadonlyArray<{ char: string; name: string; }>; //# sourceMappingURL=skills-guard-patterns.d.ts.map