Skip to content

Commit a072888

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

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,12 +14,12 @@ jobs:
1414
goarch: [amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x]
1515
steps:
1616
- name: Install Go
17-
uses: actions/setup-go@v5
17+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
1818
with:
1919
go-version: 1.22
2020

2121
- name: Checkout code
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2323

2424
- name: Build
2525
env:
@@ -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,12 +69,12 @@ jobs:
6969
run: sudo apt-get install dos2unix
7070

7171
- name: Install Go
72-
uses: actions/setup-go@v5
72+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
7373
with:
7474
go-version: 1.21
7575

7676
- name: Checkout code
77-
uses: actions/checkout@v4
77+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7878

7979
- name: Build
8080
env:
@@ -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
@@ -11,18 +11,21 @@ env:
1111

1212
jobs:
1313
lint:
14+
permissions:
15+
contents: read # for actions/checkout to fetch code
16+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1417
name: Lint
1518
runs-on: ubuntu-latest
1619
steps:
17-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1821
- name: setup go
19-
uses: actions/setup-go@v5
22+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
2023
with:
2124
go-version: ${{ env.GO_VERSION }}
22-
- uses: ibiqlik/action-yamllint@v3
25+
- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
2326
with:
2427
format: auto
25-
- uses: golangci/golangci-lint-action@v6
28+
- uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
2629
with:
2730
version: v1.55.2
2831
args: -v
@@ -46,9 +49,9 @@ jobs:
4649
needs: lint
4750
runs-on: ubuntu-latest
4851
steps:
49-
- uses: actions/checkout@v4
52+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5053
- name: setup go
51-
uses: actions/setup-go@v5
54+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
5255
with:
5356
go-version: ${{ env.GO_VERSION }}
5457
- name: Build on all supported architectures
@@ -70,9 +73,9 @@ jobs:
7073
sudo apt-get install linux-modules-extra-$(uname -r)
7174
- name: Install nftables
7275
run: sudo apt-get install nftables
73-
- uses: actions/checkout@v4
76+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7477
- name: setup go
75-
uses: actions/setup-go@v5
78+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
7679
with:
7780
go-version: ${{ env.GO_VERSION }}
7881
- name: Set up Go for root
@@ -101,9 +104,9 @@ jobs:
101104
needs: build
102105
runs-on: windows-latest
103106
steps:
104-
- uses: actions/checkout@v4
107+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
105108
- name: setup go
106-
uses: actions/setup-go@v5
109+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
107110
with:
108111
go-version: ${{ env.GO_VERSION }}
109112
- 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)