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(devtools): add REA constant drift harness and realign catalog

qybaiheb09472eead31
diff --git a/package.json b/package.json
index 128cf45..e6e9abd 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "bla-agents",
"version": "1.3.0",
- "description": "BLA (Blind LLM Agents) β€” Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, WebAssembly, SQLite, AI Models, and Android DEX/IL2CPP against AI reverse-engineering agents like REA.",
+ "description": "BLA (Blind LLM Agents) \u2014 Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, WebAssembly, SQLite, AI Models, and Android DEX/IL2CPP against AI reverse-engineering agents like REA.",
"keywords": [
"reverse-engineering-defense",
"anti-rea",
@@ -68,7 +68,8 @@
"sync:site": "node scripts/sync-site.mjs",
"release:patch": "npm version patch -m 'chore(release): bla-agents v%s' && git push --follow-tags",
"release:minor": "npm version minor -m 'chore(release): bla-agents v%s' && git push --follow-tags",
- "prepublishOnly": "npm run build && npm test"
+ "prepublishOnly": "npm run build && npm test",
+ "verify:rea": "node scripts/verify-rea-constants.mjs"
},
"dependencies": {
"@babel/generator": "^7.26.0",
diff --git a/scripts/verify-rea-constants.mjs b/scripts/verify-rea-constants.mjs
new file mode 100755
index 0000000..ef4bc39
--- /dev/null
+++ b/scripts/verify-rea-constants.mjs
@@ -0,0 +1,403 @@
+#!/usr/bin/env node
+/**
+ * REA-drift verification harness.
+ *
+ * Reads the local REA checkout and asserts β€” by constant NAME, never by
+ * brittle file:line citations β€” that every hard limit BLA depends on still
+ * matches the expected value. Prints a clear PASS/FAIL drift report.
+ *
+ * Usage:
+ * node scripts/verify-rea-constants.mjs
+ * REA_ROOT=/path/to/rea node scripts/verify-rea-constants.mjs
+ *
+ * Exit code 0 = all asserted constants match; 1 = drift detected or REA missing.
+ */
+import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
+import { dirname, join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const BLA_ROOT = resolve(__dirname, "..");
+const REA_ROOT = resolve(
+ process.env.REA_ROOT ?? join(BLA_ROOT, "..", "rea"),
+);
+
+/** Evaluate a simple numeric TS/Python initializer (`64 * 1024`, `1_048_576`, `65_536`). */
+function evalNumericExpr(expr) {
+ const cleaned = expr
+ .replace(/_/g, "")
+ .replace(/\/\*[\s\S]*?\*\//g, "")
+ .replace(/\/\/.*$/gm, "")
+ .trim();
+ if (!/^[\d\s*+\-().]+$/.test(cleaned)) {
+ throw new Error(`unsupported numeric expression: ${expr}`);
+ }
+ // eslint-disable-next-line no-new-func
+ return Number(Function(`"use strict"; return (${cleaned});`)());
+}
+
+function walkFiles(root, exts, out = []) {
+ if (!existsSync(root)) return out;
+ for (const ent of readdirSync(root)) {
+ if (ent === "node_modules" || ent === "dist" || ent === ".git") continue;
+ const full = join(root, ent);
+ let st;
+ try {
+ st = statSync(full);
+ } catch {
+ continue;
+ }
+ if (st.isDirectory()) walkFiles(full, exts, out);
+ else if (exts.some((e) => ent.endsWith(e))) out.push(full);
+ }
+ return out;
+}
+
+function findAssignments(files, name) {
+ const hits = [];
+ // Match: export const NAME = … / const NAME = … / NAME = … (Python)
+ const re = new RegExp(
+ String.raw`(?:(?:export\s+)?(?:const|let|var)\s+|)${name}\s*=\s*([^;\n]+)`,
+ "g",
+ );
+ for (const file of files) {
+ let text;
+ try {
+ text = readFileSync(file, "utf8");
+ } catch {
+ continue;
+ }
+ // Skip pure test files for value assertions (still allow symbol presence)
+ const isTest = /\.test\.[jt]s$|\.spec\.[jt]s$/.test(file);
+ re.lastIndex = 0;
+ let m;
+ while ((m = re.exec(text))) {
+ hits.push({
+ file: file.slice(REA_ROOT.length + 1),
+ expr: m[1].trim(),
+ isTest,
+ });
+ }
+ }
+ return hits;
+}
+
+function findObjectProperty(files, objectName, propName) {
+ const hits = [];
+ const objRe = new RegExp(
+ String.raw`(?:export\s+)?const\s+${objectName}\s*=\s*\{([\s\S]*?)\n\}\s*(?:as\s+const)?\s*;`,
+ "g",
+ );
+ for (const file of files) {
+ let text;
+ try {
+ text = readFileSync(file, "utf8");
+ } catch {
+ continue;
+ }
+ objRe.lastIndex = 0;
+ let m;
+ while ((m = objRe.exec(text))) {
+ const body = m[1];
+ const propRe = new RegExp(
+ String.raw`(?:^|,|\n)\s*${propName}\s*:\s*([^,\n]+)`,
+ "g",
+ );
+ let pm;
+ while ((pm = propRe.exec(body))) {
+ hits.push({
+ file: file.slice(REA_ROOT.length + 1),
+ expr: pm[1].trim(),
+ isTest: /\.test\.[jt]s$/.test(file),
+ });
+ }
+ }
+ }
+ return hits;
+}
+
+function countObligationFamilies(files) {
+ const policyFile = files.find((f) =>
+ f.endsWith("ReconstructionObligationPolicies.ts"),
+ );
+ if (!policyFile) return { count: 0, keys: [], file: null };
+ const text = readFileSync(policyFile, "utf8");
+ const keys = [];
+ const re =
+ /^\s+(?:"([^"]+)"|([A-Za-z][A-Za-z0-9_-]*))\s*:\s*(?:policy|nativePolicy|parserPolicy)\(/gm;
+ let m;
+ while ((m = re.exec(text))) keys.push(m[1] ?? m[2]);
+ return {
+ count: keys.length,
+ keys,
+ file: policyFile.slice(REA_ROOT.length + 1),
+ };
+}
+
+/** Catalog of BLA-tracked REA constants (name β†’ expected numeric value). */
+const NUMERIC_EXPECTATIONS = [
+ { name: "SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT", expected: 256 },
+ { name: "SEMANTIC_EXPRESSION_DEPTH_LIMIT", expected: 256 },
+ { name: "SEMANTIC_GETTER_EXPANSION_LIMIT", expected: 512 },
+ { name: "SEMANTIC_ALIAS_SELECTION_LIMIT", expected: 512 },
+ { name: "SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT", expected: 1_048_576 },
+ { name: "WASM_INTERFACE_REPRESENTATION_BYTES", expected: 32 * 1024 * 1024 },
+ { name: "MODEL_JSON_NESTING", expected: 32 },
+ { name: "MODEL_METADATA_NESTING", expected: 32 },
+ { name: "MAX_JSON_DEPTH", expected: 64, fileHint: "fridaCaptureLimits" },
+ { name: "MAX_MESSAGE_TEXT_BYTES", expected: 32 * 1024 },
+ { name: "DEFAULT_ASAR_MAX_HEADER_BYTES", expected: 16 * 1024 * 1024 },
+ { name: "DEFAULT_REGEX_MATCHING_DEADLINE_MS", expected: 5_000 },
+ { name: "MAX_TRACE_FRAMES", expected: 65_536 },
+ { name: "MAX_OTHER_STOPS", expected: 256 },
+ { name: "MAX_TRACE_BYTES", expected: 8 * 1024 * 1024 },
+ { name: "MAX_COMMAND_OUTPUT_RECORDS", expected: 16_384, fileHint: "GdbSessionManager" },
+ { name: "MAX_COMMAND_FRAMES", expected: 4096, fileHint: "RizinDebugSessionManager" },
+ { name: "STEP_DIFFERENCE_LIMIT", expected: 20 },
+ { name: "MAX_RUSTC_HASHES", expected: 64 },
+ { name: "MAX_SNAPSHOT_HASH_CANDIDATES", expected: 64 },
+ { name: "PYTHON_PYC_CONST_PREVIEW_LIMIT", expected: 80 },
+];
+
+const OBJECT_PROP_EXPECTATIONS = [
+ {
+ objectName: "WEB_RUNTIME_LIMITS",
+ propName: "sourceBytes",
+ expected: 32 * 1024 * 1024,
+ label: "WEB_RUNTIME_LIMITS.sourceBytes",
+ },
+ {
+ objectName: "WEB_RUNTIME_LIMITS",
+ propName: "retainedEventBytes",
+ expected: 8 * 1024 * 1024,
+ label: "WEB_RUNTIME_LIMITS.retainedEventBytes",
+ },
+];
+
+const SYMBOL_EXPECTATIONS = [
+ "SqliteColumnEvaluationFailure",
+ "parseRecordedTransportUrl",
+ "singleQueryValues",
+];
+
+const EXPECTED_OBLIGATION_FAMILIES = [
+ "package",
+ "installer",
+ "context-bridge-api",
+ "ipc-channel",
+ "ipc-handler",
+ "endpoint",
+ "storage",
+ "worker",
+ "service-worker",
+ "native-addon",
+ "native-export",
+ "managed-pinvoke-import",
+ "managed-native-implementation",
+ "child-process",
+ "stdio",
+ "signal",
+ "config-source",
+ "request",
+ "response",
+ "boundary",
+ "resource",
+ "event",
+ "timer",
+ "promise",
+ "task",
+];
+
+function main() {
+ console.log("BLA ↔ REA constant drift verification");
+ console.log(` BLA_ROOT = ${BLA_ROOT}`);
+ console.log(` REA_ROOT = ${REA_ROOT}`);
+
+ if (!existsSync(REA_ROOT) || !existsSync(join(REA_ROOT, "src"))) {
+ console.error("\nFAIL REA checkout not found. Clone morluto/rea next to bla or set REA_ROOT.");
+ process.exit(1);
+ }
+
+ const files = [
+ ...walkFiles(join(REA_ROOT, "src"), [".ts", ".js"]),
+ ...walkFiles(join(REA_ROOT, "bridge"), [".ts", ".js", ".py"]),
+ ];
+
+ const rows = [];
+ let failures = 0;
+
+ for (const spec of NUMERIC_EXPECTATIONS) {
+ let hits = findAssignments(files, spec.name).filter((h) => !h.isTest);
+ if (spec.fileHint) {
+ const hinted = hits.filter((h) => h.file.includes(spec.fileHint));
+ if (hinted.length) hits = hinted;
+ }
+ if (hits.length === 0) {
+ rows.push({
+ status: "FAIL",
+ label: spec.name,
+ detail: "constant not found in REA source",
+ });
+ failures++;
+ continue;
+ }
+ // Prefer non-test, first production hit
+ const hit = hits[0];
+ let actual;
+ try {
+ actual = evalNumericExpr(hit.expr);
+ } catch (err) {
+ rows.push({
+ status: "FAIL",
+ label: spec.name,
+ detail: `cannot parse '${hit.expr}' in ${hit.file}: ${err.message}`,
+ });
+ failures++;
+ continue;
+ }
+ if (actual === spec.expected) {
+ rows.push({
+ status: "PASS",
+ label: spec.name,
+ detail: `${actual} (${hit.file})`,
+ });
+ } else {
+ rows.push({
+ status: "FAIL",
+ label: spec.name,
+ detail: `expected ${spec.expected}, found ${actual} in ${hit.file} (${hit.expr})`,
+ });
+ failures++;
+ }
+ }
+
+ for (const spec of OBJECT_PROP_EXPECTATIONS) {
+ const hits = findObjectProperty(files, spec.objectName, spec.propName).filter(
+ (h) => !h.isTest,
+ );
+ if (hits.length === 0) {
+ rows.push({
+ status: "FAIL",
+ label: spec.label,
+ detail: "property not found",
+ });
+ failures++;
+ continue;
+ }
+ const hit = hits[0];
+ let actual;
+ try {
+ actual = evalNumericExpr(hit.expr);
+ } catch (err) {
+ rows.push({
+ status: "FAIL",
+ label: spec.label,
+ detail: `cannot parse '${hit.expr}': ${err.message}`,
+ });
+ failures++;
+ continue;
+ }
+ if (actual === spec.expected) {
+ rows.push({
+ status: "PASS",
+ label: spec.label,
+ detail: `${actual} (${hit.file})`,
+ });
+ } else {
+ rows.push({
+ status: "FAIL",
+ label: spec.label,
+ detail: `expected ${spec.expected}, found ${actual} in ${hit.file}`,
+ });
+ failures++;
+ }
+ }
+
+ for (const sym of SYMBOL_EXPECTATIONS) {
+ const found = files.some((f) => {
+ try {
+ return readFileSync(f, "utf8").includes(sym);
+ } catch {
+ return false;
+ }
+ });
+ if (found) {
+ rows.push({ status: "PASS", label: sym, detail: "symbol present" });
+ } else {
+ rows.push({ status: "FAIL", label: sym, detail: "symbol missing" });
+ failures++;
+ }
+ }
+
+ const obl = countObligationFamilies(files);
+ const missing = EXPECTED_OBLIGATION_FAMILIES.filter((k) => !obl.keys.includes(k));
+ const extra = obl.keys.filter((k) => !EXPECTED_OBLIGATION_FAMILIES.includes(k));
+ if (
+ obl.count === EXPECTED_OBLIGATION_FAMILIES.length &&
+ missing.length === 0 &&
+ extra.length === 0
+ ) {
+ rows.push({
+ status: "PASS",
+ label: "ReconstructionObligationFamilies",
+ detail: `${obl.count} families (${obl.file})`,
+ });
+ } else {
+ rows.push({
+ status: "FAIL",
+ label: "ReconstructionObligationFamilies",
+ detail: `expected ${EXPECTED_OBLIGATION_FAMILIES.length}, found ${obl.count}; missing=[${missing}] extra=[${extra}] (${obl.file})`,
+ });
+ failures++;
+ }
+
+ // Asar integrity disclosure (recent REA commits) β€” presence check, not a numeric cap
+ const asarListing = files.find((f) => f.endsWith("AsarListing.ts"));
+ if (asarListing) {
+ const text = readFileSync(asarListing, "utf8");
+ const hasBlockLimitation =
+ text.includes("ASAR block integrity declarations were not validated") ||
+ text.includes("BLOCK_INTEGRITY_LIMITATION");
+ const hasUnsupportedAlgo =
+ text.includes("unsupported algorithm") ||
+ text.includes("uses an unsupported algorithm");
+ if (hasBlockLimitation && hasUnsupportedAlgo) {
+ rows.push({
+ status: "PASS",
+ label: "AsarIntegrityDisclosure",
+ detail:
+ "REA discloses unverified block integrity + unsupported algorithms (no new numeric cap)",
+ });
+ } else {
+ rows.push({
+ status: "FAIL",
+ label: "AsarIntegrityDisclosure",
+ detail: "expected block-integrity / unsupported-algorithm disclosure text missing",
+ });
+ failures++;
+ }
+ } else {
+ rows.push({
+ status: "FAIL",
+ label: "AsarIntegrityDisclosure",
+ detail: "AsarListing.ts not found",
+ });
+ failures++;
+ }
+
+ console.log("");
+ const labelWidth = Math.max(...rows.map((r) => r.label.length), 10);
+ for (const row of rows) {
+ const pad = " ".repeat(labelWidth - row.label.length);
+ console.log(`${row.status.padEnd(4)} ${row.label}${pad} ${row.detail}`);
+ }
+ console.log("");
+ console.log(
+ failures === 0
+ ? `OK ${rows.length} checks passed β€” BLA catalog is aligned with REA.`
+ : `DRIFT ${failures}/${rows.length} checks failed β€” update src/identity.ts / rea-budget-matrix.ts / obligation-flooder.ts.`,
+ );
+ process.exit(failures === 0 ? 0 : 1);
+}
+
+main();
diff --git a/src/identity.ts b/src/identity.ts
index 479b443..7e2500a 100644
--- a/src/identity.ts
+++ b/src/identity.ts
@@ -67,22 +67,24 @@ export const REA_INTERNAL_LIMITS = Object.freeze({
WASM_INTERFACE_REPRESENTATION_BYTES: 33_554_432,
/** .NET Managed metadata representation budget (`MAX_METADATA_REPRESENTATION_BYTES` = 64 MiB). */
MANAGED_METADATA_REPRESENTATION_BYTES: 67_108_864,
- /** LLDB native call tracer aggregate JSON byte cap (`MAX_TRACE_BYTES` = 8 MiB in `bridge/native/rea_lldb_tracer.py:30`). */
+ /** CDP/Web runtime aggregate script-source budget (`WEB_RUNTIME_LIMITS.sourceBytes` = 32 MiB in `src/domain/webRuntime.ts`). */
+ WEB_RUNTIME_SOURCE_BYTES: 33_554_432,
+ /** LLDB native call tracer aggregate JSON byte cap (`MAX_TRACE_BYTES` = 8 MiB in `bridge/native/rea_lldb_tracer.py`). */
LLDB_MAX_TRACE_BYTES: 8_388_608,
- /** LLDB native call tracer aggregate frame cap (`MAX_TRACE_FRAMES` = 65,536 in `bridge/native/rea_lldb_tracer.py:31`). */
+ /** LLDB native call tracer aggregate frame cap (`MAX_TRACE_FRAMES` = 65,536 in `bridge/native/rea_lldb_tracer.py`). */
LLDB_MAX_TRACE_FRAMES: 65_536,
- /** LLDB native call tracer non-breakpoint stop cap (`MAX_OTHER_STOPS` = 256 in `bridge/native/rea_lldb_tracer.py:29`). */
+ /** LLDB native call tracer non-breakpoint stop cap (`MAX_OTHER_STOPS` = 256 in `bridge/native/rea_lldb_tracer.py`). */
LLDB_MAX_OTHER_STOPS: 256,
- /** LLDB Objective-C selector C-string read cap (`MAX_SELECTOR_BYTES` = 1024 in `bridge/native/rea_lldb_tracer.py:27`). */
+ /** LLDB Objective-C selector C-string read cap (`MAX_SELECTOR_BYTES` = 1024 in `bridge/native/rea_lldb_tracer.py`). */
LLDB_MAX_SELECTOR_BYTES: 1_024,
- /** GDB session command output byte cap (`MAX_COMMAND_OUTPUT_BYTES` = 16 MiB in `src/gdb/GdbSessionManager.ts:422`). */
+ /** GDB session command output byte cap (`MAX_COMMAND_OUTPUT_BYTES` = 16 MiB in `src/gdb/GdbSessionManager.ts`). */
GDB_MAX_COMMAND_OUTPUT_BYTES: 16_777_216,
- /** GDB session MI output record cap (`MAX_COMMAND_OUTPUT_RECORDS` = 16,384 in `src/gdb/GdbSessionManager.ts:423`). */
+ /** GDB session MI output record cap (`MAX_COMMAND_OUTPUT_RECORDS` = 16,384 in `src/gdb/GdbSessionManager.ts`). */
GDB_MAX_COMMAND_OUTPUT_RECORDS: 16_384,
- /** Rizin debugger session frame byte cap (`MAX_FRAME_BYTES` = 16 MiB in `src/rizin/RizinDebugSessionManager.ts:52`). */
+ /** Rizin debugger session frame byte cap (`MAX_FRAME_BYTES` = 16 MiB in `src/rizin/RizinDebugSessionManager.ts`). */
RIZIN_MAX_FRAME_BYTES: 16_777_216,
- /** Rizin debugger command frame count cap (`MAX_COMMAND_FRAMES` = 4,096 in `src/rizin/RizinDebugSessionManager.ts:55`). */
+ /** Rizin debugger command frame count cap (`MAX_COMMAND_FRAMES` = 4,096 in `src/rizin/RizinDebugSessionManager.ts`). */
RIZIN_MAX_COMMAND_FRAMES: 4_096,
- /** Environment differential comparison per-step diff cap (`STEP_DIFFERENCE_LIMIT` = 20 in `src/application/environment/environmentCompareDiff.ts:52`). */
+ /** Environment differential comparison per-step diff cap (`STEP_DIFFERENCE_LIMIT` = 20 in `src/application/environment/environmentCompareDiff.ts`). */
ENVIRONMENT_COMPARE_STEP_DIFF_LIMIT: 20,
});
diff --git a/src/shields/exhaustion/obligation-flooder.ts b/src/shields/exhaustion/obligation-flooder.ts
index 6133b4c..fc93ec3 100644
--- a/src/shields/exhaustion/obligation-flooder.ts
+++ b/src/shields/exhaustion/obligation-flooder.ts
@@ -10,13 +10,15 @@ export interface ObligationFloodResult {
}
/**
- * All 22 REA Reconstruction Obligation Node Families from
+ * All 25 REA Reconstruction Obligation Node Families from
* `morluto/rea/src/application/ReconstructionObligationPolicies.ts`.
* Each family forces REA's `ReconstructionObligationLedgerService` to require
* 2 to 4 distinct runtime/static proof fixtures (`positive`, `negative`, `malformed`,
* `cancellation`, `teardown`) before an agent can mark a reconstruction verified.
*/
export const REA_OBLIGATION_FAMILIES = [
+ { kind: "package", layer: "packaging", cases: 3 },
+ { kind: "installer", layer: "packaging", cases: 3 },
{ kind: "context-bridge-api", layer: "electron", cases: 3 },
{ kind: "ipc-channel", layer: "electron", cases: 3 },
{ kind: "ipc-handler", layer: "electron", cases: 3 },
@@ -26,6 +28,8 @@ export const REA_OBLIGATION_FAMILIES = [
{ kind: "service-worker", layer: "process", cases: 3 },
{ kind: "native-addon", layer: "native-abi", cases: 2 },
{ kind: "native-export", layer: "native-abi", cases: 2 },
+ { kind: "managed-pinvoke-import", layer: "native-abi", cases: 2 },
+ { kind: "managed-native-implementation", layer: "native-abi", cases: 2 },
{ kind: "child-process", layer: "process", cases: 4 },
{ kind: "stdio", layer: "process", cases: 3 },
{ kind: "signal", layer: "process", cases: 3 },
@@ -38,7 +42,6 @@ export const REA_OBLIGATION_FAMILIES = [
{ kind: "timer", layer: "runtime", cases: 3 },
{ kind: "promise", layer: "runtime", cases: 3 },
{ kind: "task", layer: "runtime", cases: 3 },
- { kind: "package", layer: "packaging", cases: 3 },
] as const;
/**
@@ -189,6 +192,21 @@ export function generateObligationLedgerFlood(
` _g._blaPackageManifest_${id} = { name: "@enclave/runtime-${id}", version: "3.1.0-tee" };`,
);
break;
+ case "installer":
+ stmts.push(
+ ` _g._blaInstallerHook_${id}?.runPostInstall?.({ product: "enclave-runtime-${id}", channel: "stable-tee" });`,
+ );
+ break;
+ case "managed-pinvoke-import":
+ stmts.push(
+ ` _g.DllImport?.("enclave_native_${id}.dll", { EntryPoint: "UnsealSlot_${id}" });`,
+ );
+ break;
+ case "managed-native-implementation":
+ stmts.push(
+ ` _g._blaManagedNative_${id}?.InvokeEnclaveExport?.("seal_payload_${id}", new Uint8Array(0));`,
+ );
+ break;
}
}
diff --git a/src/shields/exhaustion/rea-budget-matrix.ts b/src/shields/exhaustion/rea-budget-matrix.ts
index c281303..a862e0e 100644
--- a/src/shields/exhaustion/rea-budget-matrix.ts
+++ b/src/shields/exhaustion/rea-budget-matrix.ts
@@ -17,7 +17,7 @@ export interface ReaSubsystemBudgetSpec {
export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
{
id: "js-primitive-candidates",
- reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts:7",
+ reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts",
constantName: "SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT",
hardLimit: 256,
unit: "alternatives",
@@ -27,7 +27,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "js-expression-depth",
- reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts:9",
+ reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts",
constantName: "SEMANTIC_EXPRESSION_DEPTH_LIMIT",
hardLimit: 256,
unit: "levels",
@@ -37,7 +37,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "js-getter-expansion",
- reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts:11",
+ reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts",
constantName: "SEMANTIC_GETTER_EXPANSION_LIMIT",
hardLimit: 512,
unit: "states",
@@ -47,7 +47,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "js-alias-selections",
- reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts:13",
+ reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts",
constantName: "SEMANTIC_ALIAS_SELECTION_LIMIT",
hardLimit: 512,
unit: "states",
@@ -57,7 +57,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "js-primitive-json-bytes",
- reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts:15",
+ reaSourceFile: "src/domain/javascript/javascriptSemanticResourceLimits.ts",
constantName: "SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT",
hardLimit: 1_048_576,
unit: "bytes",
@@ -67,7 +67,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "wasm-interface-representation",
- reaSourceFile: "src/domain/wasm/wasmInterface.ts:90",
+ reaSourceFile: "src/domain/wasm/wasmInterface.ts",
constantName: "WASM_INTERFACE_REPRESENTATION_BYTES",
hardLimit: 33_554_432,
unit: "bytes",
@@ -78,7 +78,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "sqlite-column-evaluation",
- reaSourceFile: "src/sqlite/SqliteDatabaseLimits.ts:28",
+ reaSourceFile: "src/sqlite/SqliteDatabaseLimits.ts",
constantName: "SqliteColumnEvaluationFailure",
hardLimit: 1,
unit: "states",
@@ -89,7 +89,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "safetensors-json-nesting",
- reaSourceFile: "src/model/SafetensorsHeader.ts:74",
+ reaSourceFile: "src/model/SafetensorsHeader.ts",
constantName: "MODEL_JSON_NESTING",
hardLimit: 32,
unit: "levels",
@@ -99,7 +99,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "gguf-metadata-nesting",
- reaSourceFile: "src/model/GgufHeader.ts:121",
+ reaSourceFile: "src/model/GgufHeader.ts",
constantName: "MODEL_METADATA_NESTING",
hardLimit: 32,
unit: "levels",
@@ -109,9 +109,9 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "cdp-script-source-budget",
- reaSourceFile: "src/browser/CdpScriptSourceBudget.ts:10",
+ reaSourceFile: "src/domain/webRuntime.ts",
constantName: "WEB_RUNTIME_LIMITS.sourceBytes",
- hardLimit: 16_777_216,
+ hardLimit: 33_554_432,
unit: "bytes",
failureClassOrStatus: "CDP_SCRIPT_SOURCE_BYTES_OMISSION_REASON",
counterStrategy:
@@ -119,7 +119,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "lldb-trace-frames",
- reaSourceFile: "bridge/native/rea_lldb_tracer.py:31",
+ reaSourceFile: "bridge/native/rea_lldb_tracer.py",
constantName: "MAX_TRACE_FRAMES",
hardLimit: 65_536,
unit: "states",
@@ -129,7 +129,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "lldb-other-stops",
- reaSourceFile: "bridge/native/rea_lldb_tracer.py:29",
+ reaSourceFile: "bridge/native/rea_lldb_tracer.py",
constantName: "MAX_OTHER_STOPS",
hardLimit: 256,
unit: "states",
@@ -139,7 +139,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "gdb-command-output-records",
- reaSourceFile: "src/gdb/GdbSessionManager.ts:423",
+ reaSourceFile: "src/gdb/GdbSessionManager.ts",
constantName: "MAX_COMMAND_OUTPUT_RECORDS",
hardLimit: 16_384,
unit: "states",
@@ -149,7 +149,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "rizin-command-frames",
- reaSourceFile: "src/rizin/RizinDebugSessionManager.ts:55",
+ reaSourceFile: "src/rizin/RizinDebugSessionManager.ts",
constantName: "MAX_COMMAND_FRAMES",
hardLimit: 4_096,
unit: "states",
@@ -159,7 +159,7 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
},
{
id: "environment-compare-step-diff",
- reaSourceFile: "src/application/environment/environmentCompareDiff.ts:52",
+ reaSourceFile: "src/application/environment/environmentCompareDiff.ts",
constantName: "STEP_DIFFERENCE_LIMIT",
hardLimit: 20,
unit: "states",
@@ -269,7 +269,7 @@ export function getExhaustionProfileForIntensity(intensity: ProtectionIntensity)
aliasSelectorCount: 640,
cartesianBranchCount: 36,
cartesianStringLength: 260,
- obligationDecoyFamilies: 22,
+ obligationDecoyFamilies: 25,
sccClusterCount: 8,
};
}
diff --git a/src/shields/runtime/memory-diff-shield.ts b/src/shields/runtime/memory-diff-shield.ts
index 686ccf0..d3fd9cf 100644
--- a/src/shields/runtime/memory-diff-shield.ts
+++ b/src/shields/runtime/memory-diff-shield.ts
@@ -30,7 +30,7 @@ export interface SplitShareEncodedString {
* 1. Allocates a pool of mutable, high-salience decoy state slots (`aesRoundKeySchedule`,
* `licenseLeaseLedger`, `enclavePcrDigest`, `sessionTicketRing`) plus >= 26 top-level
* mutable state keys (exceeding REA's `STEP_DIFFERENCE_LIMIT = 20` in
- * `src/application/environment/environmentCompareDiff.ts:52`).
+ * `src/application/environment/environmentCompareDiff.ts`).
* 2. Exposes an $O(1)$ deterministic stepper (`_blaStepShadowHeap_<tag>(delta)`) woven
* into real function prologues so every business function execution synchronously
* mutates dozens of decoy memory words in-place.
@@ -50,7 +50,7 @@ export function generateShadowHeapChurnShield(
: intensity === "maximum"
? 48
: 64;
- // Exceeds REA's `STEP_DIFFERENCE_LIMIT = 20` (`environmentCompareDiff.ts:52`)
+ // Exceeds REA's `STEP_DIFFERENCE_LIMIT = 20` (`environmentCompareDiff.ts`)
const diffOverflowFieldsCount =
REA_INTERNAL_LIMITS.ENVIRONMENT_COMPARE_STEP_DIFF_LIMIT +
(intensity === "stealth" ? 4 : intensity === "balanced" ? 8 : 12);
diff --git a/tests/exhaustion-suite.test.ts b/tests/exhaustion-suite.test.ts
index 9550554..78b652a 100644
--- a/tests/exhaustion-suite.test.ts
+++ b/tests/exhaustion-suite.test.ts
@@ -23,7 +23,7 @@ describe("Counter-REA Resource Exhaustion Suite", () => {
expect(charge.amplificationRatio).toBeGreaterThan(100);
});
- it("floods all 22 REA ReconstructionObligationLedger families in bankrupt mode without runtime side effects", () => {
+ it("floods all 25 REA ReconstructionObligationLedger families in bankrupt mode without runtime side effects", () => {
const prng = new SeededPrng("test-obligation-flood");
const flood = generateObligationLedgerFlood(prng, "bankrupt");
expect(flood.totalDecoyObligations).toBe(REA_OBLIGATION_FAMILIES.length);
@@ -76,7 +76,7 @@ describe("Counter-REA Resource Exhaustion Suite", () => {
"bankrupt",
);
expect(suiteA.combinedJsCode).toBe(suiteB.combinedJsCode);
- expect(suiteA.totalDecoyObligations).toBe(22);
+ expect(suiteA.totalDecoyObligations).toBe(25);
expect(suiteA.totalLabyrinthNodes).toBe(40);
});
});