-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (111 loc) · 4.52 KB
/
Copy pathcodeql.yml
File metadata and controls
124 lines (111 loc) · 4.52 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
## ─────────────────────────────────────────────────────────────────────────────
## Culvert — CodeQL SAST
## ─────────────────────────────────────────────────────────────────────────────
## GitHub CodeQL performs deep semantic analysis of Go source code, catching
## injection flaws, unsafe deserialization, path traversal, improper access
## control, and other CWE-mapped vulnerabilities that simpler linters miss.
##
## Findings are surfaced in the GitHub Security tab as code scanning alerts.
## ─────────────────────────────────────────────────────────────────────────────
name: CodeQL
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
push:
branches: [main]
# Retirement step 4 (roadmap/CI-REDESIGN.md): semantic analysis on every
# PR is heavyweight; main-push + weekly full scans keep continuous
# coverage, and PR-time CodeQL still fires for the proxy-core/security
# surface (same globs as the Deep PR Gate's proxy_core+security filters).
pull_request:
branches: [main]
paths:
- "proxy.go"
- "socks5.go"
- "policy.go"
- "store.go"
- "upstream*.go"
- "connlimit.go"
- "main.go"
- "auth*.go"
- "ca.go"
- "tls.go"
- "session.go"
- "ocsp.go"
- "security*.go"
- "scanner.go"
- "clam.go"
- "yara_scan.go"
- "fileblock.go"
- "fileprofile.go"
- "threatfeed.go"
- "lockout.go"
- "totp.go"
- "identity.go"
- "enrollment.go"
- "controlplane.go"
- "ui_*.go"
- "update*.go"
- "backup*.go"
- "restore.go"
- "geoip.go"
- "events.go"
- "release_*.go"
- "internal/**"
- ".github/workflows/codeql.yml"
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: read
security-events: write
actions: read
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: "SAST · CodeQL"
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # upload SARIF to GitHub Security tab
actions: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/setup-go-cache
- name: Download dependencies
run: go mod download
# Initialise CodeQL tooling — must happen before the build.
- name: Initialise CodeQL
# MUST stay on the same revision as analyze/upload-sarif below: the
# CodeQL action refuses to run a database initialised by a different
# version ("Loaded a configuration file for version X, but running
# version Y") and reports it as a CONFIGURATION ERROR, which is a
# silent loss of SAST coverage rather than a finding. Dependabot
# updates these three as separate ecosystems, so a bump can land on
# one and not the others; codeql_action_pin_test.go pins them equal.
uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v3
with:
languages: go
# Use the extended security-and-quality query suite for maximum coverage.
queries: security-and-quality
# Build the binary so CodeQL can trace the compilation and understand
# data-flow across the whole codebase (not just individual files).
- name: Build for CodeQL tracing
run: CGO_ENABLED=0 go build -o /dev/null .
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v3
with:
category: codeql-go
# Separate upload step handles graceful failure for repos without
# GitHub Advanced Security; the analysis itself should block on findings.
upload: false
output: sarif-results
- name: Upload SARIF results
continue-on-error: true # skip gracefully if code scanning is not enabled
uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v3
with:
sarif_file: sarif-results/go.sarif
category: codeql-go