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_DIRoverrides it), re-hardens from those originals on a re-run, and rolls back completely if a copy fails.--restore/restore: trueputs the originals back and leaves rebuilt files alone. Over MCP the promotion always answersconfirmation_requiredfirst. sqliteEvalTrap(CLI--sqlite-eval-trap, MCPsqlite_eval_traponbla_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 (registerenclave_unseal_payloadon its own connection).exclude(bla_harden/bla_discoverexclude, 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 anapplyre-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-artifactinputBytes/outputBytes, aSize:line in the CLI report, and anextStepsentry when the hardened files are a megabyte or more larger (a 41-byte WASM module is about 7 MB atbankruptand about 24 KB atmaximum). nextStepson 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 returnsinstructions(build →bla_harden→ follownextSteps→apply→ run tests, plus the rules aboutisError, BLA output and scores), so an agent that never loads the skill still gets the sequence. Protocol revisions2024-11-05,2025-03-26and2025-06-18are 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(declaredpackage.jsonentry points that never load it),integrityBindingSkipped(browser bundles, writable SQLite, files the entry cannot read), andpythonSidecarEntry. The coverage matrix lists only edges the hardened tree enforces. plaintextSurvivorsper artifact: sensitive-looking literals still readable in hardened JS/TS/HTML, with source lines and clipped previews.- WASM consumer contract:
wasmExportRenames(old → new map) andwasmExportsAutoPreserved(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_weavescope: a directory verdict rests on the crown-jewel files (requiredFiles); other source files areadvisoryFiles.scope: "all"restores the every-file verdict,verbose: trueincludes advisory reports.bla doctor --verify-handshake/bla_doctor { verify_handshake: true },versionSkewfor a client pinned to another release, andnextStepswith the repair command. The MCP payload lists only detected clients (clientsNotDetectedcarries the rest by id).- The skill is served as MCP resources (
bla://skill/SKILL.md,bla://skill/references/*.md), andinstructionspoints at them: a client that only registered the server — a checked-in.mcp.json— can read the full guide.bla://docs/weave-decoy-mcpis now a short pointer instead of a second copy of the directives. bla doctorreads project-scoped MCP configs (.mcp.json,.cursor/mcp.json,.vscode/mcp.json,.gemini/settings.json,.codex/config.toml,opencode.json) intoprojectRegistrations(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_lintfindings carryenforcedByHarden—trueonly for a findingbla_hardenactually 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 buildlinks the package's own bins intonode_modules/.bin, so the checked-in.mcp.json(npx bla-agents@<version> mcp) starts inside the repository instead of failing withbla: 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 calledenclave_unseal_payload(), a function only BLA's own connections registered — soPRAGMA integrity_check,PRAGMA quick_check,VACUUM,VACUUM INTOand restoring a.dumpfailed 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-readablecaps it at 78, andsqlite-decoy-columns-evaluableat 68 without the evaluation trap. The harden report carries anextStepsline to that effect, the audit lists the application tables as exposed, and no longer claimsSqliteColumnEvaluationFailurefor columns an inspector can evaluate.bla defend <db>under the defaultminDefenseScore: 90now 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.tsdeclarations and the scriptspackage.jsonruns 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/Releaseon 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_defendresult drops from megabytes to tens of kilobytes (auditexposedItemscapped and clipped withexposedItemsTotal/exposedItemsTruncated; the coverage contract appears once; no duplicate audit). The CLI's--jsonis unchanged. - Integrity-binding host: when
package.jsondeclares several entry points, the check is hosted in the one the others load (binrequiresmain⇒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 installedacme-toolnever runs arun.pybeside the package, so a check hosted there verified nothing and a patched licence gate went unnoticed.sidecar_entanglenow puts the check in that package's outermost__init__.py(Python runs it on every way in), reports hardened files outside its directory inintegrityBindingSkipped, and lists declared scripts that never import the checking module in the newpythonSidecarUncoveredEntries. 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.pyfiles start with a privateimport 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 atmaximum/bankruptwas 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 REA05be423, an IPC channel came back at REA's default budgets, and a URL and a SHA-256 digest oncesemantic_precisionwas raised 4×. Each piece is now XOR-masked with a position-dependent key, spelled in the lettersa–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, rowjavascript_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/bankruptthe 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 becomesnew 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 inplaintextSurvivors: HTML attributes, tagged templates, class member names, the object keys andas constvalues 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 recordedTypeError: … is not a functionas 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:reamaps 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_reporttells "not measured" from "REA read it" (src/engine/rea-observability.ts):unverifiedwhen 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 — andfailonly 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 REA05be423, 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 MiBTSHARK_JSON_MAX_BYTES— a larger output failsinspect_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.bankruptnow 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.estimatedTsharkJsonBytesis a lower bound of REA's field pass when the flood is planted (an upper bound for the ordinary decoys otherwise),exceedsTsharkJsonBudgetsays whether it passes the allowance, andanswerFloodPackets/inspectPcapCapture().answerFloodPacketsreport 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), andbla_redteam_reportnames them inreason. - 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.mdno 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 refusesbankruptmatched "an integer array anywhere plus the letterskeyanywhere". 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,validateEmailare 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,226errorfindings 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).plaintextSurvivorsandbla_encrypt_stringsuse the same classification. - Secrets inside regular expressions are reported: a digest or an encoded blob in a regex literal (
/^5e88…42d8$/) is aplaintext-secretfinding markedinRegex, and aplaintextSurvivorsentry after hardening atstealth/balanced(maximum/bankruptnow rebuild such a regex — see A secret is split wherever it is written). Ordinary patterns (character classes, quantified ranges) are not findings. bla_lintno longer sends an agent to rewrite a source file (src/engine/packaging-gates.ts): a copy or transpile build leaves the same finding ondist/license.cjsand on thesrc/license.cjsit was made from. Both were listed, and the remediation plan's entry for the second read "callbla_encrypt_stringsonsrc/license.cjs". The finding is now listed once, on the file that ships, with the source insameFindingInSourceand a recipe that says where to fix it. The per-filedetails, whichbla_hardenrefuses on, are unchanged.bla_verify_weavelists POSIX paths on Windows (src/shields/weave/weave-decoy.ts):requiredFiles/advisoryFilesreadsrc\license.jsthere, 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 || >=24in 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 refusedGOOS=wasip1hello-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 intests/fuzz-regression-js.test.ts):- template literals converted substitutions with
valueOfinstead oftoString(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) threwReferenceError, 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
returnin CommonJS, hint-derived names starting with a digit, sloppy-mode block functions, duplicate parameters,catch (e) { var e }, and a program that declares its ownMath/Object/Reflectbinding; - 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.
- template literals converted substitutions with
- 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 withSyntaxError: Named export 'x' not foundafter 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 atmaximum/bankruptencoded the name inObject.defineProperty(exports, "x", …)andexports["x"] = …. On 1,008 hardened CommonJS files from 26 npm packages,cjs-module-lexerread 132 differently and 140 names were gone (minimatch'sescape,unescapeandASTamong them, atbalanced); 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 amodule.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 atmaximum/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")andnew 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-Identifieror 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;bankrupt1.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 underweave_decoys), which brokegettext.install()and everyfor _ in …; - it called
hash()and other builtins by bare name, so a module that defines its own — orimportlib.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
; statementproduced anIndentationError, an implicitly concatenated docstring was dropped by the weave, and Python 3.12 f-strings (PEP 701) were refused; - the
.pycweave re-serialised every constant and corrupted non-ASCII strings; it now splices decoys in and copies your constants byte for byte.
- generated code bound
- 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
Full Changelog: bla-agents-3.4.4...bla-agents-3.5.0