🛡️ 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(jvm): stop reporting constant-pool metrics for trailer-only output
DeryFerd2295f2d34f55
diff --git a/src/shields/formats/jvm-bytecode.ts b/src/shields/formats/jvm-bytecode.tsindex a65f314..eb98cf5 100644--- a/src/shields/formats/jvm-bytecode.ts+++ b/src/shields/formats/jvm-bytecode.ts@@ -5,6 +5,13 @@ import { buildCanaryAndDiagnosticPayloads } from "../deception/format-payloads.jexport interface JvmClassProtectionResult {readonly buffer: Buffer;+ /**+ * `structural` means the constant pool and a class attribute were rewritten+ * inside a valid class layout. `trailer` means the input was not structurally+ * parseable and the canary corpus was appended after the class bytes, so no+ * constant-pool or attribute entries were actually added.+ */+ readonly mode: "structural" | "trailer";readonly constantPoolEntriesAdded: number;readonly customAttributesAdded: number;readonly chaffPayloadsEmbedded: number;@@ -140,6 +147,7 @@ export function protectJvmClassBuffer(return {buffer: Buffer.concat([headerAndOldCp, ...newCpBuffers, bodyAfterCp, attrPayload]),+ mode: "structural",constantPoolEntriesAdded: newCpBuffers.length,customAttributesAdded: 1,chaffPayloadsEmbedded: chaff.length,@@ -157,8 +165,11 @@ export function protectJvmClassBuffer();return {buffer: Buffer.concat([rawBuffer, trailer]),- constantPoolEntriesAdded: utf8Strings.length,- customAttributesAdded: 1,+ mode: "trailer",+ // Nothing was added to the constant pool or attribute table; the canary+ // corpus lives in an appended trailer outside the class structure.+ constantPoolEntriesAdded: 0,+ customAttributesAdded: 0,chaffPayloadsEmbedded: chaff.length,canaryTokensEmbedded: deception.canary.syntheticCanaryTokens.length,diagnosticsEmbedded: deception.diagnostics.diagnosticsInjected.length,diff --git a/tests/format-canary-coverage.test.ts b/tests/format-canary-coverage.test.tsindex b469731..5115d22 100644--- a/tests/format-canary-coverage.test.ts+++ b/tests/format-canary-coverage.test.ts@@ -72,11 +72,26 @@ describe("Canary + system-diagnostic coverage on remaining formats", () => {cls.writeUInt16BE(55, 6); // majorcls.writeUInt16BE(1, 8); // cp countconst res = protectJvmClassBuffer(cls, { intensity: "balanced", seed: "jvm-canary" });+ expect(res.mode).toBe("trailer");+ expect(res.constantPoolEntriesAdded).toBe(0);+ expect(res.customAttributesAdded).toBe(0);expect(res.canaryTokensEmbedded).toBeGreaterThan(0);expect(res.diagnosticsEmbedded).toBeGreaterThan(0);expect(res.buffer.toString("latin1")).toContain("PROTECTED_CANARY_CREDENTIAL=");});+ it("reports structural constant-pool injection only for a parseable class layout", () => {+ const cls = Buffer.alloc(26, 0);+ cls.writeUInt32BE(0xcafebabe, 0);+ cls.writeUInt16BE(0, 4);+ cls.writeUInt16BE(55, 6);+ cls.writeUInt16BE(1, 8); // empty constant pool+ const res = protectJvmClassBuffer(cls, { intensity: "balanced", seed: "jvm-structural" });+ expect(res.mode).toBe("structural");+ expect(res.constantPoolEntriesAdded).toBeGreaterThan(0);+ expect(res.customAttributesAdded).toBe(1);+ });+it("embeds canary decoys into ZIP members and recursively hardens nested DEX", () => {const dex = Buffer.alloc(112, 0);dex.write("dex\n035\0", 0, "ascii");