🛡️ 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(self-seal): hard-fail when an expected sibling is missing
DeryFerdf1cb6417a32b
diff --git a/src/shields/runtime/self-seal.ts b/src/shields/runtime/self-seal.tsindex c091e3a..442bf04 100644--- a/src/shields/runtime/self-seal.ts+++ b/src/shields/runtime/self-seal.ts@@ -254,6 +254,13 @@ function emitMeasureFunction(lines.push(` if (_e2 && _e2.message === "integrity check failed") throw _e2;`,);+ if (hardFailOnSiblingMismatch) {+ // A missing sibling is a failed integrity invariant, not a benign state:+ // otherwise deleting the anchor file silently downgrades the hard-fail check.+ lines.push(+ ` if (expected[String(siblings[i])]) throw new Error("integrity check failed");`,+ );+ }lines.push(` h.update("missing:" + String(siblings[i]));`);lines.push(` }`);lines.push(` }`);diff --git a/tests/self-seal.test.ts b/tests/self-seal.test.tsindex 69164b4..96d32bb 100644--- a/tests/self-seal.test.ts+++ b/tests/self-seal.test.ts@@ -193,6 +193,45 @@ describe("self-seal helper (#40.5)", () => {expect(snip.code).toContain("a".repeat(64));});+ it("protect+self-seal hard-fails when an expected sibling is deleted", () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-selfseal-missing-"));+ try {+ const sib = join(dir, "core.wasm");+ writeFileSync(sib, Buffer.from([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0xaa]));+ const src = [+ '"use strict";',+ "function main() { return 42; }",+ "module.exports = { main };",+ 'if (require.main === module) console.log(main());',+ "",+ ].join("\n");+ const entry = join(dir, "gate.cjs");+ writeFileSync(entry, src, "utf8");++ const out = join(dir, "gate.out.cjs");+ protectTarget({+ inputPath: entry,+ outputPath: out,+ intensity: "balanced",+ seed: "self-seal-missing-protect",+ selfSeal: true,+ selfSealSiblingPaths: ["core.wasm"],+ });++ const intact = spawnSync(process.execPath, [out], { encoding: "utf8" });+ expect(intact.status, intact.stderr).toBe(0);++ rmSync(sib, { force: true });+ const deleted = spawnSync(process.execPath, [out], { encoding: "utf8" });+ expect(deleted.status, deleted.stdout + deleted.stderr).not.toBe(0);+ expect((deleted.stderr || "") + (deleted.stdout || "")).toMatch(+ /integrity check failed/,+ );+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ });+it("protect+self-seal hard-fails when an on-disk sibling is tampered", () => {const dir = mkdtempSync(join(tmpdir(), "bla-selfseal-hf-"));try {