-
Notifications
You must be signed in to change notification settings - Fork 21
Security/harden shell cicd #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bde56b8
769fbc0
9c47809
9dd2f4c
445c912
8b9ef58
91e4469
de7654f
7c146e8
c183f24
ecfca6b
0b1cf4e
6480c90
d2625e7
4a9a66f
299a5b8
d4c25b3
b874c1a
665efee
d0c65d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -231,6 +231,9 @@ jobs: | |
| # commit the reviewer never approved. | ||
| ref: ${{ needs.release.outputs.sha }} | ||
| fetch-depth: 1 | ||
| # Publish reads a pinned SHA and never pushes; don't leave | ||
| # GITHUB_TOKEN in .git/config. | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6.4.0 | ||
|
|
@@ -246,9 +249,10 @@ jobs: | |
| cache: "npm" | ||
|
|
||
| - name: Load secrets from 1Password | ||
| id: op_secrets | ||
| uses: 1Password/load-secrets-action@v4.0.0 | ||
| with: | ||
| export-env: true | ||
| export-env: false | ||
| env: | ||
| OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | ||
| CLAWHUB_TOKEN: "op://GitHub Actions/hivemind/CLAWHUB_TOKEN" | ||
|
|
@@ -316,13 +320,19 @@ jobs: | |
| npm publish --provenance --access public | ||
|
|
||
| - name: Install ClawHub CLI | ||
| run: npm install -g clawhub | ||
| # Pin the CLI version: it runs immediately before `clawhub login --token` | ||
| # with the real CLAWHUB_TOKEN in env, so a floating `@latest` would let an | ||
| # unexpected publish read/exfiltrate the token. Bump deliberately. | ||
| run: npm install -g clawhub@0.18.0 | ||
|
Comment on lines
+323
to
+326
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mirror the ClawHub pin into the smoke-test workflow too. This step is pinned now, but 🤖 Prompt for AI Agents |
||
|
|
||
| - name: Authenticate ClawHub CLI | ||
| # `clawhub login --token` writes a credential file inside the | ||
| # runner's $HOME, which is ephemeral and discarded when the job | ||
| # ends. The token only ever appears as ${{ secrets.* }}, which | ||
| # GitHub auto-masks in logs. | ||
| # ends. The token is scoped to this step only (not exported to all | ||
| # steps via export-env) to limit the blast radius if any build step | ||
| # is compromised. | ||
| env: | ||
| CLAWHUB_TOKEN: ${{ steps.op_secrets.outputs.CLAWHUB_TOKEN }} | ||
| run: clawhub login --token "$CLAWHUB_TOKEN" --no-browser | ||
|
|
||
| - name: Publish openclaw bundle to ClawHub | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release checkout still persists the write-scoped token.
This hardens the
publishcheckout, but thereleasejob's checkout at Lines 33-36 still leavessecrets.GITHUB_TOKENin.git/configfor the wholenpm ci/build/commit sequence. That keeps the highest-privilege checkout in this workflow outside the hardening and widens exposure if any install/build step is compromised. Please setpersist-credentials: falsethere too and inject auth only for the finalgit push.Based on learnings, every
actions/checkoutstep in.github/workflowsshould setpersist-credentials: falseexplicitly.🤖 Prompt for AI Agents