π‘οΈ BLA (Blind LLM Agents) β Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, and WebAssembly against AI reverse-engineering agents like REA. Poison -> Exhaust -> Hallucinate.
JavaScript adversarial-aiclaude-codecursorelectron-securityllm-securitymcpmcp-serverobfuscationreverse-engineeringwebassembly
fix(engine): surface silent inline-script shield failures in HTML bundles (#60)
Dery Ferdika2af91b116df0
diff --git a/src/core/types.ts b/src/core/types.tsindex 2fcd0e2..765756b 100644--- a/src/core/types.ts+++ b/src/core/types.ts@@ -175,6 +175,8 @@ export interface ProtectionMetrics {readonly decoyRoutesInjected: number;readonly chaffPayloadsEmbedded: number;readonly honeySourceMapsGenerated: number;+ /** Inline `<script>` bodies the AST shield threw on and shipped unchanged β surfaced so partial HTML protection is never silent. */+ readonly inlineScriptsFailed: number;readonly binarySectionsPatched: number;}diff --git a/src/engine/protector.ts b/src/engine/protector.tsindex e4e31b2..9eb3aa0 100644--- a/src/engine/protector.ts+++ b/src/engine/protector.ts@@ -146,6 +146,8 @@ function protectTargetInner(options: ProtectionOptions): ProtectionResult {let chaffPayloadsEmbedded = 0;let honeySourceMapsGenerated = 0;let binarySectionsPatched = 0;+ /** Inline `<script>` bodies whose AST shield threw and were shipped unchanged. */+ let inlineScriptsFailed = 0;const counteredVectors = new Set<ReaAttackVectorId>();if (format === "javascript" || format === "typescript") {@@ -211,6 +213,10 @@ function protectTargetInner(options: ProtectionOptions): ProtectionResult {chaffPayloadsEmbedded += res.chaffPayloadsEmbedded;return `<script${attrs}>\n${escapeHtmlInlineScriptBody(res.code)}\n</script>`;} catch {+ // Ship the original script rather than dropping it, but count the+ // failure so partial HTML protection is never silent (honesty red+ // line β see STATE.md).+ inlineScriptsFailed++;return fullMatch;}},@@ -614,6 +620,7 @@ function protectTargetInner(options: ProtectionOptions): ProtectionResult {decoyRoutesInjected,chaffPayloadsEmbedded,honeySourceMapsGenerated,+ inlineScriptsFailed,binarySectionsPatched,};diff --git a/src/ui/reporter.ts b/src/ui/reporter.tsindex 01e6d71..41945b4 100644--- a/src/ui/reporter.ts+++ b/src/ui/reporter.ts@@ -120,6 +120,9 @@ export function formatProtectionResult(res: ProtectionResult): string {` β’ Alias Selection States: ${ANSI.bold}${res.metrics.aliasSelectionStatesCreated.toLocaleString()}${ANSI.reset} (> REA's 512 state limit)`,` β’ IPC Ambiguity Sites / Decoy Routes: ${ANSI.bold}${res.metrics.ipcAmbiguitySitesInjected}${ANSI.reset} IPC sites / ${ANSI.bold}${res.metrics.decoyRoutesInjected}${ANSI.reset} decoy routes`,` β’ Enclave Chaff Manifests Embedded: ${ANSI.bold}${res.metrics.chaffPayloadsEmbedded}${ANSI.reset}`,+ ...(res.metrics.inlineScriptsFailed > 0+ ? [` ${ANSI.red}β ${res.metrics.inlineScriptsFailed} inline <script> body(ies) shipped UNPROTECTED (AST shield failed on them)${ANSI.reset}`]+ : []),"",`${ANSI.bold}${ANSI.cyan}ββ Before vs. After BLA Impact (Claude Opus 4 / REA Loop) ββββββββββββββββββββββ${ANSI.reset}`,` β’ REA Exposure Score: ${ANSI.red}${res.beforeAudit.exposureScore}/100 (${res.beforeAudit.protectionStatus})${ANSI.reset} --> ${ANSI.green}${ANSI.bold}${res.afterAudit.exposureScore}/100 (${res.afterAudit.protectionStatus})${ANSI.reset}`,