Skip to content

feat(asm-runner): docker image - #8

Open
vladb-ai wants to merge 3 commits into
mainfrom
feat-asm-runner-dockerfile
Open

feat(asm-runner): docker image#8
vladb-ai wants to merge 3 commits into
mainfrom
feat-asm-runner-dockerfile

Conversation

@vladb-ai

@vladb-ai vladb-ai commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Replicated from alpenlabs#115

Description

Adds a Docker flow for strata-asm-runner. Single two-stage Dockerfile under docker/asm-runner/: Ubuntu 24.04 builder with the pinned Rust toolchain (rust-toolchain.toml) compiles the binary, slim Ubuntu 24.04 runtime ships it. ENTRYPOINT/CMD default to /app/config.toml and /app/asm-params.json; both are overridable via flags or volume mounts. No params validation in the entrypoint — misconfiguration surfaces as a runtime failure from the binary itself.

Native prover and the "no prover" mode work out of the box because the NativeHost backend is compiled in unconditionally. SP1 mode is not supported by this image — it's marked as TODO(prover-sp1) in the Dockerfile (with the concrete steps) and will land in a follow-up PR using the alpen pattern (pre-built guest ELFs staged into the build context).

No docker CI workflow: the workspace compile is already covered by unit.yml / functional.yml. Adding a docker-builds-too job duplicated that signal at significant CI cost.

Type of Change

  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)

Notes to Reviewers

Verified locally: docker buildx build succeeds and docker run --rm strata-asm-runner:latest --help prints the expected CLI usage. Final image is ~150 MB total / ~40 MB content.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

prajwolrg and others added 3 commits May 27, 2026 12:28
Two-stage build: Ubuntu 24.04 with the pinned Rust toolchain compiles
the binary, slim Ubuntu 24.04 runtime ships it. ENTRYPOINT/CMD default
to /app/config.toml and /app/asm-params.json; no params validation in
the entrypoint, so misconfiguration surfaces as a runtime failure from
the binary itself (same as launching the runner directly).

Native and "no prover" modes are supported out of the box because the
NativeHost backend is compiled in unconditionally. SP1 mode needs
--features sp1 and the guest ELFs bundled into the image — left as a
TODO(prover-sp1) inside the Dockerfile with the concrete steps for
adding it.
The original Dockerfile only built a native/no-prover image and left SP1
support as a TODO. Fold SP1 in now via a second build target so both
variants ship from the same Dockerfile.

Structure: shared `builder` stage parameterized by a `CARGO_FEATURES`
build-arg, a `runtime-base` stage with the binary, then `native` (default,
no extras) and `sp1` (copies pre-built guest ELFs into /app/elfs/) targets.

Guest ELFs are built outside docker and staged into
`docker/asm-runner/artifacts/elfs/` rather than built inside an SP1 image,
matching alpen's `docker/strata/Dockerfile` pattern. Building inside would
need either docker-in-docker (for sp1-build's docker-build feature) or the
full SP1 toolchain in the builder layer — both heavier than just copying
ELFs in from the host/CI runner.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🔒 AI Security Review

Scope: .dockerignore, .gitignore, docker/README.md, docker/asm-runner/Dockerfile (docker infra only, no application code changes).

Finding 1: Runtime container runs as root (no USER directive) — Medium

File: docker/asm-runner/Dockerfile:77-104 (all three final stages: runtime-base, sp1, native)

None of the runtime stages set a USER before ENTRYPOINT. The strata-asm-runner binary therefore runs as root (uid 0) inside the container, and per docker/README.md it is typically launched with a host bind-mount for data and a published RPC port (-p 9010:9010).

Exploit scenario: strata-asm-runner exposes a JSON-RPC server (bin/asm-runner/src/rpc_server.rs) and ingests Bitcoin L1 block/transaction data (attacker-influenced input) to drive ASM state transitions. If any parsing/deserialization bug in that path, or a future dependency CVE, is ever exploited for code execution, the attacker lands as root inside the container instead of an unprivileged user. Combined with the host bind mount for data documented in the README, a root process can write arbitrary file modes/ownership into that mount, and the elevated privileges meaningfully widen the blast radius for any container-escape kernel/runtime vulnerability. The binary listens on a non-privileged port (default 9010/8000), so there is no functional need to run as root.

Fix: Add a dedicated non-root user/group in runtime-base and switch to it before ENTRYPOINT, ensuring it owns /app:

RUN groupadd -r asm && useradd -r -g asm -d /app asm && chown -R asm:asm /app
USER asm

Apply this in runtime-base so it is inherited by both the sp1 and native targets.

Other areas checked, no issues found

  • curl | sh for rustup (Dockerfile lines 60-61) is pinned to --proto '=https' --tlsv1.2, is build-time only, and the builder stage is discarded from the final image — not exploitable.
  • .dockerignore correctly excludes .git, .env*, and local secret/volume paths from the build context — no credential leakage into image layers.
  • No injection, path traversal, SSRF, deserialization, or credential-handling issues in the added Dockerfile/README/ignore files — this diff does not touch any parsing or network-input code paths.

No other exploitable vulnerabilities were found in this diff.

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.

2 participants