-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (115 loc) · 4.23 KB
/
Copy pathfuzz.yml
File metadata and controls
127 lines (115 loc) · 4.23 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
name: Fuzz Testing
on:
schedule:
# Weekly on Sundays at 03:00 UTC
- cron: "0 3 * * 0"
workflow_dispatch:
inputs:
duration:
description: "Fuzz duration per target (e.g. 30s, 1m, 5m)"
required: false
default: "30s"
target:
description: "Specific target to fuzz (all runs all targets)"
required: false
default: "all"
type: choice
options:
- all
- FuzzPathParser
- FuzzRewriteEngine
- FuzzFastCGIRecordParser
- FuzzFastCGIParams
- FuzzCGIResponseHeaders
- FuzzHtaccessTranslator
- FuzzByteSizeParser
- FuzzDurationParser
permissions:
contents: read
env:
GO_VERSION: "1.25"
jobs:
fuzz:
name: "Fuzz ${{ matrix.label }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: "filesystem — PathParser"
target: FuzzPathParser
pkg: ./internal/filesystem/...
- label: "filesystem — PathResolver"
target: FuzzPathResolverInputs
pkg: ./internal/filesystem/...
- label: "router — RewriteEngine"
target: FuzzRewriteEngine
pkg: ./internal/router/...
- label: "fastcgi — RecordParser"
target: FuzzFastCGIRecordParser
pkg: ./internal/php/fastcgi/...
- label: "fastcgi — Params"
target: FuzzFastCGIParams
pkg: ./internal/php/fastcgi/...
- label: "cgi — ResponseHeaders"
target: FuzzCGIResponseHeaders
pkg: ./internal/php/cgi/...
- label: "diagnostics — HtaccessTranslator"
target: FuzzHtaccessTranslator
pkg: ./internal/diagnostics/...
- label: "policy — ByteSizeParser"
target: FuzzByteSizeParser
pkg: ./internal/policy/...
- label: "policy — DurationParser"
target: FuzzDurationParser
pkg: ./internal/policy/...
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run fuzz target
run: |
DURATION="${{ github.event.inputs.duration || '30s' }}"
TARGET="${{ github.event.inputs.target || 'all' }}"
if [ "$TARGET" = "all" ] || [ "$TARGET" = "${{ matrix.target }}" ]; then
echo "Fuzzing ${{ matrix.target }} for ${DURATION}..."
go test -fuzz=${{ matrix.target }} -fuzztime=${DURATION} ${{ matrix.pkg }}
else
echo "Skipping ${{ matrix.target }} (target filter: ${TARGET})"
fi
- name: Report result
if: always()
run: |
echo "Fuzz target: ${{ matrix.target }}"
echo "Duration: ${{ github.event.inputs.duration || '30s' }}"
echo "Status: ${{ job.status }}"
fuzz-regression:
name: Fuzz Regression Seed Corpus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run all fuzz targets as tests (regression only, no -fuzz flag)
run: |
# Run without -fuzz flag to validate existing seed corpus
go test -run='^$' -count=0 ./internal/filesystem/...
go test -run='^$' -count=0 ./internal/php/fastcgi/...
go test -run='^$' -count=0 ./internal/php/cgi/...
go test -run='^$' -count=0 ./internal/diagnostics/...
go test -run='^$' -count=0 ./internal/policy/...
- name: Run fuzz smoke (1s each) to verify targets compile
run: |
for pkg_target in \
"./internal/filesystem/..." "FuzzPathParser" \
"./internal/php/fastcgi/..." "FuzzFastCGIRecordParser" \
"./internal/php/cgi/..." "FuzzCGIResponseHeaders" \
"./internal/diagnostics/..." "FuzzHtaccessTranslator" \
"./internal/policy/..." "FuzzByteSizeParser"; do
PKG=$(echo "$pkg_target" | awk '{print $1}')
TARGET=$(echo "$pkg_target" | awk '{print $2}')
echo "--- Fuzzing ${TARGET} in ${PKG} for 1s ---"
go test -fuzz=${TARGET} -fuzztime=1s ${PKG} || true
done