Skip to content

Commit f7318ed

Browse files
committed
setup ossf scorecard and codql workflows
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 653e0fa commit f7318ed

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

.github/workflows/codeql.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '24 1 * * 5'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
analyze:
16+
name: Analyze
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 360
19+
permissions:
20+
# required for all workflows
21+
security-events: write
22+
23+
# only required for workflows in private repositories
24+
actions: read
25+
contents: read
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
language: [ 'go' ]
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
35+
36+
# Initializes the CodeQL tools for scanning.
37+
- name: Initialize CodeQL
38+
uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
39+
with:
40+
languages: ${{ matrix.language }}
41+
42+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
43+
# If this step fails, then you should remove it and run the build manually (see below)
44+
- name: Autobuild
45+
uses: github/codeql-action/autobuild@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
46+
47+
- name: Perform CodeQL Analysis
48+
uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
49+
with:
50+
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Scorecard supply-chain security
2+
3+
on:
4+
# For Branch-Protection check. Only the default branch is supported. See
5+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
6+
branch_protection_rule:
7+
# To guarantee Maintained check is occasionally updated. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
9+
schedule:
10+
- cron: '26 18 * * 2'
11+
push:
12+
branches: [ "main" ]
13+
14+
# Declare default permissions as read only.
15+
permissions: read-all
16+
17+
jobs:
18+
analysis:
19+
name: Scorecard analysis
20+
runs-on: ubuntu-latest
21+
permissions:
22+
# Needed to upload the results to code-scanning dashboard.
23+
security-events: write
24+
# Needed to publish results and get a badge (see publish_results below).
25+
id-token: write
26+
# Uncomment the permissions below if installing in a private repository.
27+
# contents: read
28+
# actions: read
29+
30+
steps:
31+
- name: "Checkout code"
32+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
33+
with:
34+
persist-credentials: false
35+
36+
- name: "Run analysis"
37+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
publish_results: true
42+
43+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
44+
# format to the repository Actions tab.
45+
- name: "Upload artifact"
46+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
47+
with:
48+
name: SARIF file
49+
path: results.sarif
50+
retention-days: 5
51+
52+
# Upload the results to GitHub's code scanning dashboard.
53+
- name: "Upload to code-scanning"
54+
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
55+
with:
56+
sarif_file: results.sarif

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Common
22
![circleci](https://circleci.com/gh/prometheus/common/tree/main.svg?style=shield)
3+
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/prometheus/common/badge)](https://securityscorecards.dev/viewer/?uri=github.com/prometheus/common)
4+
35

46
This repository contains Go libraries that are shared across Prometheus
57
components and libraries. They are considered internal to Prometheus, without

0 commit comments

Comments
 (0)