Skip to content

armgit / bla

Public Imported from GitHub
0

🛡️ 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.

test(formats): verify Apple XML plist internal subset trap and .NET decode budget

qybaihe9ae02d369d86
diff --git a/tests/apple-plist-dotnet-shield.test.ts b/tests/apple-plist-dotnet-shield.test.ts
new file mode 100644
index 0000000..adcb836
--- /dev/null
+++ b/tests/apple-plist-dotnet-shield.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from "vitest";
+import { SeededPrng } from "../src/core/prng.js";
+import { protectAppleXmlPlist } from "../src/shields/formats/apple-plist.js";
+import { planDotnetManagedBudgetExhaustion } from "../src/shields/formats/dotnet-managed.js";
+
+describe("Apple PropertyList & .NET Managed Metadata Shields", () => {
+ it("injects empty DOCTYPE internal subset [] into XML plist to trigger REA PropertyListDecodeBudgetFailure", () => {
+ const raw = `<?xml version="1.0" encoding="UTF-8"?>
+<plist version="1.0">
+<dict>
+ <key>CFBundleName</key>
+ <string>MyApp</string>
+</dict>
+</plist>`;
+ const res = protectAppleXmlPlist(raw, { seed: "plist-seed" });
+ expect(res.triggersInternalSubsetBudgetAbort).toBe(true);
+ expect(res.xmlPlist).toContain("<!DOCTYPE plist");
+ expect(res.xmlPlist).toContain("[]>");
+ expect(res.xmlPlist).toContain("BLAEnclaveAttestationAuthority");
+ });
+
+ it("models .NET ManagedDecodeBudget row (256B) and string (6x + 2) charges", () => {
+ const plan = planDotnetManagedBudgetExhaustion(
+ new SeededPrng("dotnet-seed"),
+ "bankrupt",
+ );
+ expect(plan.decoyPInvokeImports).toHaveLength(16);
+ expect(plan.totalReaRepresentationChargeBytes).toBeGreaterThan(2_000_000);
+ });
+});