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(mcp+skill): bla_lint_integrity_coverage + interleaved principle

qybaihea27a30add2bc
diff --git a/.agents/skills/blind-llm-agents/SKILL.md b/.agents/skills/blind-llm-agents/SKILL.md
index 3d372d0..c9a2601 100644
--- a/.agents/skills/blind-llm-agents/SKILL.md
+++ b/.agents/skills/blind-llm-agents/SKILL.md
@@ -14,7 +14,7 @@ metadata:
**This skill is the primary one-click harden GUIDE.** MCP (`bla` server) and the
`bla-agents` CLI are the **execution layer**. Prefer teaching/calling existing tools
-(`bla_harden`, `bla_defend`, `bla_weave_plan`, **`bla_lint`** (unified), `bla_lint_lanes`, `bla_lint_seal`, `bla_lint_wasm_params`, `bla_lint_panel_derive`, `bla_lint_js_aes_unwrap`, `bla_lint_js_wasm_hydrate_dump`, `bla_lint_wasm_xor_mask_sidecar`, `bla_lint_wasm_seal_xor_known_plaintext`, `bla_lint_plaintext_secrets`, `bla_encrypt_strings`, …) over inventing new
+(`bla_harden`, `bla_defend`, `bla_weave_plan`, **`bla_lint`** (unified), `bla_lint_lanes`, `bla_lint_seal`, `bla_lint_wasm_params`, `bla_lint_panel_derive`, `bla_lint_js_aes_unwrap`, `bla_lint_js_wasm_hydrate_dump`, `bla_lint_wasm_xor_mask_sidecar`, `bla_lint_wasm_seal_xor_known_plaintext`, `bla_lint_plaintext_secrets`, `bla_encrypt_strings`, `bla_lint_integrity_coverage`, …) over inventing new
MCP surfaces.
Use BLA whenever the user asks to harden a project against AI reverse-engineering
@@ -49,6 +49,7 @@ Also: do **not** ship a stable public WASM ABI without explicit `wasm_preserve_e
### B. Product recipe principles (Skill layer β€” not new refuse lints)
- Sensitive literals in panel.html / license.cjs must not remain cleartext in shipped artifacts; prefer `bla_encrypt_strings` (seed-derived XOR β€” never JS AES wrap-key). Lint with `bla_lint_plaintext_secrets`.
+- Integrity checkers must be interleaved and mutually covering (coverage matrix `bla-integrity-coverage/v1`); single-point self-seal is refuse-worthy. Lint with `bla_lint_integrity_coverage`.
Held across R8–R12 (NO PRIZE). Keep in gate design; do **not** invent packaging refuse lints for these:
diff --git a/src/mcp/server.ts b/src/mcp/server.ts
index 8520997..a8c7d3b 100644
--- a/src/mcp/server.ts
+++ b/src/mcp/server.ts
@@ -62,6 +62,13 @@ import {
discoverAndLintPlaintextSecrets,
lintPlaintextSecretsFile,
} from "../engine/plaintext-secret-lint.js";
+import {
+ discoverAndLintIntegrityCoverage,
+ evaluateCoverageMatrix,
+ INTEGRITY_COVERAGE_SCHEMA,
+ type CoverageMatrix,
+} from "../engine/integrity-coverage.js";
+import { planSidecarEntanglement } from "../shields/runtime/sidecar-entangle.js";
import { runShowcaseBenchmark } from "../engine/benchmark.js";
import {
emitCompileTimeNativeHeader,
@@ -863,6 +870,25 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([
additionalProperties: false,
},
},
+ {
+ name: "bla_lint_integrity_coverage",
+ description:
+ "Read-only integrity coverage matrix lint (Direction-3). Evaluates bla-integrity-coverage/v1 JSON (path to file or directory discovering integrity-coverage.json). Refuses when full coverage / anti-single-point / hashes / connectivity fail. Hash-only β€” no guessing. Writes nothing.",
+ inputSchema: {
+ type: "object",
+ properties: {
+ path: {
+ type: "string",
+ description: "Path to integrity-coverage.json or a project directory containing one",
+ },
+ allow_single_point_integrity: {
+ type: "boolean",
+ description: "Lab escape: report findings without bankrupt refuse semantics",
+ },
+ },
+ required: ["path"],
+ },
+ },
{
name: "bla_run_lookup",
description:
@@ -2019,6 +2045,22 @@ export async function handleMcpRequest(
} else if (name === "bla_lint_wasm_seal_xor_known_plaintext") {
payload = runLintWasmSealXorKnownPlaintext(args);
refused = (payload as WasmSealXorKnownPlaintextReport).shouldRefuseBankrupt;
+ } else if (name === "bla_lint_integrity_coverage") {
+ const target = String(args.path ?? "");
+ const allow = args.allow_single_point_integrity === true;
+ const reports = discoverAndLintIntegrityCoverage(target);
+ const anyRefuse = reports.some((r) => r.shouldRefuseBankrupt);
+ payload = {
+ schema: INTEGRITY_COVERAGE_SCHEMA,
+ path: target,
+ reports,
+ shouldRefuseBankrupt: allow ? false : anyRefuse,
+ oneLineAdvice: anyRefuse
+ ? "ERROR: Integrity coverage matrix failed β€” fix interleaved checkers or allow_single_point_integrity (lab only)."
+ : reports.length === 0
+ ? "No integrity-coverage.json found (not an error β€” emit via harden --self-seal)."
+ : "Integrity coverage matrix OK.",
+ };
} else if (name === "bla_run_lookup") {
payload = readHardenRunSummary(
args.summary_path as string,
diff --git a/tests/mcp-engine-capability-parity.test.ts b/tests/mcp-engine-capability-parity.test.ts
index cf7b113..7971c08 100644
--- a/tests/mcp-engine-capability-parity.test.ts
+++ b/tests/mcp-engine-capability-parity.test.ts
@@ -159,6 +159,10 @@ const EXPECTED_MCP_ENGINE_CAPABILITIES: ReadonlyArray<{
tool: "bla_rea_drift",
params: ["rea_root"],
},
+ {
+ tool: "bla_lint_integrity_coverage",
+ params: ["path"],
+ },
{
tool: "bla_polymorph_report",
params: ["dir_a", "dir_b", "expect", "same_threshold", "different_threshold"],