Commit Graph

19 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 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
qybaihe a89e42ae5b docs(skill,mcp,cli): ESM static imports evaluate before the entry hook
Update Skill B, DESIGN, STATE, CHANGELOG [Unreleased], MCP
sidecar_entangle descriptions, and CLI help so ESM-native preambles
are not described as full process-start strip⇒fail. Keep the
CJS-into-ESM functional-equivalence rule; document the hoist gap.
2026-11-16 10:06:03 +08:00
qybaihe c677256c0f feat(sidecar): optional WASM JS-loader hook for bla.sidecar.v1 strip⇒fail + REA catalog hygiene
Add generateSidecarWasmLoaderSnippet / prependWasmSidecarLoaderHook /
entangleWasmLoaderWithSidecars / computeWasmSidecarCodeIdentity so a host JS
loader can wrap WebAssembly.instantiate, compile, and instantiateStreaming
and fail closed when a protected module's bla.sidecar.v1 custom section is
stripped or sibling sidecars are altered. Unrelated WASM passes through.
The hook is host-opt-in; wasm-sidecar-entangle stays unrecorded and the
wasm-sidecar-host-verify-only honesty gap remains until a protect/harden
path actually injects the hook. sidecarEntangle stays default OFF.

Catalogue REA #11144 / #11181 javascript.member_mutation_alias_states as
REA_INTERNAL_LIMITS (recoverable budget, not a densify trip target).
2026-11-16 02:09:38 +08:00
qybaihe 06f29ce97c feat(sidecar): SQLite schema-comment note strip⇒fail + REA catalog hygiene
When sidecarEntangle is opted in, plant an unused bla_sidecar_v1 VIEW
(SELECT '<json>' AS "bla.sidecar.v1" WHERE 0) binding sibling sidecars
(generate/bind/entangle/verifySqliteSidecarSchemaComment). User tables,
rows, query results, WAL/FK, and application_id/user_version stay
unchanged. Host-verify only — do not record sqlite-sidecar-entangle
until a load-time hook lands; defenseScore annotates
sqlite-sidecar-host-verify-only (soft-cap 93). Default remains OFF.

Also catalogues REA #4445 NativeAOT work-budget scaling
(NATIVE_AOT_BASE_WORK_UNITS + 8 units/byte; a relaxation, not a new
densify target) and REA #9756 ANDROID_NATIVE_SPLIT_TYPES / _TYPE_CHARS
(report allowance only).
2026-11-15 02:26:02 +08:00
qybaihe a0def444b8 feat(sidecar): DEX string-pool note strip⇒fail + REA #10227 dimension catalog
When sidecarEntangle is opted in, plant an unreferenced sort-last
bla.sidecar.v1= binding string in the official DEX string pool
(generate/bind/entangle/verifyDexSidecarStringPoolNote). Existing string
indices and instruction bytes stay unchanged; Adler32/SHA-1 are recomputed;
protectAndroidDexBuffer trailers are preserved. Host-verify only — do not
record dex-sidecar-entangle until a load-time hook lands; defenseScore
annotates dex-sidecar-host-verify-only (soft-cap 93). Default remains OFF.

Also catalogues REA_INTERNAL_LIMITS.DEX_ARRAY_DIMENSIONS = 255 (REA #10227
dexTypes admission). Honesty catalog only; not a densify trip target.
2026-11-14 02:27:34 +08:00
Timo Zhang b61ff1186c feat(esm,sidecar,doctor): ESM native selfSeal & sidecarEntangle, Safetensors sidecar note, honesty & doctor parity (#200) 2026-11-13 16:12:58 +08:00
Timo Zhang 60c81ad31e fix(js): don't ship a CommonJS sidecar preamble into runtime ES module entries (#193)
* fix(js): treat top-level await and import.meta as an ES module carrier

A .js entry with module-only syntax but no static import/export (top-level
await, import.meta) was classified as a script carrier. Node evaluates such a
file as an ES module (syntax detection), so with sidecarEntangle the CommonJS
strip=>fail preamble hit an undefined require() and the INTACT protected
artifact died with "integrity binding mismatch".

Use Babel's unambiguous program.sourceType as an additional module signal in
both the shield's effective carrier and detectJsCarrierForSource, so the
existing #162 refusal fires instead of shipping a broken entry.

Red 2026-11-13.

* fix(js): honor package.json "type": "module" before binding a sidecar preamble

A .js entry with no import/export syntax under a "type": "module" package is
still an ES module at runtime. The carrier check only looked at syntax and the
.mjs/.cjs extension, so sidecarEntangle prepended the CommonJS strip=>fail
preamble and the intact hardened entry threw "integrity binding mismatch"
(protect and harden alike; reproduced with `bla harden --sidecar-entangle`).

Add resolveNodePackageModuleType / refineJsCarrierForRuntimePaths (nearest
package.json wins, as in Node) and apply it to the output and input locations
in protectTarget and the harden post-pass, so the #162 refusal fires and the
artifact keeps running. Without sidecarEntangle nothing changes.

Red 2026-11-13.

* docs(mcp,cli): state that sidecar_entangle refuses ES module JS entries

The sidecar_entangle MCP parameter (bla_harden / bla_protect / bla_defend) and the --sidecar-entangle CLI help now say the JS preamble is CommonJS and which entry shapes count as ES modules, so an agent can disable the option or pick a CommonJS entry instead of hitting the refusal blind.

* docs(skill): runtime carrier decides whether a sidecar preamble is safe

Skill B principle (CommonJS preamble on a runtime ES module breaks the intact artifact; refuse instead), design-doc follow-up entry, and CHANGELOG [Unreleased] note for the 2026-11-13 red finding. ESM-native preamble left as TBD.
2026-11-13 11:38:07 +08:00
qybaihe f3404be3aa feat(sidecar): GGUF metadata-note strip⇒fail + protectGgufBuffer alignment fix + bla-agents@3.2.6
Extend opt-in sidecarEntangle to GGUF via a bla.sidecar.v1 STRING metadata KV
(generateSidecarGgufMetadataNote / bindGguf / entangleGguf / verifyGguf), with
alignment-safe rebuildGguf so tensor bytes stay bit-exact. Host-verify only
(loaders ignore unknown STRING keys); do not record gguf-sidecar-entangle until
a load-time hook lands; defenseScore gap gguf-sidecar-host-verify-only.
Also fix protectGgufBuffer which previously corrupted tensor data by splicing
KV bytes without re-padding the aligned data section. Default OFF.
2026-11-13 02:28:03 +08:00
Timo Zhang 0cd513e08e fix(sidecar): .pyc marshal-note is host-verify only (red 2026-11-12) (#175)
* fix(sidecar): do not claim pyc-sidecar-entangle for a host-only trailer

The TYPE_ASCII marshal note is ignored by importlib, so strip or sibling
delete still execute. Recording pyc-sidecar-entangle (and clearing the
strip⇒fail defenseScore gap) was paper coverage. Keep planting the note
and host verifyPycSidecarMarshalNote; annotate pyc-sidecar-host-verify-only
until an import-time hook lands.

* test(sidecar): assert .pyc marshal notes stay host-verify only

protectTarget must not list pyc-sidecar-entangle; importlib still returns
the same RESULT after trailer strip or sidecar delete, while the host
verifier fails closed. defenseScore keeps cap 93 via the new gap when
the host-only note is enabled.

* docs(skill,state): sidecar vectors require a process-start hook

Skill B: only record a countered strip⇒fail sidecar vector when the
entry hook hard-fails at process start or import. Host-only verifiers
(such as verifyPycSidecarMarshalNote) are binding notes, not coverage.
CHANGELOG/STATE/DESIGN record the 2026-11-12 honesty residual.
2026-11-12 14:57:45 +08:00
qybaihe 9c41bb53b0 feat(sidecar): .pyc marshal-note strip⇒fail + bla-agents@3.2.5
Extend opt-in sidecarEntangle to CPython .pyc via a TYPE_ASCII marshal
trailer (__blaPycSidecarDigest) verified by verifyPycSidecarMarshalNote.
importlib ignores post-root trailers so executed bytecode stays equivalent.
protectTarget + hardenProject .pyc post-pass; vector pyc-sidecar-entangle;
default OFF. Catalog NativeAOT + IL2CPP v108 limits (no new densify trips).
2026-11-12 02:27:34 +08:00
qybaihe 3e53a1e5b6 feat(sidecar): ASAR main JS preamble strip⇒fail + bla-agents@3.2.4
Complete opt-in ASAR sidecar entanglement with an in-archive Electron main
JS preamble (generateSidecarAsarMainJsPreamble / selectAsarMainJsMember /
entangleAsarMainJsWithSidecars) that re-measures decoy members via
fs-patched readFileSync. Digest labels stay asar-root-relative for parity
with .bla/sidecar.v1.json; protect + harden wire when sidecarEntangle is
on (default OFF). REA +12 since e9b6c87c1 had no new 1:1 densify budgets.
2026-11-11 02:25:01 +08:00
qybaihe 38d26d5219 feat(sidecar): ASAR archive-note strip⇒fail + bla-agents@3.2.2
Plant in-archive `.bla/sidecar.v1.json` when sidecarEntangle is on, binding
enclave/hardware-tee-bridge.js (protect + harden ASAR post-pass). Host-side
verifyAsarSidecarArchiveNote closes strip/alter. Default remains OFF.
2026-11-10 02:13:49 +08:00
qybaihe 439d0e5ea2 feat(sidecar): Bun companion strip⇒fail + defenseScore honesty gap
Extend opt-in sidecarEntangle to Bun/EOF-preserved native companions via a
sibling .bla-sidecar.v1.json note (generateSidecarBunCompanionNote /
bindBunSidecarEntanglement / entangleBunEntryWithSidecars /
verifyBunSidecarCompanionNote). protectTarget auto-binds the planted
.bunfs-snapshot without rewriting the byte-exact binary; hardenProject
covers Bun-only trees. Add sidecar-entangle-not-enabled defenseScore
soft-cap (93) with sidecarEntangleEnabled / MCP sidecar_entangle_enabled.
Fix harden sidecar post-pass options.inPlace TypeScript break from #148.
Release bla-agents@3.2.0.
2026-11-09 02:16:14 +08:00
qybaihe 41345ff3f9 feat(sidecar): WASM custom-section strip⇒fail entanglement
Plant a bla.sidecar.v1 custom-section note with the sidecars-mode binding
digest + path labels (no export/behavior change). Host-side
verifyWasmSidecarCustomSection re-hashes siblings for strip/alter fail.
Wire protectTarget (.wasm) and harden WASM-only post-pass when
sidecarEntangle is on (default OFF). DESIGN/STATE/CHANGELOG updated.
2026-11-08 02:12:29 +08:00
qybaihe a46ebc9505 docs(sidecar): mark Python strip⇒fail slice landed; queue WASM
Update DESIGN status, STATE residual, and Unreleased changelog for the
Python preamble follow-up to the JS vertical slice.
2026-11-07 02:14:55 +08:00
qybaihe eae28c8b8e docs(sidecar): mark JS strip⇒fail slice landed; queue Python/WASM
STATE #2 and design note updated; CHANGELOG Unreleased entry added.
No version bump (still 2.1.0).
2026-11-06 10:05:21 +08:00
qybaihe cd218dcc21 docs(skill+plan): real-not-paper entry self-coverage principle
Skill section B: entry counts as self-covered only when its runtime check
hard-fails on its own bytes; check integrityCoverageSelfVerified; keep
host-trust values inside covered artifacts. STATE/CHANGELOG/design note
record the 2026-11-05 CrackMe v8 round (NO PRIZE, REA unverified).
2026-11-05 10:08:24 +08:00
qybaihe 6540160490 docs(design): sidecar/entry entanglement DESIGN + planner stub
Lock v1 design (strip⇒fail binding) and ship planSidecarEntanglement()
stub with tests; full rewrite deferred to a follow-up flag.
2026-11-02 21:36:22 +08:00