Repository navigation
Conversation
A prototype for #397's alternative: the data plane and the control plane as static musl binaries on `scratch`, with no distro and no vendor base. - Dockerfile, Dockerfile.control: built on rust:1.95-alpine3.23 (pinned) with `cargo auditable`, refused if the binary links a shared library. The runtime image holds the binary, the CA bundle from the builder, /etc/passwd and /etc/group with nonroot (65532), its home and /tmp. barbacane-control runs as 65532 (it ran as a system user) and loses its bash HEALTHCHECK. - Musl builds use mimalloc as the global allocator. - static-images.yml: checks each image's contents, Syft's inventory and Grype's scan; runs the integration suite and the security suite against the static binaries; compares the static gateway with the glibc one, built from this commit by the current builder, under wrk.
init_template, artifact_capabilities and security/artifact_signing looked for target/debug/barbacane themselves, process_lifecycle fell back to it, and control_cli and connected_mode looked in the target directory only. None honoured BARBACANE_TEST_BINARY, and under a redirected CARGO_TARGET_DIR (the coverage job) they ran target/debug/barbacane rather than the build under test whenever the cache had left one there. They now call find_barbacane_binary(): BARBACANE_TEST_BINARY first, then the active target directory, then the fixed candidates. Found by the static-image prototype (#404), which points BARBACANE_TEST_BINARY at a static gateway and has no target/debug/barbacane: init_template and artifact_capabilities failed there (run 44317540356, shards 1 and 3).
Without a `config` block the plugin's init fails and the upstream answered 500 to every request, so the comparison never started.
The proxied routes reach a loopback upstream, which the SSRF guard refused with a 502.
The glibc gateway failed 1,549 of 48,621 proxied requests in round 1 (upstream calls: "error sending request"), which stopped the run. Failed requests are now a metric of each run, compared like the others.
init_template, artifact_capabilities and security/artifact_signing looked for target/debug/barbacane themselves, process_lifecycle fell back to it, and control_cli and connected_mode looked in the target directory only. None honoured BARBACANE_TEST_BINARY, and under a redirected CARGO_TARGET_DIR (the coverage job) they ran target/debug/barbacane rather than the build under test whenever the cache had left one there. They now call find_barbacane_binary(): BARBACANE_TEST_BINARY first, then the active target directory, then the fixed candidates. Found by the static-image prototype (#404), which points BARBACANE_TEST_BINARY at a static gateway and has no target/debug/barbacane: init_template and artifact_capabilities failed there (run 44317540356, shards 1 and 3). (cherry picked from commit 049cd8a)
|
Results of run 44334532132, all jobs green. Function: the static binaries work
Performance: the static gateway is about 4x slower and 4x largerMedian of 3 alternating rounds, 20 s each, wrk with 64 connections on the same runner; both built by Rust 1.95 from the same commit.
The cause is not identified: mimalloc is linked, so musl's own allocator is not the whole story. Candidates are mimalloc on static musl, musl's memory routines, or something in wasmtime under musl. As it stands, Also found
|
The static musl gateway ran about 4x slower with 4.4x the memory (results on #404, follow-up in #409), so the prototype moves to the glibc build on scratch: - the build stage is the bookworm Rust image the release uses today, with `cargo auditable`; - a bookworm-slim stage installs the archive's current libc6, libgcc-s1 and ca-certificates, and docker/scratch-rootfs.sh copies the files of libc6 and libgcc-s1 with their dpkg status records and os-release, so Grype matches them against Debian's tracker, plus the CA bundle, the users, nsswitch.conf and /tmp; it fails if the binary does not start in a chroot of those files; - mimalloc goes with musl. The workflow checks Syft sees Debian 12 with libc6 and libgcc-s1, lists every Grype match besides the release scan, and runs the load comparison with both images as containers: today's (main's Dockerfile) against the scratch one.
With Debian 12's glibc 2.36 (run 44361456851) the scratch gateway matched today's image on the mock route but proxied 6% fewer requests and peaked 11% higher in memory, and a default Grype scan listed 33 matches on libc6 and libgcc-s1, 1 critical and 7 high among them, most marked won't fix: Debian 12 is oldstable, on LTS since June 2026. Debian 13 is stable and carries glibc 2.41. The build stage stays on Debian 12, whose glibc the runtime's exceeds. The load job also lists every Grype match in today's image, to compare.
With Debian 13's runtime files (run 44366600617) the scratch gateway again proxied 6% fewer requests than today's image and peaked 12% higher in memory, as with Debian 12, so the glibc version is not the cause. The load job now also runs today's runtime with the scratch image's binary (`cargo auditable build`) and the scratch runtime with today's binary (`cargo build`), to tell which of the two the gap follows.
Results: glibc on scratchThe prototype moved from musl to glibc: the binary built as today (Debian 12 builder) plus Size. Compressed, the gateway image is 19.7 MB against 19.3 MB today; the control plane 10.0 MB. Of the 13 MB of runtime files uncompressed, 8 MB are glibc's gconv modules, which only Scanners. A default Grype scan (no
The release scan ( Performance. Run 44371738254 crosses the two builds with the two runtimes, all as containers, medians of 3 rounds, ratio to today:
The gap follows the runtime: So far. musl: about 4x slower (#409). Debian's glibc on scratch: works, same size, slower on the proxied route, and a default scan lists 33 to 38 matches where today's image lists none. What today's image brings is Wolfi's glibc build and its security feed, not the Chainguard image as such. |
Debian's glibc on scratch cost 7 to 10% on the proxied route and about 10 MiB (run 44371738254: the gap follows the runtime files, not `cargo auditable`), and a default Grype scan listed 31 to 33 CVEs on Debian's records where today's image lists none. docker/runtime.apko.yaml defines the base: wolfi-baselayout, ca-certificates-bundle, glibc-2.44, ld-linux-2.44 and libgcc from packages.wolfi.dev, and the nonroot user with its home. CI installs apko v1.4.15 with `go install`, locks the packages and builds the base from the lock; both Dockerfiles take it as BASE (default: Chainguard's glibc-dynamic, which today's data plane uses) and add the binary. The Debian runtime stage and docker/scratch-rootfs.sh go. The image job checks Syft sees Wolfi and the five packages; the load job compares today's image with the apko one.
GHSA-3pv8-6f4r-ffg2 (tar, medium) and GHSA-cq8v-f236-94qc (rand, low). Neither has a RustSec id, so cargo deny never reported them; Grype found them in the static-image prototype (#404) through the crate list that `cargo auditable` embeds. Only the two packages change in Cargo.lock: a plain `cargo update -p` also re-resolved Windows-only windows-sys entries, which are left as they are on main.
Results: a runtime base built with apko from Wolfi
The release scan on the apko images finds only Load, both images as containers, medians of 3 rounds (the job's second attempt; the first had a round disturbed for both images):
Same performance and the same clean scan as today, from packages and a tool that are open source, under versions we pin and tags we publish. Wolfi keeps old builds in its index (24 builds of glibc 2.44 back to August, Today's image comes from Chainguard's own repository ( |
* feat(images): a runtime base of Wolfi packages built with apko The data plane image ran on cgr.dev/chainguard/glibc-dynamic, whose free tier publishes `latest` only, and the control plane on Debian 12 slim. Both now run on a base the repository defines: - docker/runtime.apko.yaml lists wolfi-baselayout, ca-certificates-bundle, glibc-2.44, ld-linux-2.44 and libgcc from packages.wolfi.dev, and the nonroot user (65532) with its home; docker/runtime.apko.lock.json pins every package by version and checksum. - Both Dockerfiles build the base from the lock in a stage of their own (apko v1.4.15, on the build platform, for the target architecture) and copy its files under the binary on scratch. The release, CI's image job and `make docker-build` build them as before. - The binaries are built with `cargo auditable`, so scanners read their crates. - `barbacane-control health` calls /health and exits 0 on 200: the control-plane image has no shell, and its HEALTHCHECK runs it. - The Runtime base workflow scans the base and the latest release's images every night, and pushes a newer lock to deps/runtime-base; Actions may not open pull requests here, so a person opens it. - CI's image job checks the two images hold no shell or package manager, the home belongs to 65532, /tmp is 1777 and the apk database is there. The prototype in #404 measured the gateway on this base against today's image: same throughput and latency on a mock and a proxied route (0.99 and 1.00), same peak memory (1.01), 18.0 MB against 19.3 MB, and a default Grype scan finds no OS matches on either. Debian's glibc on scratch had cost up to 10% on proxied routes and listed 31 to 33 CVEs; static musl ran 4x slower (#409). The lock comes from the Runtime base workflow's first run on this branch. Refs #397. * feat(images): lock the runtime base's packages glibc-2.44 and its loader and POSIX locale at 2.44-r23, libgcc 16.2.0-r5, ca-certificates-bundle 20261020-r0 and wolfi-baselayout 20230201-r31, for amd64 and arm64, as the Runtime base workflow locked them (run 44397561698).
|
Superseded by #411, which shipped the third variant (a runtime base of Wolfi packages built with apko). The comments above keep the measurements of all three. |
#409 reported the static musl gateway about 4x slower than the glibc one, from a single run of the #404 prototype. It does not reproduce: the same source built for musl with its own allocator, mimalloc and jemalloc, on the commit #404 measured, on the one after the Wasmtime bump and on current main, and once exactly as #404 built it (cargo auditable, symbols stripped, mimalloc), stays within 0.80 to 0.97x the glibc build's throughput with about a quarter less memory with musl's own allocator. The profile puts the gap in musl's allocator lock, malloc and free, and memcpy. The release keeps musl's own allocator: jemalloc would close the gap on the mock route but adds a C dependency to cross-compile for two targets, and mimalloc holds 4x the memory. The installation guide says what the musl builds trade. Closes #409.
* ci(deny): ignore RUSTSEC-2026-0543 (chrono unmaintained) The advisory, published 2026-11-17, marks every chrono version as unmaintained; it reports no vulnerability. rskafka 0.6 requires chrono whatever the workspace uses, so no change here removes it. The audit job failed on every pull request. #400 moves the workspace's own uses to `time`. (cherry picked from commit 8fe1641) * fix(deps): Wasmtime 48.0.9 (RUSTSEC-2026-0566 to -0573) Eight Wasmtime advisories published on 2026-11-18, fixed in 48.0.9, fail cargo deny on every pull request. None reaches the gateway; the CHANGELOG says why for each. Only the 28 Wasmtime, Cranelift and Pulley packages change in both locks: `cargo update -p wasmtime` also re-resolved Windows-only windows-sys entries, which stay as they are on main. cargo deny's advisories check passes and barbacane-wasm's 283 unit tests pass. (cherry picked from commit 695cce3) * chore(deps): tar 0.4.46 and rand 0.8.6 (#410) GHSA-3pv8-6f4r-ffg2 (tar, medium) and GHSA-cq8v-f236-94qc (rand, low). Neither has a RustSec id, so cargo deny never reported them; Grype found them in the static-image prototype (#404) through the crate list that `cargo auditable` embeds. Only the two packages change in Cargo.lock: a plain `cargo update -p` also re-resolved Windows-only windows-sys entries, which are left as they are on main. (cherry picked from commit 998fac2) * fix(deps): url 2.5.9 for RUSTSEC-2026-0592 RUSTSEC-2026-0592: `Url::origin()` recurses into a `blob:` URL's inner URL without a bound, so a deeply nested `blob:blob:...` URL overflows the stack. Fixed in url 2.5.9; form_urlencoded moves to 1.2.3 with it. Barbacane does not reach it: neither its code nor any crate that depends on url in its tree (reqwest, sqlx, async-nats, ldap3, wiremock) calls `Url::origin()`. The bump clears the advisory gate (cargo deny), which fails every build from today. The plugins do not depend on url. Workspace and fuzz lockfiles; both resolve with --locked, and `cargo deny check advisories` passes. (cherry picked from commit 31a933c) * chore(release): 0.12.5 Versions 0.12.5, and the 0.12.5 CHANGELOG section for the dependency updates backported from main: Wasmtime 48.0.9 (RUSTSEC-2026-0566 to -0573), tar 0.4.46 and rand 0.8.6 (GHSA-3pv8-6f4r-ffg2, GHSA-cq8v-f236-94qc) and url 2.5.9 (RUSTSEC-2026-0592). Each "does not reach" statement in the CHANGELOG was checked on 0.12's code and tree, not taken from main's: no wasmtime-wasi in the lockfile, no component loading, `get_module_export` or GC reference in a host function, default Wasmtime features (gc, threads), rand 0.8 without `log`, `.bca` read with tar-rs only, and no `Url::origin()` call in the code or in the seven crates that depend on url. * ci: run the 0.12 integration tests on Rust 1.99.1 On Rust 1.100 (stable since 2026-11-09) the integration tests on release/0.12 fail before running anything: `assert_cmd` cannot find `CARGO_BIN_EXE_barbacane`, and the lifecycle tests look for the gateway binary under target/debug/build/barbacane-test/<hash>/. Cargo 1.100 puts build output elsewhere; 0.12.4's integration tests ran on 1.99.1. The integration-tests job pins 1.99.1. The other jobs stay on stable, which builds, lints and unit-tests 0.12 on 1.100, the compiler the release workflow builds with. main rewrote the harness's binary lookup during 1.0.0-rc.1 and pins its toolchain. * ci: UI end-to-end tests on Ubuntu 24.04; release builds pin cross ubuntu-latest is Ubuntu 26.04, for which Playwright 1.58.2 (0.12's UI) has no Chromium build: the UI E2E job failed with "Playwright does not support chromium on ubuntu26.04-x64". It runs on ubuntu-24.04. The release workflow installed cross from the head of its repository. It now installs a9301e91, the commit v0.12.4's release used (and the head today), so 0.12.5 builds its aarch64 and musl binaries with the same cross as 0.12.4. The release jobs already ran on Ubuntu 26.04 for v0.12.4.
Prototype for #397: our own runtime base, built with apko from Wolfi packages, under both images. Draft: it exists to produce the numbers the decision needs, not to merge as is.
Two earlier versions are recorded in the comments: static musl binaries on
scratchran about 4x slower (results, #409), and Debian's glibc onscratchran up to 10% slower on proxied routes with 31 to 33 CVEs in a default scan (results). Results for this version: comment.What changes
docker/runtime.apko.yaml: the base.wolfi-baselayout,ca-certificates-bundle,glibc-2.44,ld-linux-2.44andlibgccfrompackages.wolfi.dev, thenonrootuser (65532) and its home. No shell, no package manager.Dockerfile,Dockerfile.control: built onrust:1.95-slim-bookworm(the builder the release uses today) withcargo auditable, which embeds the crate list scanners read; the final stage isFROM ${BASE}plus the binary. WithoutBASE, Chainguard'sglibc-dynamic, so CI's own image job builds them as they are.barbacane-controlmoves from Debian slim to the same base, runs as 65532 and has noHEALTHCHECK(no shell).barbacane-standaloneis unchanged: it keeps a shell (Align the container images on Wolfi #397).What CI checks (
static-images.yml)--version) and holds no shell or package manager; home (65532),/tmp(1777), CA bundle,nsswitch.conf,os-releaseand the apk database are there; Syft sees Wolfi, the five packages and the Rust crates; Grype's release scan passes, and a second scan lists every matchBARBACANE_TEST_BINARYset to the image's gatewayDockerfile) against the apko one, both with the gateway from this commit and both run as containers; 3 alternating rounds of 20 s under wrk on a mock route and a proxied route, with the cors and correlation-id middlewares. Before each round, a route tolocalhostand one tohttps://example.commust answer 200. Also every Grype match in today's imageNot in the prototype
Publishing the base (multi-arch, under
ghcr.io/barbacane-dev) and pinning it by digest in the Dockerfiles; the committed lock and a scheduled job that refreshes it; the release workflow; the nightly scans; a health-check subcommand forbarbacane-control;BARBACANE_TRUSTED_PUBKEY_FILE; docs and CHANGELOG. They come with the real change.Refs #397.