Repository navigation
104 lines (93 loc) · 3.13 KB
/
Copy pathcodeql.yml
File metadata and controls
104 lines (93 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Pinned first-party and CodeQL actions (bump tag and SHA together when upgrading):
# actions/checkout@v7.0.1 3d3c42e5aac5ba805825da76410c181273ba90b1
# actions/setup-go@v7.0.0 b7ad1dad31e06c5925ef5d2fc7ad053ef454303e
# github/codeql-action/init@v4.38.0 b96794f015dfd88f77b49b1c93e0fa7110f94c63
# github/codeql-action/analyze@v4.38.0 b96794f015dfd88f77b49b1c93e0fa7110f94c63
#
name: CodeQL
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "20 16 * * 6"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# harden-runner egress allowlist (block mode).
HR_ENDPOINTS: >-
github.com:443
api.github.com:443
codeload.github.com:443
release-assets.githubusercontent.com:443
objects.githubusercontent.com:443
*.actions.githubusercontent.com:443
*.blob.core.windows.net:443
*.githubapp.com:443
prod.app-api.stepsecurity.io:443
agent.api.stepsecurity.io:443
go.dev:443
dl.google.com:443
storage.googleapis.com:443
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write # uploads SARIF results to code scanning
packages: read # lets CodeQL resolve package dependencies during analysis
actions: read # run/job metadata for harden-runner
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: manual
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
- language: actions
build-mode: none
env:
CI_GO_VERSION: "1.27.2"
GOFLAGS: -mod=vendor
GOPROXY: "off"
GOTOOLCHAIN: local
steps:
- name: Harden runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
allowed-endpoints: ${{ env.HR_ENDPOINTS }}
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
if: matrix.language == 'go'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.CI_GO_VERSION }}
check-latest: false
cache: true
cache-dependency-path: go.sum
- name: Initialize CodeQL
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Build Go (main module, vendor)
if: matrix.language == 'go'
run: go build -mod=vendor ./...
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
category: "/language:${{ matrix.language }}"