Skip to content

Commit c0f0818

Browse files
committed
Setup scorecard workflow
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent fa737f8 commit c0f0818

File tree

6 files changed

+62
-18
lines changed

6 files changed

+62
-18
lines changed

.github/actions/retest-action/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.20
1+
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
22

33
RUN apk add --no-cache curl jq
44

.github/workflows/commands.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1313

1414
- name: Re-Test Action
1515
uses: ./.github/actions/retest-action

.github/workflows/release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
goarch: [amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x]
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1818

1919
- name: Install Go
20-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
2121
with:
2222
go-version-file: go.mod
2323

@@ -50,7 +50,7 @@ jobs:
5050
run: sha512sum cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha512
5151

5252
- name: Upload binaries to release
53-
uses: svenstaro/upload-release-action@v2
53+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
5454
with:
5555
repo_token: ${{ secrets.GITHUB_TOKEN }}
5656
file: ./dist/*
@@ -69,10 +69,10 @@ jobs:
6969
run: sudo apt-get install dos2unix
7070

7171
- name: Checkout code
72-
uses: actions/checkout@v4
72+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7373

7474
- name: Install Go
75-
uses: actions/setup-go@v5
75+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
7676
with:
7777
go-version-file: go.mod
7878

@@ -105,7 +105,7 @@ jobs:
105105
run: sha512sum cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha512
106106

107107
- name: Upload binaries to release
108-
uses: svenstaro/upload-release-action@v2
108+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
109109
with:
110110
repo_token: ${{ secrets.GITHUB_TOKEN }}
111111
file: ./dist/*

.github/workflows/scorecard.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Scorecard supply-chain security
2+
on:
3+
branch_protection_rule:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: 29 15 * * 0
9+
permissions: read-all
10+
jobs:
11+
analysis:
12+
name: Scorecard analysis
13+
permissions:
14+
id-token: write
15+
security-events: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
20+
with:
21+
persist-credentials: false
22+
23+
- name: Run analysis
24+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
25+
with:
26+
results_file: results.sarif
27+
results_format: sarif
28+
publish_results: true
29+
30+
- name: Upload artifact
31+
uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20
32+
with:
33+
name: SARIF file
34+
path: results.sarif
35+
retention-days: 5
36+
37+
- name: Upload to code-scanning
38+
uses: github/codeql-action/upload-sarif@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4
39+
with:
40+
sarif_file: results.sarif

.github/workflows/test.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,21 @@ env:
99

1010
jobs:
1111
lint:
12+
permissions:
13+
contents: read # for actions/checkout to fetch code
14+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1215
name: Lint
1316
runs-on: ubuntu-latest
1417
steps:
15-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1619
- name: setup go
17-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
1821
with:
1922
go-version-file: go.mod
20-
- uses: ibiqlik/action-yamllint@v3
23+
- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
2124
with:
2225
format: auto
23-
- uses: golangci/golangci-lint-action@v6
26+
- uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
2427
with:
2528
version: v1.61.0
2629
args: -v
@@ -43,9 +46,9 @@ jobs:
4346
needs: lint
4447
runs-on: ubuntu-latest
4548
steps:
46-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4750
- name: setup go
48-
uses: actions/setup-go@v5
51+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
4952
with:
5053
go-version-file: go.mod
5154
- name: Build on all supported architectures
@@ -67,9 +70,9 @@ jobs:
6770
sudo apt-get install linux-modules-extra-$(uname -r)
6871
- name: Install nftables
6972
run: sudo apt-get install nftables
70-
- uses: actions/checkout@v4
73+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7174
- name: setup go
72-
uses: actions/setup-go@v5
75+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
7376
with:
7477
go-version-file: go.mod
7578
- name: Set up Go for root
@@ -98,9 +101,9 @@ jobs:
98101
needs: build
99102
runs-on: windows-latest
100103
steps:
101-
- uses: actions/checkout@v4
104+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
102105
- name: setup go
103-
uses: actions/setup-go@v5
106+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
104107
with:
105108
go-version-file: go.mod
106109
- name: test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![test](https://github.com/containernetworking/plugins/actions/workflows/test.yaml/badge.svg)](https://github.com/containernetworking/plugins/actions/workflows/test.yaml?query=branch%3Amaster)
2+
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/containernetworking/plugins/badge)](https://securityscorecards.dev/viewer/?uri=github.com/containernetworking/plugins)
23

34
# Plugins
45
Some CNI network plugins, maintained by the containernetworking team. For more information, see the [CNI website](https://www.cni.dev).

0 commit comments

Comments
 (0)