Skip to content

ci: harden publish workflow (script-injection, engine guard, key-id env)#30

Merged
trustabl merged 1 commit into
mainfrom
cf/publish-workflow-hardening
Jun 16, 2026
Merged

ci: harden publish workflow (script-injection, engine guard, key-id env)#30
trustabl merged 1 commit into
mainfrom
cf/publish-workflow-hardening

Conversation

@jhumel-code

Copy link
Copy Markdown
Collaborator

What

Hardens .github/workflows/publish.yml from the pre-merge audit of the signed-distribution rollout. Three fixes:

  1. Script-injection (CWE-94). workflow_dispatch inputs (channel, ttl_hours, engine_ref) were interpolated directly into run: shell via ${{ }}. The Sign step exports the signing secret, so this was a key-exfiltration path. They are now routed through workflow env: and referenced as shell vars ($CHANNEL, ${TTL_HOURS}, $ENGINE_REF) — a malicious value stays inert data. Added a Validate inputs step (channel ^[a-z0-9._-]+$, ttl_hours ^[0-9]+$).
  2. Engine guard. A new early step fails with a clear message if engine_ref lacks cmd/rulesctl or embeds an empty keyring (e.g. dispatched before the engine change merges), instead of a raw build/verify error deep in the run.
  3. Key-id source. The sign step referenced vars.RULES_SIGNING_KEY_ID, a repo variable that does not exist (it was eliminated in favor of an in-workflow value). It now reads the key id from a workflow env var, matching keyring.json's id exactly.

Why now

This lands on top of the already-merged publish.yml (PR #29). The merged version still references the dangling variable and carries the injection, so the workflow could not run correctly and should not be dispatched until this merges.

Notes

Still gated: the workflow is workflow_dispatch-only, promote is behind the production environment (required reviewer), and it self-verifies the candidate against the embedded keyring before promote. Refs TR-323.

🤖 Generated with Claude Code

- Route workflow_dispatch inputs (channel, ttl_hours, engine_ref) through env and
  reference as shell vars; never interpolate into run: shell (CWE-94). The Sign
  step holds the signing secret, so this closes a key-exfiltration path. Add an
  input-format validation step.
- Add an early guard that fails with a clear message if engine_ref lacks
  cmd/rulesctl or embeds an empty keyring, instead of a raw build/verify error.
- Take the signing key id from a workflow env var (not a repo variable), fixing
  the dangling vars.RULES_SIGNING_KEY_ID reference. (TR-323)
@trustabl trustabl merged commit 23cfc72 into main Jun 16, 2026
1 check 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.

2 participants