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.

feat(cli): add --self-seal / MCP self_seal / .blarc selfSeal parity (#40.5)

qybaihed2da4114f6fa
diff --git a/src/cli.ts b/src/cli.ts
index 19222b8..38198e6 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -68,6 +68,7 @@ Options:
--manifest Emit unsigned .bla-manifest.json next to protected artifacts (opt-in)
--llm-directives Opt-in risky LLM directive layers (COPPA/medical bait, dual-use imitation, AI chat markers); OFF by default
--weave-decoys Opt-in structural weave decoys (Python customer-def / .pyc co_consts weave; JS AST weave already on); OFF by default
+ --self-seal Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5); OFF by default
--lang <c|rust|go> Target language for emit-headers (default: c)
--client <id> Agent client ID for setup (repeatable: claude_code, cursor, codex, etc.)
--all-detected Configure all detected coding agents on this machine
@@ -90,6 +91,7 @@ interface ParsedCliArgs {
readonly manifest: boolean;
readonly llmDirectives: boolean;
readonly weaveDecoys: boolean;
+ readonly selfSeal: boolean;
readonly lang: NativeHeaderLanguage;
readonly clients: SupportedAgentClientId[];
readonly allDetected: boolean;
@@ -114,6 +116,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {
let manifest = false;
let llmDirectives = false;
let weaveDecoys = false;
+ let selfSeal = false;
let lang: NativeHeaderLanguage = "c";
const clients: SupportedAgentClientId[] = [];
let allDetected = false;
@@ -152,6 +155,8 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {
llmDirectives = true;
} else if (arg === "--weave-decoys") {
weaveDecoys = true;
+ } else if (arg === "--self-seal") {
+ selfSeal = true;
} else if (arg === "--mcp") {
command = "mcp";
} else if (arg === "--update") {
@@ -194,6 +199,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {
manifest,
llmDirectives,
weaveDecoys,
+ selfSeal,
lang,
clients,
allDetected,
@@ -314,6 +320,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P
emitManifest: parsed.manifest || loaded.config.emitManifest === true,
llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true,
weaveDecoys: parsed.weaveDecoys || loaded.config.weaveDecoys === true,
+ selfSeal: parsed.selfSeal || loaded.config.selfSeal === true,
...(parsed.output !== undefined ? { outputDirectory: parsed.output } : {}),
});
if (parsed.json) {
@@ -346,6 +353,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P
emitManifest: parsed.manifest || loaded.config.emitManifest === true,
llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true,
weaveDecoys: parsed.weaveDecoys || loaded.config.weaveDecoys === true,
+ selfSeal: parsed.selfSeal || loaded.config.selfSeal === true,
});
if (parsed.sarif) {
console.log(
@@ -402,6 +410,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P
honeySourceMaps: parsed.honeyMaps,
llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true,
weaveDecoys: parsed.weaveDecoys || loaded.config.weaveDecoys === true,
+ selfSeal: parsed.selfSeal || loaded.config.selfSeal === true,
});
if (parsed.json) console.log(JSON.stringify(res, null, 2));
else console.log(formatProtectionResult(res));
diff --git a/src/core/config.ts b/src/core/config.ts
index 52d83bb..ee0c239 100644
--- a/src/core/config.ts
+++ b/src/core/config.ts
@@ -18,6 +18,8 @@ export interface BlaProjectConfig {
readonly minDefenseScore?: number;
/** Opt-in structural weave decoys (Python customer-def / .pyc co_consts weave; JS AST weave already on). Parity with CLI `--weave-decoys` / MCP `weave_decoys`. */
readonly weaveDecoys?: boolean;
+ /** Opt-in self-seal / sibling-module integrity binding for JS/Node (issue #40.5). Parity with CLI `--self-seal` / MCP `self_seal`. */
+ readonly selfSeal?: boolean;
}
/**
@@ -34,6 +36,7 @@ export const DEFAULT_BLA_CONFIG: BlaProjectConfig = Object.freeze({
honeySourceMaps: true,
minDefenseScore: 90,
weaveDecoys: false,
+ selfSeal: false,
});
/** Legacy fixed seeds that fingerprint every project the same way — never reuse as a default. */
diff --git a/src/mcp/server.ts b/src/mcp/server.ts
index 7dae63e..d4ee58d 100644
--- a/src/mcp/server.ts
+++ b/src/mcp/server.ts
@@ -128,6 +128,11 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([
description:
"Opt-in weave-decoy entanglement: JS AST weave (always) + Python .py customer-def weave + .pyc co_consts TYPE_CODE weave. When false, Python stays warm-init/trailer-only. See bla://directives/weave-decoy. Default false.",
},
+ self_seal: {
+ type: "boolean",
+ description:
+ "Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5). Injects a self-integrity preamble and entangles the opaque-predicate seed. Default false.",
+ },
seed: {
type: "string",
description: "Optional deterministic seed; when omitted, BLA uses/persists a per-project random seed in .blarc",
@@ -169,6 +174,11 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([
description:
"Opt-in weave-decoy entanglement (shared-state / entry-reachable decoys into customer paths; not dismissible noise). Python .py structural weave + .pyc co_consts CODE weave when true. Default false.",
},
+ self_seal: {
+ type: "boolean",
+ description:
+ "Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5). Injects a self-integrity preamble and entangles the opaque-predicate seed. Default false.",
+ },
seed: {
type: "string",
description: "Optional deterministic seed; when omitted, BLA uses/persists a per-project random seed in .blarc",
@@ -219,6 +229,11 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([
description:
"Opt-in weave-decoy entanglement (shared-state / entry-reachable decoys into customer paths; not dismissible noise). Python .py structural weave + .pyc co_consts CODE weave when true. Default false.",
},
+ self_seal: {
+ type: "boolean",
+ description:
+ "Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5). Injects a self-integrity preamble and entangles the opaque-predicate seed. Default false.",
+ },
seed: {
type: "string",
description: "Optional deterministic seed; when omitted, BLA mints an ephemeral random seed (prefer project .blarc via CLI)",
@@ -847,6 +862,7 @@ export async function handleMcpRequest(
emitManifest: Boolean(args.emit_manifest),
llmDirectives: Boolean(args.llm_directives),
weaveDecoys: Boolean(args.weave_decoys),
+ selfSeal: Boolean(args.self_seal),
...(typeof args.seed === "string" ? { seed: args.seed } : {}),
});
} else if (name === "bla_defend") {
@@ -862,6 +878,7 @@ export async function handleMcpRequest(
emitManifest: Boolean(args.emit_manifest),
llmDirectives: Boolean(args.llm_directives),
weaveDecoys: Boolean(args.weave_decoys),
+ selfSeal: Boolean(args.self_seal),
...(typeof args.seed === "string" ? { seed: args.seed } : {}),
});
} else if (name === "bla_audit") {
@@ -876,6 +893,7 @@ export async function handleMcpRequest(
...(typeof args.seed === "string" ? { seed: args.seed } : {}),
llmDirectives: Boolean(args.llm_directives),
weaveDecoys: Boolean(args.weave_decoys),
+ selfSeal: Boolean(args.self_seal),
});
} else if (name === "bla_verify") {
payload = handlers.verifyTarget(
diff --git a/website/schemas/bla.config.v1.json b/website/schemas/bla.config.v1.json
index 1581408..99cebec 100644
--- a/website/schemas/bla.config.v1.json
+++ b/website/schemas/bla.config.v1.json
@@ -46,6 +46,11 @@
"type": "boolean",
"default": false,
"description": "Opt-in structural weave decoys (Python customer-def / .pyc co_consts weave; JS AST weave already on). Parity with CLI --weave-decoys / MCP weave_decoys."
+ },
+ "selfSeal": {
+ "type": "boolean",
+ "default": false,
+ "description": "Opt-in self-seal / sibling-module integrity binding for JS/Node targets (issue #40.5). Parity with CLI --self-seal / MCP self_seal."
}
},
"additionalProperties": true