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(identity): track Go/Flutter/BEAM/EVM/PCAP/GPU/firmware REA budgets

qybaihea7f7c35199ef
diff --git a/scripts/verify-rea-constants.mjs b/scripts/verify-rea-constants.mjs
index ef4bc39..6cb007b 100755
--- a/scripts/verify-rea-constants.mjs
+++ b/scripts/verify-rea-constants.mjs
@@ -157,6 +157,17 @@ const NUMERIC_EXPECTATIONS = [
{ name: "MAX_RUSTC_HASHES", expected: 64 },
{ name: "MAX_SNAPSHOT_HASH_CANDIDATES", expected: 64 },
{ name: "PYTHON_PYC_CONST_PREVIEW_LIMIT", expected: 80 },
+ { name: "MAX_BUILD_INFO_BYTES", expected: 1_048_576, fileHint: "GoBinaryImage" },
+ { name: "MAX_HEADER_SEARCH_BYTES", expected: 256 * 1024 * 1024, fileHint: "GoBinaryImage" },
+ { name: "MAX_POOL_URIS", expected: 500, fileHint: "FlutterBuildProvider" },
+ { name: "MAX_POOL_TOKENS", expected: 2_000, fileHint: "FlutterBuildProvider" },
+ { name: "MAX_INSPECT_ERLANG_BEAM_CHUNKS", expected: 256 },
+ { name: "MAX_INSPECT_ERLANG_BEAM_ATOMS", expected: 65_536 },
+ { name: "TSHARK_JSON_MAX_BYTES", expected: 8 * 1024 * 1024 },
+ { name: "GPU_REPORT_BYTES", expected: 16 * 1024 * 1024 },
+ { name: "GPU_OBJECT_BYTES", expected: 128 * 1024 * 1024 },
+ { name: "MAX_FIRMWARE_STAGING_BYTES", expected: 512 * 1024 * 1024 },
+ { name: "MAX_FIRMWARE_EXTRACTION_DEPTH", expected: 10 },
];
const OBJECT_PROP_EXPECTATIONS = [
@@ -172,6 +183,24 @@ const OBJECT_PROP_EXPECTATIONS = [
expected: 8 * 1024 * 1024,
label: "WEB_RUNTIME_LIMITS.retainedEventBytes",
},
+ {
+ objectName: "EVM_INTERFACE_LIMITS",
+ propName: "inputBytes",
+ expected: 4 * 1024 * 1024,
+ label: "EVM_INTERFACE_LIMITS.inputBytes",
+ },
+ {
+ objectName: "EVM_INTERFACE_LIMITS",
+ propName: "outputBytes",
+ expected: 16 * 1024 * 1024,
+ label: "EVM_INTERFACE_LIMITS.outputBytes",
+ },
+ {
+ objectName: "EVM_INTERFACE_LIMITS",
+ propName: "diagnosticBytes",
+ expected: 1 * 1024 * 1024,
+ label: "EVM_INTERFACE_LIMITS.diagnosticBytes",
+ },
];
const SYMBOL_EXPECTATIONS = [
diff --git a/src/identity.ts b/src/identity.ts
index 7e2500a..553f127 100644
--- a/src/identity.ts
+++ b/src/identity.ts
@@ -87,4 +87,36 @@ export const REA_INTERNAL_LIMITS = Object.freeze({
RIZIN_MAX_COMMAND_FRAMES: 4_096,
/** Environment differential comparison per-step diff cap (`STEP_DIFFERENCE_LIMIT` = 20 in `src/application/environment/environmentCompareDiff.ts`). */
ENVIRONMENT_COMPARE_STEP_DIFF_LIMIT: 20,
+ /** Go build-info aggregate string budget (`MAX_BUILD_INFO_BYTES` = 1 MiB in `src/go/GoBinaryImage.ts`). */
+ GO_MAX_BUILD_INFO_BYTES: 1_048_576,
+ /** Go build-info cumulative header-search budget (`MAX_HEADER_SEARCH_BYTES` = 256 MiB in `src/go/GoBinaryImage.ts`). */
+ GO_MAX_HEADER_SEARCH_BYTES: 268_435_456,
+ /** Flutter/Dart AOT string-pool URI projection cap (`MAX_POOL_URIS` = 500 in `src/flutter/FlutterBuildProvider.ts`). */
+ DART_MAX_POOL_URIS: 500,
+ /** Flutter/Dart AOT class-like token projection cap (`MAX_POOL_TOKENS` = 2_000 in `src/flutter/FlutterBuildProvider.ts`). */
+ DART_MAX_POOL_TOKENS: 2_000,
+ /** Erlang BEAM hard ceiling on IFF chunks (`MAX_INSPECT_ERLANG_BEAM_CHUNKS` = 256). */
+ BEAM_MAX_CHUNKS: 256,
+ /** Erlang BEAM hard ceiling on atom-table entries (`MAX_INSPECT_ERLANG_BEAM_ATOMS` = 65_536). */
+ BEAM_MAX_ATOMS: 65_536,
+ /** Erlang BEAM default max_chunks admission (schema default 64). */
+ BEAM_DEFAULT_MAX_CHUNKS: 64,
+ /** Erlang BEAM default max_atoms admission (schema default 4096). */
+ BEAM_DEFAULT_MAX_ATOMS: 4_096,
+ /** EVM interface worker input-byte ceiling (`EVM_INTERFACE_LIMITS.inputBytes` = 4 MiB). */
+ EVM_INPUT_BYTES: 4_194_304,
+ /** EVM interface worker reply-byte ceiling (`EVM_INTERFACE_LIMITS.outputBytes` = 16 MiB). */
+ EVM_OUTPUT_BYTES: 16_777_216,
+ /** EVM interface diagnostic capture ceiling (`EVM_INTERFACE_LIMITS.diagnosticBytes` = 1 MiB). */
+ EVM_DIAGNOSTIC_BYTES: 1_048_576,
+ /** tshark JSON decode ceiling (`TSHARK_JSON_MAX_BYTES` = 8 MiB in `src/pcap/PcapOutput.ts`). */
+ PCAP_TSHARK_JSON_MAX_BYTES: 8_388_608,
+ /** GPU retained report budget (`GPU_REPORT_BYTES` = 16 MiB in `src/gpu/GpuSource.ts`). */
+ GPU_REPORT_BYTES: 16_777_216,
+ /** GPU object decode budget (`GPU_OBJECT_BYTES` = 128 MiB in `src/gpu/GpuSource.ts`). */
+ GPU_OBJECT_BYTES: 134_217_728,
+ /** Firmware staging byte ceiling (`MAX_FIRMWARE_STAGING_BYTES` = 512 MiB). */
+ FIRMWARE_MAX_STAGING_BYTES: 536_870_912,
+ /** Firmware extraction depth ceiling (`MAX_FIRMWARE_EXTRACTION_DEPTH` = 10). */
+ FIRMWARE_MAX_EXTRACTION_DEPTH: 10,
});
diff --git a/src/shields/exhaustion/rea-budget-matrix.ts b/src/shields/exhaustion/rea-budget-matrix.ts
index a862e0e..b24f25a 100644
--- a/src/shields/exhaustion/rea-budget-matrix.ts
+++ b/src/shields/exhaustion/rea-budget-matrix.ts
@@ -167,6 +167,86 @@ export const REA_BUDGET_BREAKER_MATRIX: readonly ReaSubsystemBudgetSpec[] = [
counterStrategy:
"Mutate > 24 decoy state fields per step so real state diffs are pushed past REA's 20-difference per-step retention window.",
},
+ {
+ id: "go-buildinfo-bytes",
+ reaSourceFile: "src/go/GoBinaryImage.ts",
+ constantName: "MAX_BUILD_INFO_BYTES",
+ hardLimit: 1_048_576,
+ unit: "bytes",
+ failureClassOrStatus: 'BinaryResourceFailure("build-info", 1 MiB)',
+ counterStrategy:
+ "Embed a framed Go buildinfo (magic + inline module) whose version+module strings exceed 1 MiB, plus .gopclntab/moduledata bait.",
+ },
+ {
+ id: "flutter-pool-uris",
+ reaSourceFile: "src/flutter/FlutterBuildProvider.ts",
+ constantName: "MAX_POOL_URIS",
+ hardLimit: 500,
+ unit: "states",
+ failureClassOrStatus: "string_pool.collectionCapped (package_uris/dart_uris)",
+ counterStrategy:
+ "Inject > 500 distinct package: and dart: printable runs into Dart isolate snapshot / native trailer.",
+ },
+ {
+ id: "flutter-pool-tokens",
+ reaSourceFile: "src/flutter/FlutterBuildProvider.ts",
+ constantName: "MAX_POOL_TOKENS",
+ hardLimit: 2_000,
+ unit: "states",
+ failureClassOrStatus: "string_pool.collectionCapped (class_like_tokens)",
+ counterStrategy:
+ "Inject > 2000 distinct identifier-shaped class-like tokens into Dart isolate snapshot / native trailer.",
+ },
+ {
+ id: "erlang-beam-chunks",
+ reaSourceFile: "src/domain/erlang/beam.ts",
+ constantName: "MAX_INSPECT_ERLANG_BEAM_CHUNKS",
+ hardLimit: 256,
+ unit: "states",
+ failureClassOrStatus: 'BeamCapacityFailure("chunks")',
+ counterStrategy:
+ "Emit a valid FOR1/BEAM with > default max_chunks (64) decoy IFF chunks (and up to hard ceiling 256).",
+ },
+ {
+ id: "erlang-beam-atoms",
+ reaSourceFile: "src/domain/erlang/beam.ts",
+ constantName: "MAX_INSPECT_ERLANG_BEAM_ATOMS",
+ hardLimit: 65_536,
+ unit: "states",
+ failureClassOrStatus: 'BeamCapacityFailure("atoms")',
+ counterStrategy:
+ "Pad AtU8 atom table past the schema default max_atoms (4096) with canary/diagnostic atom names.",
+ },
+ {
+ id: "evm-input-bytes",
+ reaSourceFile: "src/evm/EvmoleRelease.ts",
+ constantName: "EVM_INTERFACE_LIMITS.inputBytes",
+ hardLimit: 4_194_304,
+ unit: "bytes",
+ failureClassOrStatus: "EVM carrier input allowance exhausted",
+ counterStrategy:
+ "Append adversarial Solidity metadata CBOR + optional padding that approaches the 4 MiB inputBytes ceiling.",
+ },
+ {
+ id: "pcap-tshark-json",
+ reaSourceFile: "src/pcap/PcapOutput.ts",
+ constantName: "TSHARK_JSON_MAX_BYTES",
+ hardLimit: 8_388_608,
+ unit: "bytes",
+ failureClassOrStatus: "tshark JSON output exceeds 8 MiB",
+ counterStrategy:
+ "Inject high-volume decoy packets whose decoded JSON projection exceeds TSHARK_JSON_MAX_BYTES.",
+ },
+ {
+ id: "gpu-report-bytes",
+ reaSourceFile: "src/gpu/GpuSource.ts",
+ constantName: "GPU_REPORT_BYTES",
+ hardLimit: 16_777_216,
+ unit: "bytes",
+ failureClassOrStatus: "GPU facts exceed the 16 MiB retained report budget",
+ counterStrategy:
+ "Pad PTX modules with decoy .entry/.param declarations and canary comments toward GPU_REPORT_BYTES.",
+ },
] as const;
/**