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.

fix(harden): attribute blocked-run failures to the artifact that tripped the gate

DeryFerdd1dc84136e91
diff --git a/src/engine/harden.ts b/src/engine/harden.ts
index 971c3a4..01b88ca 100644
--- a/src/engine/harden.ts
+++ b/src/engine/harden.ts
@@ -603,26 +603,31 @@ export function hardenProject(
if (blockingJsHydrateDump.length > 0) blockParts.push("JS WASM hydrate param-dump");
if (blockingWasmXorMask.length > 0) blockParts.push("WASM XOR-mask sidecar");
if (blockingWasmSealXor.length > 0) blockParts.push("WASM seal.revision XOR known-plaintext");
- const blockReason = `skipped: ${blockParts.join(" / ")} blocked bankrupt harden`;
const blockedExtras = [...sealArtifacts, ...wasmArtifacts, ...jsAesArtifacts, ...jsHydrateDumpArtifacts, ...wasmXorMaskArtifacts, ...wasmSealXorArtifacts];
+ // Attribute the specific refusal to the artifact that triggered the gate;
+ // every other planned artifact is skipped because the run was blocked.
+ const refusalByPath = new Map(
+ blockedExtras.map((artifact) => [resolve(artifact.inputPath), artifact.error]),
+ );
+ const planned = plannedOutputs.map(({ artifact, outputPath, outputExisted }) => ({
+ inputPath: artifact.path,
+ relativePath: artifact.relativePath,
+ format: artifact.format,
+ outputPath,
+ success: false,
+ defenseScore: 0,
+ tokenAmplificationFactor: 0,
+ costAmplificationFactor: 0,
+ outputExisted,
+ error: refusalByPath.get(resolve(artifact.path)) ?? `skipped: run blocked by ${blockParts.join(" / ")}`,
+ }));
return {
...reportBase,
overallSuccess: false,
hardenedCount: 0,
- failedCount: blockedExtras.length,
+ failedCount: planned.length + blockedExtras.length,
artifacts: [
- ...plannedOutputs.map(({ artifact, outputPath, outputExisted }) => ({
- inputPath: artifact.path,
- relativePath: artifact.relativePath,
- format: artifact.format,
- outputPath,
- success: false,
- defenseScore: 0,
- tokenAmplificationFactor: 0,
- costAmplificationFactor: 0,
- outputExisted,
- error: blockReason,
- })),
+ ...planned,
...blockedExtras,
],
};
diff --git a/tests/seal-commitment-harden-gate.test.ts b/tests/seal-commitment-harden-gate.test.ts
index a2dc603..2b29913 100644
--- a/tests/seal-commitment-harden-gate.test.ts
+++ b/tests/seal-commitment-harden-gate.test.ts
@@ -53,6 +53,14 @@ describe("harden/protect seal-sidecar gate (red-blue round-2 P1)", () => {
(a) => a.error && /allowPlaintextSeal|plaintext\/reversible seal|reversible/i.test(a.error),
),
).toBe(true);
+ // Per-artifact attribution: the blocker carries its specific refusal, an
+ // unrelated planned artifact says the run was blocked, and every artifact
+ // is counted as failed.
+ const blocker = report.artifacts.find((a) => a.inputPath.endsWith("seal.json"));
+ const planned = report.artifacts.find((a) => a.inputPath.endsWith("gate.js"));
+ expect(blocker?.error).toMatch(/reversible|plaintext/i);
+ expect(planned?.error).toMatch(/run blocked by/);
+ expect(report.failedCount).toBe(report.artifacts.length);
});
it("bankrupt harden allows one-way sha256 seal.json", () => {