Skip to content

Commit 0d6d430

Browse files
authored
Merge pull request #32 from dash14/security/harden-example-workflows
Harden example workflows for supply chain security
2 parents fb61fb9 + dd6d441 commit 0d6d430

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

.github/workflows/example-audit.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13+
# Prevent accidental execution of dash14's actions after forking.
14+
# External actions referenced by tag pose a supply chain risk.
15+
- name: Guard against unmodified fork usage
16+
if: github.repository != 'dash14/buildcage'
17+
run: |
18+
echo "::error::This example references dash14/buildcage actions by tag. Replace with your fork (e.g., <your-org>/buildcage/setup@v2), or pin by commit hash if using dash14/buildcage directly."
19+
exit 1
20+
1321
- name: Start Buildcage builder
22+
# For self-hosting, replace with: <your-org>/buildcage/setup@v2
23+
# If using dash14/buildcage directly, pinning by commit hash is
24+
# recommended for supply chain security.
1425
uses: dash14/buildcage/setup@v2
1526
with:
1627
proxy_mode: audit
1728

1829
- name: Set up Docker Buildx
19-
uses: docker/setup-buildx-action@v4
30+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
2031
with:
2132
driver: remote
2233
endpoint: docker-container://buildcage
@@ -31,7 +42,7 @@ jobs:
3142
EOF
3243
3344
- name: Build test image
34-
uses: docker/build-push-action@v6
45+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
3546
with:
3647
context: /tmp/build-context
3748
push: false
@@ -42,4 +53,7 @@ jobs:
4253

4354
- name: Show proxy report
4455
if: always()
56+
# For self-hosting, replace with: <your-org>/buildcage/report@v2
57+
# If using dash14/buildcage directly, pinning by commit hash is
58+
# recommended for supply chain security.
4559
uses: dash14/buildcage/report@v2

.github/workflows/example-restrict.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13+
# Prevent accidental execution of dash14's actions after forking.
14+
# External actions referenced by tag pose a supply chain risk.
15+
- name: Guard against unmodified fork usage
16+
if: github.repository != 'dash14/buildcage'
17+
run: |
18+
echo "::error::This example references dash14/buildcage actions by tag. Replace with your fork (e.g., <your-org>/buildcage/setup@v2), or pin by commit hash if using dash14/buildcage directly."
19+
exit 1
20+
1321
- name: Start Buildcage builder
22+
# For self-hosting, replace with: <your-org>/buildcage/setup@v2
23+
# If using dash14/buildcage directly, pinning by commit hash is
24+
# recommended for supply chain security.
1425
uses: dash14/buildcage/setup@v2
1526
with:
1627
proxy_mode: restrict
@@ -19,7 +30,7 @@ jobs:
1930
fonts.googleapis.com:443
2031
2132
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v4
33+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
2334
with:
2435
driver: remote
2536
endpoint: docker-container://buildcage
@@ -35,7 +46,7 @@ jobs:
3546
EOF
3647
3748
- name: Build test image
38-
uses: docker/build-push-action@v6
49+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
3950
with:
4051
context: /tmp/build-context
4152
push: false
@@ -46,6 +57,9 @@ jobs:
4657

4758
- name: Show proxy report
4859
if: always()
60+
# For self-hosting, replace with: <your-org>/buildcage/report@v2
61+
# If using dash14/buildcage directly, pinning by commit hash is
62+
# recommended for supply chain security.
4963
uses: dash14/buildcage/report@v2
5064
with:
5165
fail_on_blocked: false

0 commit comments

Comments
 (0)