-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (146 loc) Β· 4.78 KB
/
codeql.yml
File metadata and controls
160 lines (146 loc) Β· 4.78 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: CodeQL
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "34 7 * * 4"
concurrency:
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v3.0.2
id: filter
with:
filters: |
rust:
- 'src-tauri/**'
- '**/*.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
analyze-js:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix:
language: [javascript-typescript, actions]
steps:
- uses: actions/checkout@v6
- uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: none
queries: security-extended
config: |
paths-ignore:
- 'dist/**'
- 'node_modules/**'
- 'src-tauri/target/**'
- 'src-tauri/**'
- 'bun.lock'
- '**/*.config.ts'
- '**/*.config.js'
- '**/*.config.mjs'
- '**/*.config.cjs'
- uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
analyze-rust:
name: Analyze (rust)
needs: changes
if: github.event_name != 'pull_request' || needs.changes.outputs.rust == 'true'
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
security-events: write
packages: read
actions: read
contents: read
steps:
- uses: actions/checkout@v6
# CodeQL needs a real build to resolve call targets / types through
# proc macros (#[tauri::command], sqlx::query!, etc.) and external
# crate symbols. Without it, analysis quality drops below the 50 %
# call-target threshold and GitHub flags the run as low-quality.
- name: Cache APT packages
uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0
with:
packages: >-
libgtk-3-dev libwebkit2gtk-4.1-dev libsoup-3.0-dev
libayatana-appindicator3-dev librsvg2-dev libasound2-dev
libssl-dev pkg-config
version: v1
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: src-tauri
# Pre-fetch the full dep graph so CodeQL's internal `cargo metadata`
# invocations resolve every transitive crate without hitting the
# registry mid-extraction. The Rust extractor is preview-only and
# rejects build-mode=manual, so this is the main lever we have to
# push call-target resolution above the 50 % threshold.
- name: cargo fetch
run: cargo fetch --manifest-path src-tauri/Cargo.toml --locked
- uses: github/codeql-action/init@v4
with:
languages: rust
build-mode: none
queries: security-extended
config: |
paths-ignore:
# Vendored glib 0.18.5 with RUSTSEC-2024-0429 backported
# (see src-tauri/vendor/glib-0.18.5/PATCHES.md). We don't
# review third-party upstream through CodeQL, and Rust
# unsafe blocks raise large amounts of false positives.
- 'src-tauri/vendor/**'
- 'src-tauri/target/**'
- uses: github/codeql-action/analyze@v4
with:
category: "/language:rust"
analyze-rust-skip:
name: Analyze (rust)
needs: changes
if: github.event_name == 'pull_request' && needs.changes.outputs.rust != 'true'
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- name: Create empty SARIF
run: |
cat > empty.sarif <<'EOF'
{
"version": "2.1.0",
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
"runs": [
{
"tool": { "driver": { "name": "CodeQL", "rules": [] } },
"results": []
}
]
}
EOF
- uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: empty.sarif
category: "/language:rust"