-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (125 loc) · 4.09 KB
/
fuzz.yml
File metadata and controls
147 lines (125 loc) · 4.09 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
name: Fuzz Testing
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
# Run weekly fuzz testing (Sunday at 2 AM UTC)
- cron: '0 2 * * 0'
workflow_dispatch:
inputs:
fuzz_duration:
description: 'Fuzz duration in seconds'
required: false
default: '60'
env:
CARGO_TERM_COLOR: always
jobs:
fuzz-pr:
name: Quick Fuzz (PR)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
target:
- fuzz_config_parser
- fuzz_version_parser
- fuzz_toml_input
- fuzz_tool_spec
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Run fuzz target (60 seconds)
run: |
cd fuzz
cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=60
continue-on-error: true
- name: Upload crash artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: fuzz-crashes-${{ matrix.target }}
path: fuzz/artifacts/
retention-days: 30
fuzz-scheduled:
name: Extended Fuzz (Scheduled)
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
target:
- fuzz_config_parser
- fuzz_version_parser
- fuzz_toml_input
- fuzz_tool_spec
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Download existing corpus
uses: actions/download-artifact@v4
with:
name: fuzz-corpus-${{ matrix.target }}
path: fuzz/corpus/${{ matrix.target }}
continue-on-error: true
- name: Run fuzz target (extended)
run: |
cd fuzz
DURATION=${{ github.event.inputs.fuzz_duration || '28800' }}
echo "Running fuzz target for ${DURATION} seconds..."
cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=${DURATION}
continue-on-error: true
- name: Upload corpus
uses: actions/upload-artifact@v4
with:
name: fuzz-corpus-${{ matrix.target }}
path: fuzz/corpus/${{ matrix.target }}
retention-days: 90
- name: Upload crash artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: fuzz-crashes-${{ matrix.target }}
path: fuzz/artifacts/
retention-days: 90
- name: Create issue on crash
if: failure()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const artifactPath = 'fuzz/artifacts/${{ matrix.target }}';
if (fs.existsSync(artifactPath)) {
const crashes = fs.readdirSync(artifactPath);
if (crashes.length > 0) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `[Fuzz] Crash found in ${{ matrix.target }}`,
body: `## Fuzz Testing Crash Report
**Target:** \`${{ matrix.target }}\`
**Workflow Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}
### Crashes Found
${crashes.map(c => `- \`${c}\``).join('\n')}
### Next Steps
1. Download the crash artifacts from the workflow run
2. Reproduce locally with \`cargo +nightly fuzz run ${{ matrix.target }} <crash_input>\`
3. Fix the issue and add a regression test
/label bug fuzz`,
labels: ['bug', 'fuzz']
});
}
}
continue-on-error: true