-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (79 loc) · 2.96 KB
/
Copy pathcodeql.yml
File metadata and controls
90 lines (79 loc) · 2.96 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
name: "CodeQL"
# Static analysis for the Rust core using GitHub CodeQL.
#
# Scanned languages: Rust.
# Scanned paths: `rust/**`, excluding `rust/fuzz/**` (mirrored in both the
# `on.*.paths` filters below and `.github/codeql/codeql-config.yml`).
#
# This workflow is informational and is NOT a required status check for
# merging into `main`. Findings should be triaged in the Security tab.
on:
push:
branches: [ "main" ]
paths:
- 'rust/**'
- '!rust/fuzz/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
pull_request:
branches: [ "main" ]
paths:
- 'rust/**'
- '!rust/fuzz/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
schedule:
# Weekly on Sunday at 03:00 UTC
- cron: '0 3 * * 0'
workflow_dispatch:
# Workflow-wide GITHUB_TOKEN baseline: `contents: read`.
permissions:
contents: read
# Cancel superseded runs on PR branches.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
analyze:
name: Analyze (Rust)
runs-on: ubuntu-latest
permissions:
# Job-level permissions replace the workflow baseline wholesale, so
# `contents: read` must be restated here for `actions/checkout`.
contents: read
# Required to publish SARIF results to the Security tab.
security-events: write
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
# `dtolnay/rust-toolchain` only auto-detects rust-toolchain.toml at the
# repo root. Ours lives in `rust/`, so we extract the channel explicitly
# to keep `rust/rust-toolchain.toml` the single source of truth.
- name: Read pinned Rust channel
id: toolchain
run: |
channel=$(grep '^channel' rust/rust-toolchain.toml | sed 's/.*"\(.*\)"/\1/')
echo "channel=$channel" >> "$GITHUB_OUTPUT"
# Install the exact toolchain used by ci.yml so CodeQL IR extraction
# matches the production build.
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: ${{ steps.toolchain.outputs.channel }}
# Reuse the same cache logic as `ci.yml` to minimize cold-build time.
- name: Cache cargo registry + crate target
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: rust
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with:
languages: rust
config-file: .github/codeql/codeql-config.yml
build-mode: none
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with:
category: "/language:rust"