fix(worker): security audit of R0 — no core dumps, tkill/tgkill limited to SIGABRT on self, mmap without PROT_EXEC, Broken outcome for a broken child environment, frame vs canvas check, unsafe denied with local allows, sandbox tests and derivation on the release profile (syscall marker); wasm proof exports behind a feature; ci: release-images hardened (typed input via env, advisories gate, ephemeral builder, env secrets + logout, ref gate, pinned checkout)

This commit is contained in:
bchanot committed 2026-10-13 00:18:53 +02:00
1 parent 9d3e0294e2
commit 11813f5560
14 files changed
+293 -58

No files matched your search

+53 -14
View File
@@ -1,7 +1,16 @@
# Production images, built in CI and identified by digest (D-R13, owner amendment of
# 2026-10-12): the VPS pulls them and never compiles. Manual only (workflow_dispatch), never
# on push: no publication or promotion of a production image without an explicit run and
# a validation. Nothing here deploys; DEPLOY.md "Image deploy (prepared)" is the runbook.
# a validation. Nothing here deploys; DEPLOY.md "Image deploy by digest (prepared at R0, not
# yet applied)" is the runbook.
#
# Hardening (security audit of R0): the dispatch input is a typed choice re-validated in
# the shell through an environment variable (never interpolated into a script); secrets
# reach the shell through env only, the registry login lives in a per-job DOCKER_CONFIG
# removed at the end; images are built by an ephemeral buildx builder with its own cache,
# so nothing a PR build left in the daemon's cache mounts or volumes can reach a release
# image; the RustSec advisories gate runs before any push; only main and develop may be
# released; the checkout action is pinned to a commit.
#
# Secrets expected on the forge: REGISTRY (host, e.g. the Gitea container registry of this
# forge), REGISTRY_USER, REGISTRY_TOKEN (write:package scope). Images are pushed as
@@ -14,25 +23,55 @@ on:
inputs:
sheet_bundle:
description: 'SHEET_BUNDLE for the app image (none = production default, draft = preview)'
required: false
default: 'none'
required: true
type: choice
options:
- none
- draft
default: none
jobs:
images:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
env:
SHEET_BUNDLE: ${{ inputs.sheet_bundle }}
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
NAMESPACE: ${{ github.repository_owner }}
GIT_SHA: ${{ github.sha }}
steps:
- uses: actions/checkout@v4
- name: Registry login
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Validate the dispatch input (the shell trusts the env value only after this)
run: |
case "$SHEET_BUNDLE" in
none|draft) ;;
*) echo "refused SHEET_BUNDLE value" >&2; exit 1 ;;
esac
- name: RustSec advisories gate (release only; CI runs it nightly)
run: |
docker build -f docker/rust-builder.Dockerfile -t faunosteo_rust_builder:1.99.0 docker
bash docker/rust-run.sh cargo deny check advisories
- name: Ephemeral builder with its own cache and a per-job Docker config
run: |
echo "DOCKER_CONFIG=$(mktemp -d)" >> "$GITHUB_ENV"
docker buildx create --name "faunosteo_release_$GIT_SHA" --driver docker-container --use
- name: Registry login (token from env, never on the command line)
run: printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
- name: Build and push the application image
run: |
image="${{ secrets.REGISTRY }}/${{ github.repository_owner }}/faunosteo_app:${{ github.sha }}"
docker build --build-arg SHEET_BUNDLE="${{ github.event.inputs.sheet_bundle }}" -t "$image" .
docker push "$image"
echo "app: $(docker inspect --format='{{index .RepoDigests 0}}' "$image")" >> "$GITHUB_STEP_SUMMARY"
image="$REGISTRY/$NAMESPACE/faunosteo_app:$GIT_SHA"
docker buildx build --push --provenance=false --build-arg "SHEET_BUNDLE=$SHEET_BUNDLE" -t "$image" .
echo "app: $(docker buildx imagetools inspect "$image" --format '{{json .Manifest.Digest}}')" >> "$GITHUB_STEP_SUMMARY"
- name: Build and push the worker image
run: |
image="${{ secrets.REGISTRY }}/${{ github.repository_owner }}/faunosteo_worker:${{ github.sha }}"
docker build -f crates/worker/Dockerfile -t "$image" .
docker push "$image"
echo "worker: $(docker inspect --format='{{index .RepoDigests 0}}' "$image")" >> "$GITHUB_STEP_SUMMARY"
image="$REGISTRY/$NAMESPACE/faunosteo_worker:$GIT_SHA"
docker buildx build --push --provenance=false -f crates/worker/Dockerfile -t "$image" .
echo "worker: $(docker buildx imagetools inspect "$image" --format '{{json .Manifest.Digest}}')" >> "$GITHUB_STEP_SUMMARY"
- name: Logout, remove the builder and the per-job Docker config
if: always()
run: |
docker logout "$REGISTRY" || true
docker buildx rm "faunosteo_release_$GIT_SHA" || true
rm -rf "$DOCKER_CONFIG"