Harden CI: pass setup-openclaw inputs through env instead of into the script - #5298
Merged
Merged
Conversation
The shared setup-openclaw composite action expanded caller-supplied
inputs directly into its run: blocks, so the values became part of the
script text before bash ever saw them:
- `inputs.version` was expanded into the `npm install -g` argument
- `inputs.gateway-token` was expanded into the line appended to
$GITHUB_ENV
- `steps.cache.outputs.cache-hit` was expanded into a test
All three now reach the shell through `env:` and are referenced as
quoted variables, which is the documented safe pattern.
$GITHUB_ENV is line-oriented, so the token step also rejects a
multi-line value with a clear error instead of writing it: the input is
documented as a single token, and a newline in it would define extra
environment variables for every later step in the job.
No caller changes: all six workflows that use this action keep passing
the same values, and the resolved version and token behave identically.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KukCwqqjmm2pkomzHtu2Wm
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
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.
Continues the CI hardening series. One concern, one file:
.github/actions/setup-openclaw/action.yml.This is the last place in the repo where a caller-supplied
inputs.*value was expanded into arun:block. After the recent pinning and token-scope PRs,.github/now has zeroinputs.*interpolations insiderun:.What changed
The shared
setup-openclawcomposite action expanded three values directly into itsrun:blocks, so each became part of the script text before bash ever saw it:inputs.versionnpm install -gargumentinputs.gateway-token$GITHUB_ENVsteps.cache.outputs.cache-hit[ ... = "true" ]testAll three now reach the shell through
env:and are referenced as quoted shell variables — the documented safe pattern, and the same one PRs #5246, #5249, #5251 and #5295 applied to the workflows.The token step additionally rejects a multi-line value with a clear
::error::instead of writing it.$GITHUB_ENVis line-oriented, so a newline in that value would define extra environment variables for every later step in the job. The input is documented as a single token, so failing loudly is the honest behaviour.Why this action in particular
It is shared, not local: six workflows call it —
ci,e2e-nightly,openclaw-boot,pr-screenshots,oss-golden-path,moat-keystone-drive-nightly— so one fix covers all six call sites.pr-screenshotsis the one that passes a secret-backed value (CLAWMETRY_VISUAL_DIFF_TOKEN) asgateway-token.Verification
python3 -c "import yaml,glob; [yaml.safe_load(open(f)) for f in glob.glob('.github/workflows/*.yml')]", plus the same over*.yamland.github/actions/**. All parse.run:blocks forinputs.*interpolation: 0 remaining (was 2, both in this file).ci-openclaw-token) and one containing spaces, quotes and backticks are both written to$GITHUB_ENVverbatim and unexpanded; a value containing a newline exits 1 with the error rather than writing a second variable. A version string containing shell metacharacters stays a single inertnpmargument.No behaviour change for callers
All six callers keep passing exactly the same values, and the action's
versionoutput and exportedOPENCLAW_GATEWAY_TOKENare unchanged for every value any of them passes today.Not in this PR
Two lower-priority classes remain in
.github/, each its own batch:${{ github.event_name }}in two workflows — a GitHub-controlled enum, not caller-influenced.${{ steps.*.outputs.* }}inrun:blocks across ~7 workflows — values produced by earlier steps in the same job rather than by a caller.Scope
.github/only, which is exempt from the product-record CI gate.No-PRD: CI/workflow hardening only, no product surface touched.
Generated by Claude Code