🛡️ 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
feat(cli): gate bla audit exit code on --fail-under exposure threshold
DeryFerdfee5627b8e78
diff --git a/src/cli.ts b/src/cli.tsindex 1cb5a1d..0b35c6c 100644--- a/src/cli.ts+++ b/src/cli.ts@@ -73,6 +73,7 @@ Options:--self-seal Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5); OFF by default--wasm-preserve-exports <a,b> Comma-separated WASM export names to keep as public ABI (issue #40.3)--lang <c|rust|go> Target language for emit-headers (default: c)+ --fail-under <n> Exit 2 when the score fails the gate: defense score < n (defend/verify) or audit exposure score > n (audit)--client <id> Agent client ID for setup (repeatable: claude_code, cursor, codex, etc.)--all-detected Configure all detected coding agents on this machine--dry-run Preview planned setup changes without writing files@@ -438,6 +439,11 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P} else {console.log(formatAuditReport(report));}+ // CI gating parity with defend/verify: exposureScore is 0 (fully shielded)+ // to 100 (completely exposed), so fail when it exceeds the threshold.+ if (parsed.failUnder !== undefined && report.exposureScore > parsed.failUnder) {+ return 2;+ }return 0;}diff --git a/tests/cli-audit-fail-under.test.ts b/tests/cli-audit-fail-under.test.tsnew file mode 100644index 0000000..47be391--- /dev/null+++ b/tests/cli-audit-fail-under.test.ts@@ -0,0 +1,23 @@+import * as fs from "node:fs";+import * as os from "node:os";+import * as path from "node:path";+import { describe, expect, it } from "vitest";+import { runCli } from "../src/cli.js";++describe("bla audit --fail-under", () => {+ it("exits 2 when audit exposure exceeds the threshold and 0 when within", async () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "bla-audit-fail-under-"));+ const target = path.join(dir, "app.js");+ fs.writeFileSync(target, "export const value = 42;\n", "utf8");+ try {+ // Unprotected artifact: exit code stays 0 without an explicit gate.+ expect(await runCli(["audit", target])).toBe(0);+ // A threshold of 100 accepts any exposure score (0..100 inclusive).+ expect(await runCli(["audit", target, "--fail-under", "100"])).toBe(0);+ // A threshold of 0 fails any target that still exposes attack surface.+ expect(await runCli(["audit", target, "--fail-under", "0"])).toBe(2);+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+ });+});