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(protector): enforce safe output path checks before writing protected artifacts

qybaihe501c6937750e
diff --git a/src/engine/protector.ts b/src/engine/protector.ts
index 2154ae4..ef27a67 100644
--- a/src/engine/protector.ts
+++ b/src/engine/protector.ts
@@ -8,6 +8,7 @@ import {
} from "node:fs";
import { basename, dirname, extname, join, resolve } from "node:path";
import { detectArtifactFormat } from "../core/detector.js";
+import { assertSafeOutputPath } from "../core/output-path.js";
import { SeededPrng } from "../core/prng.js";
import type {
ProtectionMetrics,
@@ -58,6 +59,12 @@ export function protectTarget(options: ProtectionOptions): ProtectionResult {
const absOutput = resolve(
options.outputPath ?? deriveDefaultOutputPath(absInput, options.inPlace),
);
+ assertSafeOutputPath(
+ absInput,
+ absOutput,
+ format === "directory",
+ options.inPlace,
+ );
if (format !== "directory") {
mkdirSync(dirname(absOutput), { recursive: true });