Skip to content

Commit dd1b2d5

Browse files
committed
Harden CI: SHA-pin all actions, add persist-credentials: false
Pin all GitHub Actions to full commit SHAs to prevent supply-chain attacks via tag mutation. Add persist-credentials: false to all checkout steps to limit token exposure. All 8 workflow files updated. Actions pinned: - actions/checkout v4 (34e1148) - actions/setup-python v5 (a26af69) - actions/setup-node v4 (49933ea) - actions/upload-artifact v4 (ea165f8) - actions/github-script v7 (f28e40c) - actions/labeler v5 (8558fd7) - dependabot/fetch-metadata v2 (21025c7) - jgehrcke/github-repo-stats RELEASE (d80572c) - astral-sh/setup-uv v3 (caf0cab)
1 parent 0f0e83a commit dd1b2d5

8 files changed

Lines changed: 22 additions & 16 deletions

File tree

.github/workflows/ash-full-repository-scan.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2121
with:
22+
persist-credentials: false
2223
fetch-depth: 0
2324

2425
- name: Set up Python
25-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2627
with:
2728
python-version: '3.10'
2829

@@ -112,7 +113,7 @@ jobs:
112113
113114
- name: Upload ASH results as artifacts
114115
if: always()
115-
uses: actions/upload-artifact@v4
116+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
116117
with:
117118
name: ash-full-scan-${{ github.run_id }}
118119
path: |
@@ -123,7 +124,7 @@ jobs:
123124

124125
- name: Create issue for critical findings (monthly scan only)
125126
if: github.event_name == 'schedule' && steps.scan-summary.outputs.has_findings == 'true'
126-
uses: actions/github-script@v7
127+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
127128
with:
128129
github-token: ${{ secrets.GITHUB_TOKEN }}
129130
script: |

.github/workflows/ash-security-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
4949
- name: Post comment on PR
5050
if: steps.pr-info.outputs.pr_number
51-
uses: actions/github-script@v7
51+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
5252
with:
5353
github-token: ${{ secrets.GITHUB_TOKEN }}
5454
script: |

.github/workflows/ash-security-scan.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
scan:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1717
with:
18+
persist-credentials: false
1819
fetch-depth: 0
1920

2021
- name: Get changed files
@@ -49,7 +50,7 @@ jobs:
4950
5051
- name: Set up Python
5152
if: steps.changed-files.outputs.any_changed == 'true'
52-
uses: actions/setup-python@v5
53+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
5354
with:
5455
python-version: '3.10'
5556

@@ -216,7 +217,7 @@ jobs:
216217
217218
- name: Upload ASH results and PR metadata
218219
if: steps.changed-files.outputs.any_changed == 'true' && always()
219-
uses: actions/upload-artifact@v4
220+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
220221
with:
221222
name: ash-security-results
222223
path: /tmp/ash-artifacts/

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- name: Dependabot metadata
1717
id: metadata
18-
uses: dependabot/fetch-metadata@v2
18+
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2
1919
with:
2020
github-token: "${{ secrets.GITHUB_TOKEN }}"
2121

.github/workflows/js-lint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
working-directory: frontend
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21+
with:
22+
persist-credentials: false
2123

2224
- name: Get changed JS/TS files
2325
id: changed-files
@@ -34,7 +36,7 @@ jobs:
3436
3537
- name: Set up Node.js
3638
if: steps.changed-files.outputs.any_changed == 'true'
37-
uses: actions/setup-node@v4
39+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
3840
with:
3941
node-version: '20'
4042

.github/workflows/label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
contents: read
1414
pull-requests: write
1515
steps:
16-
- uses: actions/labeler@v5
16+
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5
1717
with:
1818
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/python-lint.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
18+
with:
19+
persist-credentials: false
1820

1921
- name: Get changed Python files
2022
id: changed-files
@@ -25,13 +27,13 @@ jobs:
2527
2628
- name: Set up Python
2729
if: steps.changed-files.outputs.any_changed == 'true'
28-
uses: actions/setup-python@v5
30+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2931
with:
3032
python-version: '3.11'
3133

3234
- name: Install uv
3335
if: steps.changed-files.outputs.any_changed == 'true'
34-
uses: astral-sh/setup-uv@v3
36+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3
3537

3638
- name: Install ruff
3739
if: steps.changed-files.outputs.any_changed == 'true'

.github/workflows/repo-stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: run-ghrs
23-
uses: jgehrcke/github-repo-stats@RELEASE
23+
uses: jgehrcke/github-repo-stats@d80572c9029636cd0e97e3a79e7a9c293bea3b02 # RELEASE
2424
with:
2525
ghtoken: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
2626
ghpagesprefix: "https://awslabs.github.io/fullstack-solution-template-for-agentcore"

0 commit comments

Comments
 (0)