Commit Graph

614 Commits

Author SHA1 Message Date
qybaihe d66b9af1f2 feat(sidecar): auto-wire WASM JS-loader hook into known Node ESM loaders + REA catalog hygiene
Extend the 2026-11-16 Node CJS auto-wire so a same-directory Node.js
ESM loader (.mjs or ESM .js) whose static import/export-from specifiers
are Node builtins only also receives the already-landed WASM
bla.sidecar.v1 load-time hook (carrier: "module"). Record
wasm-sidecar-entangle and clear wasm-sidecar-host-verify-only only when
that hook was actually written. Browser fetch-only loaders and ESM
files that statically import user modules or .wasm stay untouched.

Honesty: jsModuleHasHoistedDependencyGraph no longer treats Node
builtin-only imports as a user hoisted graph.

Catalog REA tip 05be423ac inspection/walk ceilings (DWARF, ELF
debug-link/DT_NEEDED, Maven/Gradle, NuGet, Android OTA/boot) as
honesty-only REA_INTERNAL_LIMITS — not densify trip targets.
2026-11-18 02:08:36 +08:00
qybaihe f6f37c4cca chore(release): bla-agents v3.4.3 bla-agents-3.4.3 2026-11-17 14:43:17 +08:00
qybaihe 01802826b9 Merge pull request #234 from DeryFerd/fix/protect-manifest-flags 2026-11-17 11:50:43 +08:00
qybaihe d2b5982663 Merge pull request #232 from DeryFerd/fix/gguf-alignment-bound 2026-11-17 11:49:13 +08:00
Timo Zhang e20b7a29be Merge pull request #252 from DeryFerd/chore/bind-scope-drop-dead-import
chore(bind-scope): drop the dead writeFileSync import
2026-11-17 11:47:32 +08:00
Timo Zhang 8be0003f30 Merge pull request #251 from DeryFerd/fix/manifest-spki-timing-safe-compare
refactor(manifest): compare the pinned SPKI in constant time
2026-11-17 11:47:27 +08:00
Timo Zhang 0f5957967e Merge pull request #250 from DeryFerd/fix/self-seal-binding-name-validation
fix(runtime): require a plain identifier for self-seal / sidecar bindingName overrides
2026-11-17 11:47:22 +08:00
Timo Zhang 8d67adce37 Merge pull request #249 from DeryFerd/fix/sarif-artifact-text-sanitize
fix(sarif): sanitize artifact-derived text in SARIF emission
2026-11-17 11:47:17 +08:00
Timo Zhang b2110db207 Merge pull request #248 from DeryFerd/feat/mcp-string-length-and-count-bounds
feat(mcp): bound string argument length and numeric magnitude
2026-11-17 11:47:12 +08:00
Timo Zhang ff70aa96fb Merge pull request #247 from DeryFerd/test/parser-malformed-input-gaps
test(formats): pin the remaining malformed-input fail-closed contracts
2026-11-17 11:47:08 +08:00
Timo Zhang 2e24266277 Merge pull request #246 from DeryFerd/docs/format-count-claims-sync
docs: sync the documented artifact-format count to the real registry
2026-11-17 11:47:03 +08:00
Timo Zhang 3196bae175 Merge pull request #245 from DeryFerd/feat/verify-manifest-require-artifact
feat(cli): add --require-artifact to verify-manifest
2026-11-17 11:46:58 +08:00
Timo Zhang 2782d4140c Merge pull request #244 from DeryFerd/fix/panel-derive-rename-property-access
fix(panel-derive): keep external property accesses during the deriveLocal rename
2026-11-17 11:46:53 +08:00
Timo Zhang 4838837e3c Merge pull request #243 from DeryFerd/fix/mcp-error-path-redaction
fix(mcp): redact absolute operator paths from engine error text
2026-11-17 11:46:48 +08:00
Timo Zhang e1aaef513f Merge pull request #242 from DeryFerd/fix/wasm-seal-walk-symlink-hidden-dirs
fix(lint): stop the seal-xor discovery walk from following symlinks
2026-11-17 11:46:44 +08:00
Timo Zhang 76f7e9a141 Merge pull request #241 from DeryFerd/fix/mcp-destructive-hint-metadata
fix(mcp): declare destructiveHint on mutating tools
2026-11-17 11:46:39 +08:00
Timo Zhang c58d42d6a4 Merge pull request #240 from DeryFerd/fix/mcp-inspect-release-bounds
fix(mcp): honor bla_inspect_release max_files / max_total_bytes bounds
2026-11-17 11:46:33 +08:00
Timo Zhang c2189d53ee Merge pull request #239 from DeryFerd/fix/plaintext-secret-escaped-literal-bypass
fix(lint): recognize escaped sensitive literals instead of suppressing them
2026-11-17 11:46:28 +08:00
Timo Zhang e242744439 Merge pull request #238 from DeryFerd/fix/harden-report-terminal-sanitize
fix(harden): sanitize artifact-derived text in the harden report
2026-11-17 11:46:23 +08:00
Timo Zhang f1b2e4567b Merge pull request #237 from DeryFerd/fix/tarpit-python-docstring-escape
fix(tarpit): escape chaff text before it lands in a Python docstring
2026-11-17 11:46:18 +08:00
Timo Zhang 49a4a50f07 Merge pull request #236 from DeryFerd/fix/blarc-honey-source-maps
fix(cli): wire .blarc honeySourceMaps into protect and defend
2026-11-17 11:46:12 +08:00
Timo Zhang 736639534a Merge pull request #235 from DeryFerd/fix/harden-seed-base-dir
fix(cli): resolve the harden seed against the project root
2026-11-17 11:46:08 +08:00
Timo Zhang ef6cef8db1 Merge pull request #233 from DeryFerd/fix/cli-arg-errors-before-early-exit
fix(cli): validate flags before the no-command and mcp early returns
2026-11-17 11:45:59 +08:00
Timo Zhang 6d9e10bb88 Merge pull request #231 from DeryFerd/fix/gguf-protect-fail-closed
fix(gguf): fail closed instead of replacing a non-GGUF file with synthetic metadata
2026-11-17 11:45:51 +08:00
qybaihe 6e5d14f27f feat(native,audit): architecture-matched PE32/ARM64/ELF32 .enclave islands & structural anti-spoof gates 2026-11-17 11:31:15 +08:00
qybaihe 645993f96d chore(release): bla-agents v3.4.2
Cut 3.4.2 for the WASM JS-loader hook auto-wire (record
wasm-sidecar-entangle / clear wasm-sidecar-host-verify-only only when a
same-directory Node CJS loader was actually injected) and the REA
26d88826c catalog hygiene (SQLITE_WORKER_HEAP_BYTES). Also includes the
post-3.4.1 main work already on de982cb.
bla-agents-3.4.2
2026-11-17 02:29:33 +08:00
qybaihe 1eb0978b73 feat(sidecar): auto-wire WASM JS-loader hook into known Node CJS loaders + REA catalog hygiene
When sidecarEntangle is on, protectTarget and hardenProject inject the
already-landed WASM JS-loader hook into a same-directory Node.js CommonJS
loader that already uses fs and WebAssembly.instantiate/compile/
instantiateStreaming and mentions the .wasm basename (known names only:
<stem>.cjs/.js, loader.*, index.*). Browser, ESM, minified, already-
entangled, and unranked app entries such as license.cjs are left
untouched so baked self-seal digests stay valid. Record
wasm-sidecar-entangle and clear wasm-sidecar-host-verify-only only when
that hook was actually written. Default remains OFF.

Catalog REA tip 26d88826c SQLITE_WORKER_HEAP_BYTES (256 MiB) as honesty-
only; no new 1:1 densify counters in the +208 delta.
2026-11-17 02:28:40 +08:00
DeryFerd f8e0a3ad80 test(formats): pin the remaining malformed-input fail-closed contracts
Cover the hostile-input gaps the dedicated suites did not pin yet: the ZIP64
0xffffffff central-directory size sentinel, WASM export sections that are
truncated / oversized / carry an unknown kind, ASAR symlink targets escaping
the archive root, a malformed .pyc header, a safetensors header with
duplicate JSON fields, GGUF keys with a u64 length beyond the buffer and
65-deep ARRAY nesting past MAX_VALUE_DEPTH, and the JVM class shield's
trailer fallback on garbage / truncated-constant-pool stubs.
2026-11-17 01:11:39 +07:00
DeryFerd 09dfe20574 test(drift): accept localized FAQ phrasing in the format-count guard
Translated READMEs phrase the shield-count FAQ answer in their own language
(e.g. README_id.md uses 'Seluruh 26 perlindungan format'), so the guard now
asserts the current derived count appears in each translation instead of
requiring the exact English sentence. The English sentence stays strictly
asserted on the root README and the detector comment.
2026-11-17 01:06:48 +07:00
DeryFerd 38dcd57cac docs: sync the documented artifact-format count to the real registry
detector.ts claimed 'all 19 REA-supported artifact formats' and every README
said 'All 19(+) format shields' while ArtifactFormat defines 26 real formats
(plus the directory/unknown sentinels; the website already said 26). Sync all
claims to 26, bump the stale BLA_VERSION pin (2.1.0) in the example defend
workflow to the current release, and extend the public-claim drift guard to
derive the format count from the ArtifactFormat union so READMEs, detector
comment, and website cannot drift apart again.
2026-11-17 01:05:28 +07:00
DeryFerd 8d71f250d4 fix(mcp): redact absolute operator paths from engine error text
handleMcpRequest returned err.message verbatim, and engine errors embed
resolved absolute paths (Unsupported or missing target path: ...). An MCP
client probing with bogus paths learned the operator's directory layout.
Redact known roots (cwd, tmpdir, home) and remaining drive-letter absolute
paths before returning error text to a client; relative fragments stay
readable for debugging.
2026-11-17 01:02:49 +07:00
DeryFerd 6e7e115299 feat(mcp): bound string argument length and numeric magnitude
String tool arguments had no length cap (a single 1 MiB stdio frame admitted
a 1 MB seed/path string that flowed into hashing and report math), and
numeric arguments accepted astronomically large magnitudes. Add a 64 KiB
default string cap (per-property maxLength override supported in the schema
type) and a 1e9 numeric magnitude cap, completing the bounded-args posture
of the string-list and fractional-count guards.
2026-11-17 00:59:30 +07:00
DeryFerd c1c547dbd0 fix(sarif): sanitize artifact-derived text in SARIF emission
buildSarifReport and buildPackagingGatesSarif interpolated item names, reasons,
advice lines, and artifact URIs verbatim. JSON escaping keeps the document
valid, but code-scanning viewers can render control-character escapes from a
hostile artifact path. Route the free-text fields through
sanitizeTerminalText like the terminal formatters.
2026-11-17 00:53:29 +07:00
DeryFerd 3ed9b1b219 chore(bind-scope): drop the dead writeFileSync import
Every bind-scope write already goes through writeFileAtomicSync; the direct
writeFileSync import had no remaining call site.
2026-11-17 00:47:54 +07:00
DeryFerd 9f2e58d138 refactor(manifest): compare the pinned SPKI in constant time
verifyManifestSignature compared the embedded and pinned SPKI PEM strings
with plain inequality. The SPKI is public material so nothing was secret,
but timingSafeEqual matches the constant-time posture of the rest of the
pinned-verification path; existing attacker-keypair rejection tests guard
the behavior.
2026-11-17 00:46:40 +07:00
DeryFerd 076b736908 fix(runtime): require a plain identifier for self-seal / sidecar bindingName overrides
generateSelfSealSnippet and generateSidecarJsPreamble interpolated the
caller-provided bindingName verbatim into var declarations, so a hostile
override could break or inject into the emitted preamble. Validate against
an identifier pattern and fail loudly instead.
2026-11-17 00:45:00 +07:00
DeryFerd 1e983114f0 fix(panel-derive): keep external property accesses during the deriveLocal rename
The bankrupt rewrite replaced \bderiveLocal\b globally, which also renamed
obj.deriveLocal property accesses on an external object — legal alongside a
local function of the same name — changing the program's behavior instead of
hiding the stable ABI. Skip matches preceded by a dot or identifier char and
regression-test the property-access case.
2026-11-17 00:41:36 +07:00
DeryFerd 1ac71c60ff fix(lint): stop the seal-xor discovery walk from following symlinks
walkWasmFiles used readdirSync + statSync, whose stat call follows symlinks —
a symlinked directory inside the lint root was descended and a symlinked
.wasm file was read, unlike every sibling lint walker (Dirent-based, links
never descended, hidden directories skipped). Align the walk with that
posture; add walk-safety regression tests.
2026-11-17 00:37:54 +07:00
DeryFerd 0b6d873e9d fix(mcp): declare destructiveHint on mutating tools
withToolAnnotations flipped readOnlyHint for MUTATING_MCP_TOOLS but left
destructiveHint hardcoded false on every tool, so MCP clients honoring the
annotation would not prompt the operator before destructive writes. Set
destructiveHint from the same isMutating bit.
2026-11-17 00:35:09 +07:00
DeryFerd 5e96f8f1dd fix(mcp): honor bla_inspect_release max_files / max_total_bytes bounds
The tool schema advertised optional max_files and max_total_bytes caps, but
the handler passed only the path and inspectReleaseExposure had no options
parameter at all — the bounds were dead code and an MCP client could trigger
an unbounded scan. Plumb both caps through as optional overrides that only
tighten the built-in limits, and stop scanning once the file-count cap is
reached (limitation: file-count-limit).
2026-11-17 00:32:57 +07:00
DeryFerd 474bb99a0a fix(harden): sanitize artifact-derived text in the harden report
formatHardenProjectReport interpolated directory/runId/written/relativePath/
outputPath/error/discoveryReadErrors/oneSentenceUsage verbatim, so a hostile
artifact name could carry OSC/CSI control sequences into the operator's
terminal. Route every artifact-derived field through sanitizeTerminalText
like the other formatters (extends the PR #223 posture to the harden report).
2026-11-17 00:25:56 +07:00
DeryFerd 5464cb4cfd fix(lint): recognize escaped sensitive literals instead of suppressing them
extractStringLiterals unescapes common sequences before classification, but
looksAlreadyEncrypted searched the unescaped literal in the raw source — a
secret written with one escape sequence could never match, so the finding was
silently dropped and the bankrupt gate stayed open. Search the escaped
spelling as well; add a bypass regression test.
2026-11-17 00:22:42 +07:00
DeryFerd b6c794b9ce fix(cli): resolve the harden seed against the project root
harden loaded .blarc from process.cwd() but resolved (and persisted) the seed
against the target directory. With no usable seed present, resolveProjectSeed
minted one and wrote it to <target>/.blarc — inside the build output the user
is about to package. It also made 'bla harden ./dist' mint a different seed
depending on which directory was hardened.

protect and defend already resolve against the process cwd; harden now matches.
dryRun still writes nothing.
2026-11-17 00:18:22 +07:00
DeryFerd 5a724569b4 fix(cli): reject manifest flags on protect instead of ignoring them
--manifest, --sign-manifest and --manifest-key are accepted by the parser and
advertised in --help with no per-command restriction, but only harden and
defend consume them. ProtectionOptions has no manifest field, so
'bla protect app.js --manifest' exited 0 and wrote no manifest — an operator
would think the artifact had been signed.

The flags are now an argument error for protect, and the help text says which
commands implement the stage.
2026-11-17 00:18:21 +07:00
DeryFerd 7c43b4d9c3 fix(tarpit): escape chaff text before it lands in a Python docstring
generatePythonTarpit interpolated chaff rawText straight into a triple-quoted
docstring. A payload containing """ or a trailing backslash would terminate
the literal early and emit invalid Python into the protected artifact; today's
chaff templates never contain either, so the bug stayed latent.

Escapes backslashes and triple quotes and folds newlines so the docstring stays
one line, plus a regression test with a poisoned payload.
2026-11-17 00:18:13 +07:00
Timo Zhang de982cb7d3 Merge pull request #224 from DeryFerd/fix/mcp-inplace-write-confirmation
fix(mcp): require confirm_overwrite before in-place encrypt-strings and bind-scope runs
2026-11-16 23:52:34 +08:00
Timo Zhang e024bfea3d Merge pull request #225 from DeryFerd/fix/mcp-arg-bounds
fix(mcp): bound string-list arguments and reject fractional count arguments
2026-11-16 23:52:29 +08:00
Timo Zhang afad051f33 Merge pull request #226 from DeryFerd/feat/lint-sarif-output
feat(cli): add --sarif to bla lint for CI code scanning
2026-11-16 23:52:25 +08:00
Timo Zhang 17df4c8f38 Merge pull request #229 from DeryFerd/ci/enforce-coverage-floors
ci: actually enforce the configured coverage floors
2026-11-16 23:52:21 +08:00
Timo Zhang 7b5ff4df40 Merge pull request #223 from DeryFerd/fix/reporter-control-char-sanitize
fix(ui): strip control characters from artifact-derived report text
2026-11-16 23:51:11 +08:00