🛡️ 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.
JavaScript adversarial-aiclaude-codecursorelectron-securityllm-securitymcpmcp-serverobfuscationreverse-engineeringwebassembly
feat(harden): refuse lane-independent JS gates unless allowed
qybaihe339415cc76e2
diff --git a/.agents/skills/blind-llm-agents/SKILL.md b/.agents/skills/blind-llm-agents/SKILL.mdindex a8a13d3..9b6645b 100644--- a/.agents/skills/blind-llm-agents/SKILL.md+++ b/.agents/skills/blind-llm-agents/SKILL.md@@ -7,7 +7,7 @@ description: >Agents). Prefer this skill as the guide; call existing MCP tools / CLI — do not inventnew MCP tools. Default verb: bla_harden. Refuse crack/RE of third-party software.metadata:- version: "1.5.1"+ version: "1.5.2"---# BLA: Blind LLM Agents@@ -24,6 +24,8 @@ model misjudgment on proprietary logic, or **one-click / 一键加固** a build.Defensive only: protect **their own** artifacts. Refuse crack, RE, bypass PoCs, orattack playbooks against software they do not own.+**Principles (red-blue round-1):** do not ship a stable public WASM ABI without an explicit `wasm_preserve_exports` list; do not leave JS-side independent lane tables — prefer whole-key chained mixing (`bla_lint_lanes` / harden refuse).+## Prerequisites (once)1. CLI: `npx bla-agents@latest setup`diff --git a/.agents/skills/blind-llm-agents/references/format-javascript.md b/.agents/skills/blind-llm-agents/references/format-javascript.mdindex 4e196c3..a6d9e94 100644--- a/.agents/skills/blind-llm-agents/references/format-javascript.md+++ b/.agents/skills/blind-llm-agents/references/format-javascript.md@@ -25,3 +25,8 @@ Self-seal soft-skips in pure browser builds (digest stays 0). Pair with weave wh## Electron notesIPC ambiguity + route mirage layers activate on JS/TS/asar/directory targets during verify. Prefer defending the packaged `.asar` or the `dist/` that ships to users, not only sources.++## Lane-independence (gates / entitlement)++Do **not** keep independent per-byte / per-lane JS check tables (`Object.freeze(parseInt hex…)`, `charCodeAt(i)` → wasm mix/seal per lane). Prefer **whole-key chained mixing**. `bla_lint_lanes` returns severity **error**; harden/defend/protect **refuse** unless `allow_lane_independent` / `--allow-lane-independent` (teaching fixtures only).+diff --git a/.agents/skills/blind-llm-agents/references/format-wasm.md b/.agents/skills/blind-llm-agents/references/format-wasm.mdindex bbc4c3a..afc9e4d 100644--- a/.agents/skills/blind-llm-agents/references/format-wasm.md+++ b/.agents/skills/blind-llm-agents/references/format-wasm.md@@ -4,7 +4,7 @@ Load this when hardening `.wasm` modules.## Intensity & rename-At `maximum` / `bankrupt`, BLA may rename **internal-looking** exports (`__*`, `debug_*`, …). Public ABI names the customer must keep go in the preserve list:+At `maximum` / `bankrupt`, BLA renames **all** exports not listed in the preserve list (red-blue round-1: silent `mix`/`seal` ABI enabled preload hooks). Do **not** ship a stable public WASM ABI unless glue truly requires it — and then list names **explicitly**:| Surface | How || :--- | :--- |diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 88dec80..76ef5f7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Changed+- **Red/Blue round-1 · Writeback P0 — WASM export rename default:** at `maximum`/`bankrupt`, `protectWasmBinary` renames **all** non-preserved exports (not only `__*` / `debug_*`). Keeping a stable public ABI requires explicit `wasmPreserveExports` / `--wasm-preserve-exports` / `wasm_preserve_exports`. Optional `renameInternalOnly: true` for the weaker pass.+- **Red/Blue round-1 · Writeback P0 — lane-independence is error + harden refuse:** `bla lint-lanes` / `bla_lint_lanes` findings are severity **error**; protect/defend/harden refuse JS/TS that looks lane-independent (including per-byte WASM mix/seal oracles) unless `allowLaneIndependentGates` / `--allow-lane-independent` / `allow_lane_independent`. Skill v1.5.2 principles: no silent stable WASM ABI; no JS independent lane tables; prefer whole-key mixing.+### Fixed- **MCP/Skill 2.0 stabilization:** `bla_harden` dry-run no longer sets `overallSuccess: true`; CLI formatter labels dry-run as `DRY-RUN (nothing written)` instead of `SUCCESS`. Successful `bla_harden` writes now return `writeReceipt` (matching defend/protect and the stage A contract). `bla_redteam_report` on-disk reads use `status: available` (not `pass`) so agents cannot mistake a static fixture for a live REA verdict; harness stdout/stderr are clipped for MCP stdio safety. Skill guide **v1.5.1** documents available vs unverified.diff --git a/docs/cli-and-mcp.md b/docs/cli-and-mcp.mdindex 5cdd7d3..89b20be 100644--- a/docs/cli-and-mcp.md+++ b/docs/cli-and-mcp.md@@ -48,9 +48,9 @@ For coding agents, the **[`blind-llm-agents` skill](../.agents/skills/blind-llm-Project config parity: set `"weaveDecoys": true` in `.blarc` / `bla.config.json` (schema `bla.config.v1.json`) to enable the same flag without repeating `--weave-decoys` / MCP `weave_decoys` on every invoke. CLI/MCP flags still OR with the config value.Opt-in **self-seal** (issue #40.5): CLI `--self-seal`, MCP `self_seal`, `.blarc` `"selfSeal": true`. Injects a Node self-integrity preamble (module + optional sibling paths + env fingerprint) and folds the digest into the opaque-predicate seed for JS/Node targets.-WASM public ABI preserve list (issue #40.3): CLI `--wasm-preserve-exports a,b`, MCP `wasm_preserve_exports`, `.blarc` `"wasmPreserveExports": ["a","b"]`. Kept names stay; internal-looking exports may still rename at maximum/bankrupt.+WASM public ABI preserve list (issue #40.3 / red-blue round-1): CLI `--wasm-preserve-exports a,b`, MCP `wasm_preserve_exports`, `.blarc` `"wasmPreserveExports": ["a","b"]`. At `maximum`/`bankrupt`, **every** non-listed export is renamed by default — keeping `mix`/`seal`-style names requires an explicit list.-Heuristic **lane-independence lint** (issue #40.1): CLI `bla lint-lanes <file>` and MCP `bla_lint_lanes` warn when gate code looks like independent per-lane checks. Defensive guidance only — prefer whole-key chained mixing.+Heuristic **lane-independence lint** (issue #40.1 / red-blue round-1): CLI `bla lint-lanes <file>` and MCP `bla_lint_lanes` emit severity **error** when gate code looks like independent per-lane checks. Harden/defend/protect **refuse** unless CLI `--allow-lane-independent` / MCP `allow_lane_independent` / `.blarc` `"allowLaneIndependentGates": true`. Prefer whole-key chained mixing.### MCP Resourcesdiff --git a/docs/counter-rea-deception.md b/docs/counter-rea-deception.mdindex 43a357a..90dcb9f 100644--- a/docs/counter-rea-deception.md+++ b/docs/counter-rea-deception.md@@ -41,4 +41,4 @@ resource `bla://directives/weave-decoy`, tool `bla_weave_plan`, flag## WASM export rename (#40.3)-`protectWasmBinary` can rename non-public / internal-looking exports while preserving names listed in `preserveExports`. At `maximum`/`bankrupt`, internal-looking names (`__*`, `debug_*`, …) are renamed by default. Forced full rename: `renameNonPublicExports: true` with an explicit preserve list for the public ABI. Returns `exportsRenamed` for glue updates. Project / CLI / MCP parity: `.blarc` `wasmPreserveExports`, `--wasm-preserve-exports`, MCP `wasm_preserve_exports`.+`protectWasmBinary` renames exports not listed in `preserveExports`. At `maximum`/`bankrupt`, **all** non-preserved names rename by default (red-blue round-1). Keeping a stable public ABI requires an explicit preserve list. Optional `renameInternalOnly: true` restores the weaker internal-only pass. Returns `exportsRenamed` for glue updates. Project / CLI / MCP parity: `.blarc` `wasmPreserveExports`, `--wasm-preserve-exports`, MCP `wasm_preserve_exports`.diff --git a/docs/one-click-agent-defense.md b/docs/one-click-agent-defense.mdindex a12e282..addeb48 100644--- a/docs/one-click-agent-defense.md+++ b/docs/one-click-agent-defense.md@@ -76,5 +76,5 @@ Pass `--self-seal` / MCP `self_seal: true` / `.blarc` `"selfSeal": true` so JS/N## WASM export rename / preserve (#40.3)-At `maximum`/`bankrupt`, BLA may rename internal-looking WASM exports. Pass `--wasm-preserve-exports main,add` / MCP `wasm_preserve_exports` / `.blarc` `"wasmPreserveExports": ["main","add"]` so the public ABI stays stable while glue can consume the rename map for anything else.+At `maximum`/`bankrupt`, BLA renames **all** non-preserved WASM exports. Pass `--wasm-preserve-exports main,add` / MCP `wasm_preserve_exports` / `.blarc` `"wasmPreserveExports": ["main","add"]` only when the public ABI must stay; otherwise consume the rename map. Do not leave independent JS lane tables — `bla lint-lanes` / harden refuse unless `--allow-lane-independent`.diff --git a/scripts/crackme/lib.mjs b/scripts/crackme/lib.mjsindex 6756424..2735b78 100644--- a/scripts/crackme/lib.mjs+++ b/scripts/crackme/lib.mjs@@ -154,6 +154,9 @@ export async function hardenChallenge({ key, flag, outDir, seed = SEED }) {copyFileSync(join(SRC_DIR, "panel.html"), join(stage, "panel.html"));copyFileSync(join(SRC_DIR, "core.wasm"), join(stage, "core.wasm"));+ // Red/blue round-1: bankrupt renames all non-preserved WASM exports by default.+ // This teaching fixture keeps mix/seal on purpose (explicit ABI) and opts into+ // the lane-independent gate that bla_lint_lanes / harden now refuse by default.const report = hardenProject({directory: stage,intensity: INTENSITY,@@ -161,6 +164,8 @@ export async function hardenChallenge({ key, flag, outDir, seed = SEED }) {llmDirectives: false,emitManifest: false,outputDirectory: hardened,+ wasmPreserveExports: ["mix", "seal"],+ allowLaneIndependentGates: true,});if (!report.overallSuccess) {throw new Error(`hardenProject failed: ${JSON.stringify(report.artifacts?.map((a) => [a.relativePath, a.success, a.error]))}`);diff --git a/src/cli.ts b/src/cli.tsindex 6462156..6076d79 100644--- a/src/cli.ts+++ b/src/cli.ts@@ -51,7 +51,7 @@ Commands:defend <target> One-click full Counter-REA pipeline (inspect -> audit -> bankrupt protect -> verify)inspect-release <target> Read-only local source-map & symbol exposure checkaudit <target> Pre-flight REA exposure & vulnerability scan- lint-lanes <file> Heuristic warn if gate code looks lane-independent (issue #40.1)+ lint-lanes <file> Heuristic ERROR if gate code looks lane-independent (issue #40.1); exit 2protect <target> Inject multi-layer Counter-REA adversarial shieldverify <target> [original] Verify Counter-REA defense invariants & token amplificationbenchmark Run the 14-target Counter-REA Showcase Benchmark suite@@ -72,6 +72,7 @@ Options:--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--wasm-preserve-exports <a,b> Comma-separated WASM export names to keep as public ABI (issue #40.3)+ --allow-lane-independent Allow harden/defend of lane-independent JS gates (issue #40.1); 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@@ -96,6 +97,7 @@ interface ParsedCliArgs {readonly weaveDecoys: boolean;readonly selfSeal: boolean;readonly wasmPreserveExports: readonly string[];+ readonly allowLaneIndependentGates: boolean;readonly lang: NativeHeaderLanguage;readonly clients: SupportedAgentClientId[];readonly allDetected: boolean;@@ -122,6 +124,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {let weaveDecoys = false;let selfSeal = false;let wasmPreserveExports: string[] = [];+ let allowLaneIndependentGates = false;let lang: NativeHeaderLanguage = "c";const clients: SupportedAgentClientId[] = [];let allDetected = false;@@ -162,6 +165,8 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {weaveDecoys = true;} else if (arg === "--self-seal") {selfSeal = true;+ } else if (arg === "--allow-lane-independent") {+ allowLaneIndependentGates = true;} else if (arg.startsWith("--wasm-preserve-exports=")) {wasmPreserveExports = arg.slice("--wasm-preserve-exports=".length)@@ -217,6 +222,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs {weaveDecoys,selfSeal,wasmPreserveExports,+ allowLaneIndependentGates,lang,clients,allDetected,@@ -348,6 +354,9 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): Pconst merged = [...new Set([...fromCfg, ...fromCli])];return merged.length > 0 ? { wasmPreserveExports: merged } : {};})()),+ allowLaneIndependentGates:+ parsed.allowLaneIndependentGates ||+ loaded.config.allowLaneIndependentGates === true,...(parsed.output !== undefined ? { outputDirectory: parsed.output } : {}),});if (parsed.json) {@@ -388,6 +397,9 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): Pconst merged = [...new Set([...fromCfg, ...fromCli])];return merged.length > 0 ? { wasmPreserveExports: merged } : {};})()),+ allowLaneIndependentGates:+ parsed.allowLaneIndependentGates ||+ loaded.config.allowLaneIndependentGates === true,});if (parsed.sarif) {console.log(@@ -474,6 +486,9 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): Pconst merged = [...new Set([...fromCfg, ...fromCli])];return merged.length > 0 ? { wasmPreserveExports: merged } : {};})()),+ allowLaneIndependentGates:+ parsed.allowLaneIndependentGates ||+ loaded.config.allowLaneIndependentGates === 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.tsindex cd701cb..a1ee647 100644--- a/src/core/config.ts+++ b/src/core/config.ts@@ -22,6 +22,8 @@ export interface BlaProjectConfig {readonly selfSeal?: boolean;/** WASM export names that must remain the public ABI when export rename runs (issue #40.3). */readonly wasmPreserveExports?: readonly string[];+ /** When true, allow harden/defend of lane-independent JS gates (issue #40.1). Default false. */+ readonly allowLaneIndependentGates?: boolean;}/**diff --git a/src/core/types.ts b/src/core/types.tsindex c9bfd81..ff8e325 100644--- a/src/core/types.ts+++ b/src/core/types.ts@@ -171,9 +171,15 @@ export interface ProtectionOptions {readonly selfSeal?: boolean;/*** WASM public ABI export names to keep when rename runs (issue #40.3).- * Other / internal-looking exports may be renamed at maximum/bankrupt.+ * At maximum/bankrupt every non-listed export is renamed by default —+ * preserving a stable ABI requires an explicit list.*/readonly wasmPreserveExports?: readonly string[];+ /**+ * When true, allow protecting JS/TS that looks lane-independent (issue #40.1).+ * Default false: protect/defend/harden refuse such gates (red-blue round-1).+ */+ readonly allowLaneIndependentGates?: boolean;}export interface ProtectionMetrics {diff --git a/src/engine/defender.ts b/src/engine/defender.tsindex 098ae38..5527b0e 100644--- a/src/engine/defender.ts+++ b/src/engine/defender.ts@@ -29,6 +29,8 @@ export interface OneClickDefenseOptions {readonly selfSeal?: boolean;/** WASM public ABI export names to preserve when rename runs (issue #40.3). */readonly wasmPreserveExports?: readonly string[];+ /** Allow lane-independent JS gates (issue #40.1). Default false. */+ readonly allowLaneIndependentGates?: boolean;}export interface OneClickDefenseStageSummary {@@ -120,6 +122,9 @@ export function defendTarget(options: OneClickDefenseOptions): OneClickDefenseRe...(options.wasmPreserveExports !== undefined && options.wasmPreserveExports.length > 0? { wasmPreserveExports: options.wasmPreserveExports }: {}),+ ...(options.allowLaneIndependentGates === true+ ? { allowLaneIndependentGates: true }+ : {}),honeySourceMaps: true,});diff --git a/src/engine/harden.ts b/src/engine/harden.tsindex 0073ed8..1638325 100644--- a/src/engine/harden.ts+++ b/src/engine/harden.ts@@ -103,6 +103,8 @@ export interface HardenProjectOptions {readonly selfSeal?: boolean;/** WASM public ABI export names to preserve when rename runs (issue #40.3). */readonly wasmPreserveExports?: readonly string[];+ /** Allow lane-independent JS gates (issue #40.1). Default false — refuse. */+ readonly allowLaneIndependentGates?: boolean;/** Optional output root; defaults to `<dir>/.bla-hardened`. */readonly outputDirectory?: string;readonly maxArtifacts?: number;@@ -415,6 +417,9 @@ export function hardenProject(options.wasmPreserveExports.length > 0? { wasmPreserveExports: options.wasmPreserveExports }: {}),+ ...(options.allowLaneIndependentGates === true+ ? { allowLaneIndependentGates: true }+ : {}),emitManifest,});summaries.push({diff --git a/src/mcp/server.ts b/src/mcp/server.tsindex 7f5fcb9..0eb2bb9 100644--- a/src/mcp/server.ts+++ b/src/mcp/server.ts@@ -154,7 +154,12 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "array",items: { type: "string" },description:- "WASM export names that must remain the public ABI when export rename runs at maximum/bankrupt (issue #40.3).",+ "WASM export names to keep as the public ABI. At maximum/bankrupt every other export is renamed by default — pass explicitly to keep mix/seal-style names (issue #40.3 / red-blue round-1).",+ },+ allow_lane_independent: {+ type: "boolean",+ description:+ "Allow harden/defend/protect of JS/TS that looks lane-independent (per-byte oracles). Default false — refuse (issue #40.1 / red-blue round-1).",},seed: {type: "string",@@ -244,7 +249,12 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "array",items: { type: "string" },description:- "WASM export names that must remain the public ABI when export rename runs at maximum/bankrupt (issue #40.3).",+ "WASM export names to keep as the public ABI. At maximum/bankrupt every other export is renamed by default — pass explicitly to keep mix/seal-style names (issue #40.3 / red-blue round-1).",+ },+ allow_lane_independent: {+ type: "boolean",+ description:+ "Allow harden/defend/protect of JS/TS that looks lane-independent (per-byte oracles). Default false — refuse (issue #40.1 / red-blue round-1).",},seed: {type: "string",@@ -315,7 +325,12 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "array",items: { type: "string" },description:- "WASM export names that must remain the public ABI when export rename runs at maximum/bankrupt (issue #40.3).",+ "WASM export names to keep as the public ABI. At maximum/bankrupt every other export is renamed by default — pass explicitly to keep mix/seal-style names (issue #40.3 / red-blue round-1).",+ },+ allow_lane_independent: {+ type: "boolean",+ description:+ "Allow harden/defend/protect of JS/TS that looks lane-independent (per-byte oracles). Default false — refuse (issue #40.1 / red-blue round-1).",},seed: {type: "string",@@ -503,7 +518,7 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([{name: "bla_lint_lanes",description:- "Read-only heuristic lane-independence footgun lint (same engine as CLI `bla lint-lanes`). Warns when gate/activation source looks like independent per-lane checks. Defensive guidance only — prefer whole-key chained mixing. Writes nothing.",+ "Read-only heuristic lane-independence footgun lint (same engine as CLI `bla lint-lanes`). Returns severity-error findings when gate/activation source looks like independent per-lane checks. Harden refuses such gates unless allow_lane_independent. Prefer whole-key chained mixing. Writes nothing.",inputSchema: {type: "object",properties: {@@ -765,6 +780,9 @@ function runDefend(handlers: McpEngineHandlers, args: Record<string, unknown>):weaveDecoys: Boolean(args.weave_decoys),selfSeal: Boolean(args.self_seal),...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),+ ...(args.allow_lane_independent === true+ ? { allowLaneIndependentGates: true }+ : {}),...(typeof args.seed === "string" ? { seed: args.seed } : {}),});}@@ -786,6 +804,9 @@ function runProtect(handlers: McpEngineHandlers, args: Record<string, unknown>):? { honeySourceMaps: args.honey_source_maps }: {}),...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),+ ...(args.allow_lane_independent === true+ ? { allowLaneIndependentGates: true }+ : {}),});}@@ -1261,6 +1282,9 @@ export async function handleMcpRequest(weaveDecoys: Boolean(args.weave_decoys),selfSeal: Boolean(args.self_seal),...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),+ ...(args.allow_lane_independent === true+ ? { allowLaneIndependentGates: true }+ : {}),...(typeof args.seed === "string" ? { seed: args.seed } : {}),});// Dry-run / confirmation_required leave no write receipt; real writes do.diff --git a/tests/lane-independence-harden-gate.test.ts b/tests/lane-independence-harden-gate.test.tsnew file mode 100644index 0000000..845da80--- /dev/null+++ b/tests/lane-independence-harden-gate.test.ts@@ -0,0 +1,89 @@+import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";+import { hardenProject } from "../src/engine/harden.js";+import { protectTarget } from "../src/engine/protector.js";++const dirs: string[] = [];+afterEach(() => {+ for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });+});++const INDEPENDENT_GATE = `+ const lanes = [0x41, 0x42, 0x43, 0x44, 0x45];+ export function check(key) {+ return key.split("").every((ch, i) => ch.charCodeAt(0) === lanes[i]);+ }+`;++const WHOLE_KEY_GATE = `+ export function activate(key) {+ let a = 0, b = 1;+ for (let i = 0; i < key.length; i++) {+ a = (a + key.charCodeAt(i) * (i + 3)) | 0;+ b = Math.imul(b ^ a, 0x01000193) | 0;+ }+ return (a ^ b) === 0x12345678;+ }+`;++describe("harden/protect lane-independence gate (red-blue round-1 P0)", () => {+ it("refuses independent 1-byte lane JS by default", () => {+ const root = mkdtempSync(join(tmpdir(), "bla-lane-refuse-"));+ dirs.push(root);+ const src = join(root, "gate.js");+ writeFileSync(src, INDEPENDENT_GATE, "utf8");+ expect(() =>+ protectTarget({+ inputPath: src,+ outputPath: join(root, "out.js"),+ intensity: "balanced",+ seed: "lane-refuse",+ }),+ ).toThrow(/allowLaneIndependentGates|lane-independent/i);++ const app = join(root, "app");+ mkdirSync(app);+ writeFileSync(join(app, "gate.js"), INDEPENDENT_GATE, "utf8");+ const report = hardenProject({+ directory: app,+ intensity: "stealth",+ seed: "lane-refuse-harden",+ outputDirectory: join(root, "hardened"),+ });+ expect(report.overallSuccess).toBe(false);+ expect(report.artifacts.some((a) => a.error && /lane-independent|allowLaneIndependent/i.test(a.error))).toBe(+ true,+ );+ });++ it("passes whole-key mixing without allow flag", () => {+ const root = mkdtempSync(join(tmpdir(), "bla-lane-ok-"));+ dirs.push(root);+ const src = join(root, "gate.js");+ writeFileSync(src, WHOLE_KEY_GATE, "utf8");+ const res = protectTarget({+ inputPath: src,+ outputPath: join(root, "out.js"),+ intensity: "balanced",+ seed: "lane-ok",+ });+ expect(res.outputPath).toBe(join(root, "out.js"));+ });++ it("allows independent lanes only with allowLaneIndependentGates", () => {+ const root = mkdtempSync(join(tmpdir(), "bla-lane-allow-"));+ dirs.push(root);+ const src = join(root, "gate.js");+ writeFileSync(src, INDEPENDENT_GATE, "utf8");+ const res = protectTarget({+ inputPath: src,+ outputPath: join(root, "out.js"),+ intensity: "balanced",+ seed: "lane-allow",+ allowLaneIndependentGates: true,+ });+ expect(res.outputPath).toBe(join(root, "out.js"));+ });+});diff --git a/tests/mcp-engine-capability-parity.test.ts b/tests/mcp-engine-capability-parity.test.tsindex 26bb884..ebbafce 100644--- a/tests/mcp-engine-capability-parity.test.ts+++ b/tests/mcp-engine-capability-parity.test.ts@@ -22,6 +22,7 @@ const EXPECTED_MCP_ENGINE_CAPABILITIES: ReadonlyArray<{"weave_decoys","self_seal","wasm_preserve_exports",+ "allow_lane_independent","seed","dry_run","max_artifacts",@@ -44,6 +45,7 @@ const EXPECTED_MCP_ENGINE_CAPABILITIES: ReadonlyArray<{"weave_decoys","self_seal","wasm_preserve_exports",+ "allow_lane_independent","seed","in_place","confirm_overwrite",@@ -58,6 +60,7 @@ const EXPECTED_MCP_ENGINE_CAPABILITIES: ReadonlyArray<{"weave_decoys","self_seal","wasm_preserve_exports",+ "allow_lane_independent","seed","llm_directives","in_place",