/** * Security Scanner — code-execution & obfuscated-directive detectors * @module @skillsmith/core/security/scanner/SecurityScanner.exec * * SMI-5359 Wave 4.2: two top-tier (categoryWeight 2.0, coefficient 0.40) single- * emission detectors that give the scanner real teeth against supply-chain and * Unicode-concealment attacks the prod edge gate currently scores at ~1 point: * * • code_execution — a skill instructing a remote fetch piped into an * interpreter (curl|bash and friends), or — SMI-6033 Wave 4, Gap 1 — the * same instruction written as free-text prose with no shell syntax at all * ("download the installer from thisurl.com and run it", * `IMPERATIVE_FETCH_EXEC_PROSE` in patterns.exec.ts). Emits ONE medium * finding (score 12, sub-threshold) on its own, whichever pattern set * fired; escalated to critical (score 40, quarantines) only when it * co-occurs with a NON-documentation exfiltration / privilege / * credential-path / obfuscation signal, OR — SMI-6033 Wave 4, Gap 6 — with * TWO DISTINCT high-confidence advisory-tier signals * (`CO_SIGNAL_MIN_SEVERITY` below). The non-doc gate keeps legitimate * security-research skills (which document these techniques inside fenced * examples) below the threshold. * * • obfuscated_directive — a malicious directive concealed with zero-width / * bidi / tag-block / combining characters or homoglyphs (Cyrillic, Greek, * fullwidth-Latin, Mathematical-Alphanumeric) and revealed only after * de-obfuscation. Delta-gated (the directive must NOT be plainly present in * the raw line) and verb+object-anchored (never a bare keyword/noun-phrase), * so benign Cyrillic/Greek/CJK/fullwidth text stays clean. Emits ONE critical * finding (score 40, quarantines alone). A blanket NFKC pass is intentionally * NOT used — it folds fullwidth CJK to ASCII and false-positives; fullwidth * Latin is mapped by offset and NFKC is applied per-char ONLY to the * math-alphanumeric range (which contains no CJK). * NOTE: unlike code_execution, this detector has NO documentation-context * downgrade (findings are always inDocumentationContext:false). A *live* * concealed payload (real invisibles/homoglyphs, not an escaped textual * representation) is an attack even inside a fenced block — there is no * legitimate reason to ship invisible/homoglyph-spliced directives. */ import type { SecurityFinding } from './types.js'; import type { LineContext } from './SecurityScanner.helpers.js'; /** * Remove invisible/format/bidi/tag/combining characters. * * Exported (SMI-4703): reused as-is by the memory-injection-scanner's * normalization pipeline (invisible-strip step) — not reimplemented there. */ export declare function stripInvisible(s: string): string; /** * code_execution: remote fetch piped into an interpreter (literal shell * syntax), OR — SMI-6033 Wave 4, Gap 1 — the same instruction expressed as a * natural-language install-and-run imperative with no shell syntax at all. * * Single-emission — at most one MEDIUM finding per skill (the first match, in * line order), whichever pattern set produced it. escalateCodeExecution() * promotes it to CRITICAL on co-occurrence. * * Ordering is deliberately line-major (each line is tested against the literal * syntax set first, then the prose set, before moving to the next line), so a * document containing only literal-syntax matches produces byte-identical * output to the pre-Gap-1 detector — same line, same message, same severity. * The message names WHICH set fired so a reviewer can tell a prose-triggered * finding from a syntax-triggered one at a glance. */ export declare function scanCodeExecution(content: string, lineContexts?: LineContext[]): SecurityFinding[]; /** * obfuscated_directive: a malicious directive concealed by Unicode obfuscation, * revealed only after de-obfuscation. Single-emission CRITICAL. Delta-gated: a * directive already plainly visible in the raw line is left to the jailbreak / * prompt-leaking detectors. */ export declare function scanObfuscatedDirective(content: string): SecurityFinding[]; export declare function escalateCodeExecution(findings: SecurityFinding[]): void; //# sourceMappingURL=SecurityScanner.exec.d.ts.map