github qybaihe/bla bla-agents-3.5.0
bla-agents: v3.5.0

14 days ago

bla-agents 3.5.0

End-to-end pass over the agent journey — "MCP server and skill are registered, now harden my project" — so a coding agent can take a real project from build output to a shipped, working, protected build, and is told plainly what was not covered.

Added

  • Ship it: apply / restore (src/engine/harden-apply.ts, src/engine/harden.ts, src/cli.ts, src/mcp/server.ts): bla harden . --apply / bla_harden { apply: true } promotes the hardened files over the build output they came from (build-output directories only — never source), keeps the originals in a per-user state directory outside the project (BLA_STATE_DIR overrides it), re-hardens from those originals on a re-run, and rolls back completely if a copy fails. --restore / restore: true puts the originals back and leaves rebuilt files alone. Over MCP the promotion always answers confirmation_required first.
  • sqliteEvalTrap (CLI --sqlite-eval-trap, MCP sqlite_eval_trap on bla_harden / bla_defend / bla_protect, .blarc "sqliteEvalTrap"): opt in to the function form of the SQLite honey tables' generated columns — the one REA's inspector fails on (SqliteColumnEvaluationFailure). The report lists the databases it was applied to (sqliteEvalTrapArtifacts) and says what stops working on them and how the application can keep its maintenance commands (register enclave_unseal_payload on its own connection).
  • exclude (bla_harden / bla_discover exclude, CLI --exclude, .blarc "exclude"): project-relative paths or globs to leave out, for the one file that breaks or slows the program when hardened. Everything else is still protected, the excluded files are listed in the report (excluded) as shipping unprotected, and an apply re-run puts a previously promoted file back to the build's original.
  • Size accounting: harden reports state what the output costs to ship — outputSize (inputBytes → outputBytes, largestGrowth) and per-artifact inputBytes / outputBytes, a Size: line in the CLI report, and a nextSteps entry when the hardened files are a megabyte or more larger (a 41-byte WASM module is about 7 MB at bankrupt and about 24 KB at maximum).
  • nextSteps on every harden report: what to do next, most important first — the mirror is not shipped yet, how to promote it, which artifacts failed, what the integrity binding does not cover, which literals survived, which WASM exports were renamed, and to run the project's own tests. In a git work tree that does not ignore the .bla-hardened/ mirror, it also says to add it to .gitignore.
  • Server playbook in initialize (BLA_MCP_INSTRUCTIONS): the MCP server now returns instructions (build → bla_harden → follow nextSteps → apply → run tests, plus the rules about isError, BLA output and scores), so an agent that never loads the skill still gets the sequence. Protocol revisions 2024-11-05, 2025-03-26 and 2025-06-18 are negotiated instead of always answering the oldest.
  • Registry of BLA's own output (src/core/output-registry.ts): a content-addressed, out-of-band record of every file BLA wrote. Discovery and the directory lints skip such files (skippedHardenedOutputs) — hardened output is never hardened twice, and BLA's decoys are no longer reported as plaintext secrets or lane gates that then refuse the next run.
  • Honest integrity-binding coverage: integrityBindingEntry (the JS module that pins its siblings), integrityBindingUncoveredEntries (declared package.json entry points that never load it), integrityBindingSkipped (browser bundles, writable SQLite, files the entry cannot read), and pythonSidecarEntry. The coverage matrix lists only edges the hardened tree enforces.
  • plaintextSurvivors per artifact: sensitive-looking literals still readable in hardened JS/TS/HTML, with source lines and clipped previews.
  • WASM consumer contract: wasmExportRenames (old → new map) and wasmExportsAutoPreserved (exports kept because a project file calls them) on harden / defend reports; names a host looks up by specification (_start, memory, __wbindgen_*, cabi_realloc, …) are never renamed.
  • bla_verify_weave scope: a directory verdict rests on the crown-jewel files (requiredFiles); other source files are advisoryFiles. scope: "all" restores the every-file verdict, verbose: true includes advisory reports.
  • bla doctor --verify-handshake / bla_doctor { verify_handshake: true }, versionSkew for a client pinned to another release, and nextSteps with the repair command. The MCP payload lists only detected clients (clientsNotDetected carries the rest by id).
  • The skill is served as MCP resources (bla://skill/SKILL.md, bla://skill/references/*.md), and instructions points at them: a client that only registered the server — a checked-in .mcp.json — can read the full guide. bla://docs/weave-decoy-mcp is now a short pointer instead of a second copy of the directives.
  • bla doctor reads project-scoped MCP configs (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, .gemini/settings.json, .codex/config.toml, opencode.json) into projectRegistrations (MCP: directory), with the same resolvable / pinned-release / handshake checks. A project that checks in its registration is no longer told that BLA is not registered.
  • bla_lint findings carry enforcedByHarden — true only for a finding bla_harden actually refuses on — so a lint-only finding (plaintext-secret, integrity-coverage, bind-scope) or a warning is no longer reported as something that blocks hardening.
  • scripts/link-self-bin.mjs: npm run build links the package's own bins into node_modules/.bin, so the checked-in .mcp.json (npx bla-agents@<version> mcp) starts inside the repository instead of failing with bla: command not found.

Changed

  • A hardened SQLite database works everywhere by default (src/shields/formats/sqlite.ts): through 3.4.3 the honey tables' generated columns called enclave_unseal_payload(), a function only BLA's own connections registered — so PRAGMA integrity_check, PRAGMA quick_check, VACUUM, VACUUM INTO and restoring a .dump failed for the application itself. The columns are now plain SQL; the function form is opt-in (sqliteEvalTrap). Re-hardening a database from an older release rebuilds its honey tables and keeps their rows.
  • SQLite reports say what the shield does not do (src/engine/defense-score-honesty.ts, src/engine/auditor.ts, src/engine/harden.ts): the application's own tables are stored as before and any client reads them, so a hardened database is no longer scored 93: sqlite-business-data-readable caps it at 78, and sqlite-decoy-columns-evaluable at 68 without the evaluation trap. The harden report carries a nextSteps line to that effect, the audit lists the application tables as exposed, and no longer claims SqliteColumnEvaluationFailure for columns an inspector can evaluate. bla defend <db> under the default minDefenseScore: 90 now exits 2 — lower the threshold (--fail-under) if a decorated database is what you intend to ship.
  • Discovery targets the release artifact (src/engine/harden.ts, src/core/dev-tooling.ts): tool configs, test files, .d.ts declarations and the scripts package.json runs for build / test / release are left alone (skippedDevTooling); JS/TS/HTML beside a build-output directory are build inputs (skippedSourceFiles); declared runtime entries are always product code; release / Release on a case-insensitive file system is walked once; the output directory of an earlier run is never fed back in.
  • MCP results are sized for a model's context: a WASM bla_defend result drops from megabytes to tens of kilobytes (audit exposedItems capped and clipped with exposedItemsTotal / exposedItemsTruncated; the coverage contract appears once; no duplicate audit). The CLI's --json is unchanged.
  • Integrity-binding host: when package.json declares several entry points, the check is hosted in the one the others load (bin requires main ⇒ main), instead of whichever name sorts first.
  • Python integrity check follows the declared console script (src/engine/harden.ts, src/core/dev-tooling.ts): a project that declares console scripts (pyproject.toml [project.scripts] / [project.gui-scripts] / [tool.poetry.scripts], setup.cfg, setup.py) is started through the package those scripts import — an installed acme-tool never runs a run.py beside the package, so a check hosted there verified nothing and a patched licence gate went unnoticed. sidecar_entangle now puts the check in that package's outermost __init__.py (Python runs it on every way in), reports hardened files outside its directory in integrityBindingSkipped, and lists declared scripts that never import the checking module in the new pythonSidecarUncoveredEntries. Projects without declared scripts keep the previous choice.
  • Same seed, different text (JS and Python shields): output is still deterministic for a given source and seed, but differs from 3.4.3. The JS seed is mixed with a hash of the source, so two files hardened with one seed no longer share generated names. Classic scripts and UMD bundles keep every program-level name (those are the page's globals). Each function reads the predicate seed through a guard with a fallback, so removing the seed declaration no longer breaks the program, and the & | ^ rewrite keeps the original operator as the path for non-Number operands. Hardened .py files start with a private import builtins as _… alias, prefix the shield's own globals, and are always UTF-8.
  • Strings are written masked, not in clear pieces (src/shields/javascript/ast-shield.ts; tests/js-shield-secret-coverage.test.ts): through 3.4.3 a string at maximum / bankrupt was nine clear pieces, each behind an always-true condition. REA does not evaluate the conditions — it lists every combination of pieces as a candidate value. Measured against REA 05be423, an IPC channel came back at REA's default budgets, and a URL and a SHA-256 digest once semantic_precision was raised 4×. Each piece is now XOR-masked with a position-dependent key, spelled in the letters a–p, and decoded by a small self-contained function written where the string is used; none of the three values is in REA's result at 1×, 4× or 64× budgets (npm run redteam:rea, row javascript_strings). Short plain words ("click", "utf8") keep clear pieces, and the wrong piece beside each right one has its shape (hex beside hex, a digit for a digit, a letter for a letter of the same case) instead of hex noise that gave the real piece away. Cost: a 64-character digest adds about 2.5 KB, and decoding runs each time the expression is evaluated — a loop that builds strings measured about 2× slower than with clear pieces (282 ms against 137 ms for 300,000 iterations; 3 ms unhardened). Masking hides a value from a text search and from an analyzer that enumerates pieces, not from someone who runs the code: a real credential does not belong in a shipped file.
  • A secret is split wherever it is written: at maximum / bankrupt the literal pass split strings of 3–256 characters and nothing else, so the values most worth hiding stayed exactly as written — an embedded PEM block (too long), a digest inside a regular expression, a token used as an object key, the value of a class field. A value the plaintext lint reports as a shipped secret is now split in all of those places and up to 4,096 characters (about 20 bytes of output per character, 83 KB for the longest): an object key becomes a computed key (same property, same order, same inferred function name), a regular expression becomes new RegExp(<pieces>, flags), and class field values and computed member keys are encoded like any other string. Ordinary long strings, keys and patterns are untouched. Still out of reach, and listed in plaintextSurvivors: HTML attributes, tagged templates, class member names, the object keys and as const values of a TypeScript source, anything longer.
  • Red-team harness and drift checker follow REA 05be423 (scripts/redteam/, scripts/verify-rea-constants.mjs, docs/redteam/empirical-rea-validation.*): REA moved its analyzers and turned most fixed limits into per-call defaults (semantic_precision, max_chunks, asar.max_header_bytes, max_interface_bytes, producer_limits, …); its errors now name the setting to raise. The harness calls REA's current API, and a probe that cannot call REA is a harness error (status: "unverified", exit 2) instead of a budget hit — against REA HEAD the old harness recorded TypeError: … is not a function as a tripped budget. A new row, javascript_strings, looks for three known values at 1× / 4× / 64× budgets and fails the run if one comes back. The report records the REA commit and no local paths. npm run verify:rea maps the renamed constants (74 checks) and says which limits are defaults. The README table states per row whether the caller can raise the limit: a size-based plant stops REA as it runs by default and costs an attacker who raises the limit one retry. Model nesting (32), Electron fuse sentinels (32) and the tshark JSON cap are fixed in REA; the Go plant is now rejected as malformed before the size budget it was built for.
  • bla_redteam_report tells "not measured" from "REA read it" (src/engine/rea-observability.ts): unverified when the harness could not call the REA checkout for a probe — in the run it just executed, or in the run that wrote the report on disk — and fail only when REA read a hardened sample.
  • PCAP: the plant reaches REA's fixed tshark allowance (src/shields/formats/pcap-capture.ts, scripts/redteam/): re-measured against REA 05be423, the 3.4.x plant did not stop REA. REA does not dissect a capture in full: it asks tshark for 25 selected fields and holds only that output to the fixed 8 MiB TSHARK_JSON_MAX_BYTES — a larger output fails inspect_pcap_capture, not retryable, and REA has no setting for it. For the bankrupt sample that output was 116 KiB: the plant had been sized for a full dissection (12.2 MiB), which is also what the harness measured, and REA read all 160 packets. bankrupt now appends an answer flood: ten DNS responses whose 4,076 answers each name a 251-character owner through a 2-byte compression pointer, which tshark prints in full. REA's field pass is then 12.7 MiB and the capture is refused. The capture grows by 655 KB (1.35 → 2.0 MB); stealth / balanced / maximum output is byte-identical to before. estimatedTsharkJsonBytes is a lower bound of REA's field pass when the flood is planted (an upper bound for the ordinary decoys otherwise), exceedsTsharkJsonBudget says whether it passes the allowance, and answerFloodPackets / inspectPcapCapture().answerFloodPackets report the flood. A capture whose link type is not Ethernet gets no flood: tshark would not read its frames as DNS. The harness now finds tshark where REA would (REA_TSHARK_COMMAND, PATH, the Wireshark installer's location — it looked only in a Linux extract, so PCAP was skipped elsewhere), reads REA's tshark arguments from REA's own provider, runs both of REA's passes and hands the output to REA's parser. The report lists any format whose plant REA read through (notStopped), and bla_redteam_report names them in reason.
  • JS shield keeps what callers observe: exported and top-level function / class names (fn.name, error.name, constructor.name), super() ordering in derived constructors, and namespace re-exports; hardened TypeScript starts with // @ts-nocheck.
  • Skill, appendices and docs describe the complete journey (apply / restore, reading the report, what the bindings cover); docs/installation.md no longer documents flags that do not exist (--mode, --emit-sourcemap) and lists all 10 supported clients.

Fixed

  • Lane-independence lint precision (src/engine/lane-independence-lint.ts): the gate that refuses bankrupt matched "an integer array anywhere plus the letters key anywhere". It now needs a secret-named identifier (by word, not substring) and a structural per-lane compare. On 9,001 npm package files the refusals drop from 141 to 0; every crafted per-lane gate in the test corpus is still caught.
  • Weave verifier vocabulary (src/shields/weave/weave-decoy.ts): gate names are matched by word (navigateTo, aggregate, tokenize, handleCheckout, validateEmail are not licence gates), class methods and accessors are not "disconnected helpers", and declarations / tool configs / tests are not verified.
  • Bindings that broke untouched builds: the Node integrity preamble is no longer prepended to browser bundles; a writable SQLite database is no longer pinned; a bytecode-only or frozen Python build no longer stops with "integrity binding mismatch"; self-seal digests and signed manifests are re-pinned after the sidecar post-pass; the executable bit of a hardened CLI survives.
  • Plaintext-secret lint precision (src/engine/plaintext-secret-lint.ts): the high-entropy rule fired on anything of sixteen characters with enough distinct letters — error messages, identifiers, file names, MIME types — and the Base64 / hex rules fired on every encoding alphabet (ABC…xyz0123456789+/, Base58, Base32) and on lowercase paths. On 751 ordinary library files that was 1,226 error findings in 227 files; it is now 6 in 5, and 15 in 1,500 files of a second corpus (several of them real embedded blobs). A value is a high-entropy finding only when it is token-shaped (no spaces, brackets or quotes), not a module path or file name, and not built from common English letter pairs (looksLikeNaturalText, calibrated to keep 99.9% of generated 16–64 character tokens); sequential alphabets are never findings (isSequentialAlphabet). plaintextSurvivors and bla_encrypt_strings use the same classification.
  • Secrets inside regular expressions are reported: a digest or an encoded blob in a regex literal (/^5e88…42d8$/) is a plaintext-secret finding marked inRegex, and a plaintextSurvivors entry after hardening at stealth / balanced (maximum / bankrupt now rebuild such a regex — see A secret is split wherever it is written). Ordinary patterns (character classes, quantified ranges) are not findings.
  • bla_lint no longer sends an agent to rewrite a source file (src/engine/packaging-gates.ts): a copy or transpile build leaves the same finding on dist/license.cjs and on the src/license.cjs it was made from. Both were listed, and the remediation plan's entry for the second read "call bla_encrypt_strings on src/license.cjs". The finding is now listed once, on the file that ships, with the source in sameFindingInSource and a recipe that says where to fix it. The per-file details, which bla_harden refuses on, are unchanged.
  • bla_verify_weave lists POSIX paths on Windows (src/shields/weave/weave-decoy.ts): requiredFiles / advisoryFiles read src\license.js there, so the same project produced a different report per platform.
  • A hardened big-endian capture was unreadable (src/shields/formats/pcap-capture.ts): the records the PCAP shield appended were always written little-endian, so tshark reported a capture with a big-endian header as damaged. They now follow the capture's byte order.
  • Localized READMEs (docs/readme/): the Node badge said ^22.13 || >=24 in 21 translations (the package requires ^22.23.4 || >=24), the Indonesian README counted 8 benchmark targets (14), and two headings carried stray characters from another script.
  • WASM XOR-mask lint false positive (src/engine/wasm-xor-mask-sidecar-lint.ts): a zero-filled region beside a table of small integers (every stock Go / Rust runtime) is no longer an "entitlement pack", which had refused GOOS=wasip1 hello-world modules.
  • JavaScript programs that ran differently after hardening (src/shields/javascript/ast-shield.ts, src/core/identifiers.ts; each case runs original and hardened output in tests/fuzz-regression-js.test.ts):
    • template literals converted substitutions with valueOf instead of toString (money / date value objects printed the wrong text), and could reorder their evaluation;
    • a function rebuilt from its own source (new Function(fn.toString()), worker serialisation) threw ReferenceError, and an ES-module import cycle hit the shield's seed before it was initialised;
    • classic scripts and UMD bundles had their page-level globals renamed, two scripts hardened with one seed collided, and a script's completion value changed;
    • & | ^ on BigInt values threw, and on objects converted each operand twice;
    • numeric and string method keys, ES2022 string export names, a top-level return in CommonJS, hint-derived names starting with a digit, sloppy-mode block functions, duplicate parameters, catch (e) { var e }, and a program that declares its own Math / Object / Reflect binding;
    • JSX component names were lowercased into HTML tags, a JSX string attribute crashed the transform at maximum / bankrupt, and a TypeScript string enum gained a reverse mapping.
  • Named imports from a hardened CommonJS file (src/shields/javascript/ast-shield.ts; tests/js-shield-cjs-named-exports.test.ts): import { x } from "./lib.cjs" failed with SyntaxError: Named export 'x' not found after hardening, at every intensity. Node finds a CommonJS module's names by scanning its text for the shapes TypeScript, Babel and esbuild emit; the shield wove a prologue into re-export getters (get: function () { return m.x; }), renamed __exportStar, and at maximum / bankrupt encoded the name in Object.defineProperty(exports, "x", …) and exports["x"] = …. On 1,008 hardened CommonJS files from 26 npm packages, cjs-module-lexer read 132 differently and 140 names were gone (minimatch's escape, unescape and AST among them, at balanced); it now reads all 1,008 as it reads the originals. Those shapes are now left as written — the name, the one-line getter, the helper's name, Babel's export-star loop — and everything around them is hardened as before; a getter or loop that does anything more is program code. A value of a module.exports = { … } literal that the shield rewrote is printed in parentheses, so it does not turn up as a new named export.
  • Strings inside template substitutions are encoded: `${dev ? "http://localhost:3000" : "https://api.internal.example.com"}/v1` kept both URLs readable at maximum / bankrupt; substitutions now go through the string pass like any other expression.
  • Strings that name a file stay literal: import("./chunk.mjs"), require.resolve("./x"), import.meta.resolve("./x") and new URL("./x", import.meta.url) keep their specifier, so a bundler, packager or deploy-time file tracer that runs after hardening still finds the file (encoded, the program ran and the file was silently dropped from the package).
  • Licence notices survive: /*! … */ blocks and comments carrying @license, @preserve, SPDX-License-Identifier or a copyright line are kept verbatim; MIT / BSD / Apache-2.0 require them in every copy.
  • Hardening time is no longer quadratic in file size: one rename walked the whole program, once per top-level binding. A 125 KB bundle (890 top-level functions) takes 0.8 s instead of 11.5 s, 250 KB takes 1.3 s instead of 45 s (stealth; bankrupt 1.2 s / 2.0 s instead of 12.5 s / 48 s), and 500 KB takes 2–4 s.
  • Python modules that broke after hardening (src/shields/formats/python.ts, python-ast-weave.ts, python-pyc-weave.ts; tests/fuzz-regression-python.test.ts, run under Python 3.9–3.14):
    • generated code bound _ (module level, and inside functions under weave_decoys), which broke gettext.install() and every for _ in …;
    • it called hash() and other builtins by bare name, so a module that defines its own — or importlib.reload — redirected or broke it;
    • a source with a declared legacy encoding was read as UTF-8: latin-1 text became U+FFFD and a GBK module no longer compiled;
    • a docstring followed by ; statement produced an IndentationError, an implicitly concatenated docstring was dropped by the weave, and Python 3.12 f-strings (PEP 701) were refused;
    • the .pyc weave re-serialised every constant and corrupted non-ASCII strings; it now splices decoys in and copies your constants byte for byte.
  • SQLite: a database holding integers beyond 2^53 was refused with a RangeError; a database that stock SQLite could not use after hardening is now refused instead of written.

What's Changed

  • feat: ship-ready agent journey, shield equivalence, honest reports — v3.5.0 by @qybaihe in #254

Full Changelog: bla-agents-3.4.4...bla-agents-3.5.0

Don't miss a new bla release

NewReleases is sending notifications on new releases.