Skip to content

Commit 8e01ced

Browse files
committed
[CP-Sec] Remediate OpenSSF flagged issues
* Add top-level permissions to CodeQL workflow * Add top-level permissions to CI workflow * Pin docker image by hash * Pin github actions by hash
1 parent 0b8276a commit 8e01ced

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Continuous Integration
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
env:
69
REGISTRY: ghcr.io
710
IMAGE_NAME: ${{ github.repository }}
@@ -12,10 +15,10 @@ jobs:
1215
runs-on: ubuntu-latest
1316

1417
steps:
15-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
1619

1720
- name: clang-format
18-
uses: jidicula/[email protected]
21+
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0
1922
with:
2023
clang-format-version: '17'
2124
check-path: 'src'
@@ -30,10 +33,10 @@ jobs:
3033

3134
steps:
3235
- name: Checkout
33-
uses: actions/checkout@v4
36+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
3437

3538
- name: Path filter
36-
uses: dorny/paths-filter@v3
39+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
3740
id: changes
3841
with:
3942
filters: |
@@ -42,19 +45,19 @@ jobs:
4245
4346
- name: Set up Docker Buildx
4447
if: steps.changes.outputs.container == 'true'
45-
uses: docker/setup-buildx-action@v3
48+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
4649

4750
- name: Log in to the Container registry
4851
if: steps.changes.outputs.container == 'true'
49-
uses: docker/login-action@v3
52+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
5053
with:
5154
registry: ${{ env.REGISTRY }}
5255
username: ${{ github.actor }}
5356
password: ${{ secrets.GITHUB_TOKEN }}
5457

5558
- name: Extract metadata
5659
id: meta
57-
uses: docker/metadata-action@v5
60+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
5861
with:
5962
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6063
tags: |
@@ -65,7 +68,7 @@ jobs:
6568
6669
- name: Build and push
6770
if: steps.changes.outputs.container == 'true'
68-
uses: docker/build-push-action@v5
71+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
6972
with:
7073
context: '{{defaultContext}}:ci'
7174
push: true
@@ -92,7 +95,7 @@ jobs:
9295
password: ${{ secrets.github_token }}
9396
steps:
9497
- name: Checkout
95-
uses: actions/checkout@v4
98+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
9699
with:
97100
submodules: "recursive"
98101

@@ -118,7 +121,7 @@ jobs:
118121

119122
steps:
120123
- name: Checkout
121-
uses: actions/checkout@v4
124+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
122125

123126
- name: Configure CMake (no graphics)
124127
run: >

.github/workflows/codeql.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
env:
2323
BUILD_TYPE: Release
2424

25+
permissions: {}
26+
2527
jobs:
2628
analyze:
2729
name: Analyze (${{ matrix.language }})
@@ -63,7 +65,7 @@ jobs:
6365

6466
steps:
6567
- name: Checkout repository
66-
uses: actions/checkout@v4
68+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
6769

6870
# Handle git 'dubious ownership/safe.directory' container warnings (reduces related CodeQL verbosity)
6971
- name: Add safe Git directory
@@ -72,7 +74,7 @@ jobs:
7274

7375
# Initializes the CodeQL tools for scanning.
7476
- name: Initialize CodeQL
75-
uses: github/codeql-action/init@v3
77+
uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
7678
with:
7779
languages: ${{ matrix.language }}
7880
build-mode: ${{ matrix.build-mode }}
@@ -107,6 +109,6 @@ jobs:
107109
run: cmake --build ${{github.workspace}}/build -- -k -j
108110

109111
- name: Perform CodeQL Analysis
110-
uses: github/codeql-action/analyze@v3
112+
uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
111113
with:
112114
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
4040
# format to the repository Actions tab.
4141
- name: "Upload artifact"
42-
uses: actions/upload-artifact@v4
42+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
4343
with:
4444
name: SARIF file
4545
path: results.sarif

ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04@sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15
22

33
# Get basic dependencies from Ubuntu repositories
44
RUN apt update && apt -y install wget gpg git cmake ninja-build \

0 commit comments

Comments
 (0)