Skip to content

Commit ef2d524

Browse files
frankbriaTest User
andauthored
chore(ci): supply-chain hardening — SHA-pin actions, dependabot, deploy gate (#632)
* chore(ci): supply-chain hardening — SHA-pin actions, dependabot, deploy gate Hardens the public repo's CI/CD ahead of beta traffic. - SHA-pin every third-party and first-party action across all workflows (was using mutable tags / @latest). Notably webfactory/ssh-agent (holds the VPS deploy key), anthropics/claude-code-action, codecov/codecov-action, and anomalyco/opencode (was @latest, a moving ref). Version kept in a trailing comment for readability. - Add .github/dependabot.yml (github-actions + pip + npm, weekly, grouped) so the new pins receive security/patch bumps instead of going stale. - Re-enable the test gate on the production deploy job (was commented out, so production could deploy without tests passing); clarify the staging gate. - Delete opencode-review.yml: it was already disabled (`if: false`) and flagged by its own comment as leaking GITHUB_TOKEN into PR comments, yet still carried issues:write + pull-requests:write. Removed rather than left parked. Settings applied out of band: Dependabot vulnerability alerts + automated security fixes enabled; branch protection on main set to strict (require up-to-date branch) + required conversation resolution. * chore(ci): align opencode.yml checkout to v4 SHA for pin consistency Addresses CodeRabbit: every other workflow pins actions/checkout to the v4 SHA; opencode.yml was on v6. No functional difference for a plain checkout. --------- Co-authored-by: Test User <test@example.com>
1 parent 4637786 commit ef2d524

8 files changed

Lines changed: 66 additions & 151 deletions

File tree

.github/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
updates:
3+
# Keep GitHub Actions SHA pins current (security patches to pinned actions).
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
groups:
9+
actions:
10+
patterns: ["*"]
11+
update-types: [minor, patch]
12+
13+
# Python dependencies (pyproject.toml).
14+
- package-ecosystem: pip
15+
directory: /
16+
schedule:
17+
interval: weekly
18+
open-pull-requests-limit: 5
19+
groups:
20+
python-minor-patch:
21+
update-types: [minor, patch]
22+
23+
# Web UI dependencies.
24+
- package-ecosystem: npm
25+
directory: /web-ui
26+
schedule:
27+
interval: weekly
28+
open-pull-requests-limit: 5
29+
groups:
30+
npm-minor-patch:
31+
update-types: [minor, patch]

.github/workflows/claude-code-review.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
if: |
3434
github.event.pull_request.changed_files >= 5 ||
3535
steps.calc.outputs.total >= 20
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3737
with:
3838
fetch-depth: 1
3939

@@ -43,7 +43,7 @@ jobs:
4343
github.event.pull_request.changed_files >= 5 ||
4444
steps.calc.outputs.total >= 20
4545
id: claude-review
46-
uses: anthropics/claude-code-action@v1
46+
uses: anthropics/claude-code-action@d5726de019ec4498aa667642bc3a80fca83aa102 # v1
4747
with:
4848
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4949
prompt: |

.github/workflows/claude.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
actions: read # Required for Claude to read CI results on PRs
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3030
with:
3131
fetch-depth: 1
3232

3333
- name: Run Claude Code
3434
id: claude
35-
uses: anthropics/claude-code-action@v1
35+
uses: anthropics/claude-code-action@d5726de019ec4498aa667642bc3a80fca83aa102 # v1
3636
with:
3737
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3838

.github/workflows/deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
deploy-staging:
3535
name: Deploy to Staging
3636
runs-on: ubuntu-latest
37-
needs: test # Temporarily disabled for debugging
37+
needs: test # Gate: do not deploy unless the test suite passes
3838
if: |
3939
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
4040
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging')
@@ -44,10 +44,10 @@ jobs:
4444

4545
steps:
4646
- name: Checkout code
47-
uses: actions/checkout@v4
47+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4848

4949
- name: Set up SSH
50-
uses: webfactory/ssh-agent@v0.9.0
50+
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
5151
with:
5252
ssh-private-key: ${{ secrets.SSH_KEY }}
5353

@@ -248,7 +248,7 @@ jobs:
248248
deploy-production:
249249
name: Deploy to Production
250250
runs-on: ubuntu-latest
251-
# needs: test # Temporarily disabled for debugging
251+
needs: test # Gate: do not deploy to production unless the test suite passes
252252
if: |
253253
(github.event_name == 'release') ||
254254
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
@@ -258,10 +258,10 @@ jobs:
258258

259259
steps:
260260
- name: Checkout code
261-
uses: actions/checkout@v4
261+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
262262

263263
- name: Set up SSH
264-
uses: webfactory/ssh-agent@v0.9.0
264+
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
265265
with:
266266
ssh-private-key: ${{ secrets.SSH_KEY }}
267267

.github/workflows/lifecycle.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ jobs:
3535

3636
steps:
3737
- name: Checkout code
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3939

4040
- name: Set up Python
41-
uses: actions/setup-python@v5
41+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
4242
with:
4343
python-version: ${{ env.PYTHON_VERSION }}
4444

4545
- name: Install uv
46-
uses: astral-sh/setup-uv@v4
46+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
4747
with:
4848
enable-cache: true
4949

@@ -88,7 +88,7 @@ jobs:
8888
8989
- name: Upload test artifacts on failure
9090
if: failure()
91-
uses: actions/upload-artifact@v4
91+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
9292
with:
9393
name: lifecycle-failure-${{ github.run_id }}
9494
path: |

.github/workflows/opencode-review.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/opencode.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
issues: read
2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v6
24+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2525

2626
- name: Run opencode
27-
uses: anomalyco/opencode/github@latest
27+
uses: anomalyco/opencode/github@77fc88c8ade8e5a620ebbe1197f3a572d29ae91a # latest
2828
env:
2929
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
3030
with:

0 commit comments

Comments
 (0)