Skip to content

Commit cb1b4d3

Browse files
Merge pull request #1037 from Caritajoe18/zizmor-fixes
Zizmor fixes
2 parents 0fdce5a + 55a335d commit cb1b4d3

3 files changed

Lines changed: 71 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,44 @@ on:
66
branches:
77
- master
88

9+
# Limit concurrent workflow runs to prevent resource conflicts and ensure clean deployments
10+
concurrency:
11+
group: pages
12+
cancel-in-progress: false
13+
14+
# Default permissions for all jobs - minimal access
15+
permissions: {}
16+
917
jobs:
1018
build:
19+
name: Build site
1120
env:
1221
MDBOOK_VERSION: 0.5.1
1322
RUN_BLACKSMITH: 1
1423
runs-on: ubuntu-latest
1524
steps:
16-
- uses: actions/checkout@v6
25+
# Checkout repository without persisting credentials to reduce attack surface
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
27+
with:
28+
persist-credentials: false
1729
- name: Install mdbook
1830
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz
1931
- name: Build book
2032
run: ./mdbook build
2133
- name: Upload artifact
22-
uses: actions/upload-pages-artifact@v4
34+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
2335
with:
2436
path: ./book/html
2537

2638
deploy:
39+
name: Deploy to GitHub Pages
2740
if: github.repository_owner == 'rust-lang'
2841
needs: build
2942

43+
# Required permissions for GitHub Pages deployment
3044
permissions:
31-
pages: write
32-
id-token: write
45+
pages: write # Required to deploy to GitHub Pages
46+
id-token: write # Required for OIDC authentication with GitHub Pages service
3347

3448
environment:
3549
name: github-pages
@@ -38,4 +52,4 @@ jobs:
3852
runs-on: ubuntu-latest
3953
steps:
4054
- id: deployment
41-
uses: actions/deploy-pages@v4
55+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5

.github/workflows/test.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ name: Test
22
on:
33
pull_request:
44

5+
# Cancel in-progress runs for the same PR to save resources
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
10+
# Minimal permissions for testing
11+
permissions:
12+
contents: read
13+
514
jobs:
615
test:
716
name: test
@@ -11,7 +20,10 @@ jobs:
1120
MDBOOK_OUTPUT__LINKCHECK__WARNING_POLICY: error
1221
RUN_BLACKSMITH: 1
1322
steps:
14-
- uses: actions/checkout@v4
23+
# Checkout repository without persisting credentials to reduce attack surface
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
with:
26+
persist-credentials: false
1527
- name: Install mdbook
1628
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz
1729
- name: Install mdbook-linkcheck2

.github/workflows/zizmor.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Security Audit with zizmor
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- '.github/workflows/**'
8+
pull_request:
9+
branches: [master]
10+
paths:
11+
- '.github/workflows/**'
12+
13+
# Cancel in-progress runs for the same PR to save resources
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
# Minimal permissions for auditing
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
zizmor:
24+
name: Run zizmor security audit
25+
runs-on: ubuntu-latest
26+
steps:
27+
# Checkout repository without persisting credentials to reduce attack surface
28+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29+
with:
30+
persist-credentials: false
31+
32+
- name: Install zizmor
33+
run: |
34+
curl -sSL https://github.com/woodruffw/zizmor/releases/download/v1.24.1/zizmor-x86_64-unknown-linux-gnu.tar.gz | tar -xz
35+
chmod +x zizmor
36+
sudo mv zizmor /usr/local/bin/
37+
38+
- name: Run zizmor audit
39+
run: zizmor --persona pedantic --min-severity low .github/workflows

0 commit comments

Comments
 (0)