Repository navigation
79 lines (76 loc) · 2.45 KB
/
Copy pathsecurity.yml
File metadata and controls
79 lines (76 loc) · 2.45 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
# SPDX-License-Identifier: MPL-2.0
# RSR-compliant security workflow with SHA-pinned actions
name: "Security"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: '42 20 * * 0'
permissions: read-all
jobs:
# Rust security audit using cargo-audit
rust-security:
name: Rust Security Audit
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
security-events: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo-audit
run: cargo audit --deny warnings
# Dependency review for PRs
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Dependency Review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v4.5.0
# Build verification
build:
name: Build Check
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
with:
# Keep in sync with rust-toolchain.toml. Pins the lint gate so a
# floating `stable` cannot reintroduce a fmt/clippy skew on main.
toolchain: "1.96.0"
components: clippy, rustfmt
- name: Cache cargo registry
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release
- name: Run tests
run: cargo test
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy -- -D warnings