Skip to content

Harden LLRT runtime boundary#15

Merged
robinbraemer merged 2 commits into
mainfrom
codex/harden-llrt-runtime
Jun 16, 2026
Merged

Harden LLRT runtime boundary#15
robinbraemer merged 2 commits into
mainfrom
codex/harden-llrt-runtime

Conversation

@robinbraemer

Copy link
Copy Markdown
Member

Summary

  • disables LLRT module/file/package loading for the native call_json execution path so sandbox code cannot dynamic-import host capability modules
  • hardens request bridge header forwarding and hides response headers unless explicitly exposed
  • bumps @robinbraemer/llrt to 0.1.1 and @robinbraemer/codemode to 0.3.1, including native package repository metadata verification

Verification

  • mise exec -- task ci
  • pnpm --filter @robinbraemer/llrt run create:native-packages && pnpm --filter @robinbraemer/llrt run verify:native-artifacts
  • cargo check --manifest-path packages/llrt/native/Cargo.toml
  • cargo fmt --manifest-path packages/llrt/native/Cargo.toml
  • focused red-green vitest runs for LLRT dynamic imports, codemode executor contract, and request bridge headers

Release handoff

After merge, publish a GitHub Release from the merged commit. The existing release workflows build the LLRT native artifacts on the matching platform runners and publish @robinbraemer/llrt@0.1.1, its optional native packages, and @robinbraemer/codemode@0.3.1. Do not publish the native packages from a local macOS workspace.

Downstream

Once npm has @robinbraemer/codemode@0.3.1 and @robinbraemer/llrt@0.1.1, update the CNAP PR dependency catalog/lockfile and rerun CNAP preflight.

Rationale: LLRT is the intended default executor, but the native wrapper still allowed dynamic imports of host capability modules and the request bridge exposed more header surface than necessary. This tightens the sandbox boundary before downstream adoption.

Rejected: Publishing native packages directly from the local macOS workspace; the existing GitHub release workflow is the safer path because it builds each platform artifact on its matching runner.

Risk: This disables LLRT module loading for call_json and hides response headers from sandbox code unless explicitly allowed. Callers that depended on arbitrary dynamic imports or implicit response headers must opt into a different executor/header allowlist.

Tested: mise exec -- task ci; pnpm --filter @robinbraemer/llrt run create:native-packages && pnpm --filter @robinbraemer/llrt run verify:native-artifacts; cargo check --manifest-path packages/llrt/native/Cargo.toml; cargo fmt --manifest-path packages/llrt/native/Cargo.toml; focused LLRT/codemode vitest red-green runs.
Rationale: CI refreshes the pinned LLRT checkout before native target builds, which erased the local vm.rs hardening patch. Track the patch in the package and apply it idempotently after checkout so native release builds use the same hardened source.

Risk: prepare:llrt-source now fails if the patch no longer applies to the pinned upstream revision, which is intentional because the native runtime hardening would otherwise silently disappear.

Tested: git -C packages/llrt/vendor/llrt apply --reverse packages/llrt/patches/disable-default-module-loading.patch && pnpm --filter @robinbraemer/llrt run prepare:llrt-source && git -C packages/llrt/vendor/llrt diff --check && LLRT_TARGET=aarch64-apple-darwin pnpm --filter @robinbraemer/llrt run build:native:target; mise exec -- task ci.
@robinbraemer robinbraemer merged commit b3d6365 into main Jun 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant