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.

1.2 KB
Raw Blame
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);
  });
});