ci: harden publish workflow (script-injection, engine guard, key-id env)#30
Merged
Conversation
- 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Hardens
.github/workflows/publish.ymlfrom the pre-merge audit of the signed-distribution rollout. Three fixes:workflow_dispatchinputs (channel,ttl_hours,engine_ref) were interpolated directly intorun:shell via${{ }}. The Sign step exports the signing secret, so this was a key-exfiltration path. They are now routed through workflowenv:and referenced as shell vars ($CHANNEL,${TTL_HOURS},$ENGINE_REF) — a malicious value stays inert data. Added aValidate inputsstep (channel^[a-z0-9._-]+$,ttl_hours^[0-9]+$).engine_reflackscmd/rulesctlor embeds an empty keyring (e.g. dispatched before the engine change merges), instead of a raw build/verify error deep in the run.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 workflowenvvar, matchingkeyring.json'sidexactly.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 theproductionenvironment (required reviewer), and it self-verifies the candidate against the embedded keyring before promote. Refs TR-323.🤖 Generated with Claude Code