Skip to content

Commit dac8e1e

Browse files
security(ci): SHA-pin actions + add permissions blocks (F-014/F-015)
- F-014 (CTO-4862): pin every GitHub Actions 'uses:' to a 40-char commit SHA (9 refs across 6 workflows), original tag kept as a comment. - F-015 (CTO-4863): add top-level 'permissions: contents: read' to the five workflows lacking one (semgrep already had it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f119cb9 commit dac8e1e

6 files changed

Lines changed: 28 additions & 13 deletions

File tree

.github/workflows/commitlint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: Check Commit Messages with Commitlint
22
on: [pull_request]
3+
permissions:
4+
contents: read
5+
36
jobs:
47
commitlint:
58
runs-on: ubuntu-latest
69
steps:
7-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
811
with:
912
fetch-depth: 0
10-
- uses: wagoid/commitlint-github-action@v5
13+
- uses: wagoid/commitlint-github-action@9763196e10f27aef304c9b8b660d31d97fce0f99 # v5
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# github action to run commit-msg hook on pull request commits and push commits to master branch
22
name: Validate sample config
33
on: pull_request
4+
permissions:
5+
contents: read
6+
47
jobs:
58
config-validator:
69
runs-on: ubuntu-latest
710
steps:
8-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
912
- name: Run config-validator
1013
run: python scripts/validator.py config.json.sample

.github/workflows/docker-push.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ on:
44
tags:
55
- v*
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
build:
912
runs-on: ubuntu-latest
1013
steps:
1114
- name: Check out the repo
12-
uses: actions/checkout@v3
15+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
1316
- name: Set up QEMU
14-
uses: docker/setup-qemu-action@v2
17+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
1518
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v2
19+
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2
1720
- name: Docker metadata
1821
id: meta
19-
uses: docker/metadata-action@v4
22+
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4
2023
with:
2124
images: |
2225
browserstack/enigma
@@ -25,12 +28,12 @@ jobs:
2528
type=semver,pattern=v{{major}}.{{minor}}
2629
type=semver,pattern=v{{major}}
2730
- name: Login to DockerHub
28-
uses: docker/login-action@v2
31+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
2932
with:
3033
username: ${{ secrets.DOCKERHUB_USERNAME }}
3134
password: ${{ secrets.DOCKERHUB_TOKEN }}
3235
- name: Build and push
33-
uses: docker/build-push-action@v4
36+
uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4
3437
with:
3538
context: .
3639
push: true

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# github action to run commit-msg hook on pull request commits and push commits to master branch
22
name: Pre Commit Hook
33
on: [pull_request]
4+
permissions:
5+
contents: read
6+
47
jobs:
58
commit-msg-hook:
69
runs-on: ubuntu-latest
710
steps:
8-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
912
- name: Run commit-msg hook
1013
run: |
1114
pip install pre-commit==2.21.0

.github/workflows/semgrep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
image: returntocorp/semgrep:1.166.0
2222
if: (github.actor != 'dependabot[bot]')
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2525
- run: semgrep --error --config "p/cwe-top-25" --config "p/owasp-top-ten" --config "p/r2c-security-audit"

.github/workflows/unit-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
name: Unit Tests and Lint
22
on: [push]
3+
permissions:
4+
contents: read
5+
36
jobs:
47
build:
58
runs-on: ubuntu-latest
69
strategy:
710
matrix:
811
python-version: ['3.9', '3.10', '3.11']
912
steps:
10-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
1114
- name: Set up Python ${{ matrix.python-version }}
12-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
1316
with:
1417
python-version: ${{ matrix.python-version }}
1518
- name: Install dependencies

0 commit comments

Comments
 (0)