Files
trailofbits-buttercup/.github
Henrik Brodin a3d805cb35 ci: shell-quote env values in system-integration workflow (#536)
* ci: shell-quote env values for system integration tests

Two bugs in the env file step prevented the weekly System Integration
Tests from ever passing since #427 (2026-01-26):

1. The deletion regex `/^KEY=/` did not match the template's
   `export KEY=replace-me` lines, leaving stale `replace-me` placeholders
   in the file alongside the appended real values.
2. Appended values were not shell-quoted, so `source ./env` in
   deployment/crs-architecture.sh treated whitespace and metacharacters
   as shell syntax. The `OTEL_TOKEN` secret (a `Bearer <token>` header)
   tripped this with `command not found` on the token component.

The same gap was a code-execution sink: a secret containing `$(...)` or
backticks would execute on the runner at source time.

Fix: strip with `(export[[:space:]]+)?` so template lines are actually
removed, and write with `printf 'export %s=%q\n'` so every value is
shell-escaped — defending against both whitespace and injection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: drop placeholder block from ci-env.template

The placeholder lines (`export KEY=replace-me`) only existed because the
pre-rewrite step substituted into them with `sed -i "s|KEY=.*|...|"`.
The new `printf %q` write path doesn't need them, so removing them at
the source eliminates the entire delete-then-rewrite dance.

Drops `strip_var` and the for-loop. The workflow step is now: copy the
static template, then append shell-quoted assignments for every secret
the env: block injects. GHCR_AUTH is no longer defined at all, so the
`[ -n "$GHCR_AUTH" ]` warning branch in crs-architecture.sh:63 fires as
intended.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 13:06:47 +02:00
..
2025-04-16 19:19:43 +02:00