Skip to content

Commit 8502e3e

Browse files
committed
Add daily fuzz testing with ASAN and UBSAN
Two fuzz harnesses targeting the main attack surface: - fuzz_request: HTTP request parsing and header rewriting - fuzz_config: configuration file parsing Runs daily via cron and on manual dispatch. Each target runs for 10 minutes with AddressSanitizer and UndefinedBehaviorSanitizer. Crash artifacts are uploaded on failure.
1 parent 2bf83cc commit 8502e3e

346 files changed

Lines changed: 1053 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/fuzz.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Fuzz
2+
3+
on:
4+
schedule:
5+
- cron: "0 4 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
fuzz:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
target: [fuzz_request, fuzz_config]
14+
name: ${{ matrix.target }}
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Install clang
22+
run: |
23+
set -euo pipefail
24+
sudo apt-get update
25+
sudo apt-get install -y clang
26+
27+
- name: Build fuzzer
28+
run: |
29+
clang -g -O1 -std=c99 \
30+
-fsanitize=fuzzer,address,undefined \
31+
-fno-omit-frame-pointer \
32+
\
33+
-o ${{ matrix.target }} \
34+
fuzz/${{ matrix.target }}.c
35+
36+
- name: Run fuzzer
37+
env:
38+
ASAN_OPTIONS: halt_on_error=1:detect_leaks=1
39+
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
40+
run: |
41+
set -euo pipefail
42+
corpus="fuzz/corpus_$(echo "${{ matrix.target }}" | sed 's/^fuzz_//')"
43+
mkdir -p "$corpus"
44+
./${{ matrix.target }} "$corpus" \
45+
-max_total_time=600 \
46+
-max_len=8192 \
47+
-print_final_stats=1
48+
49+
- name: Upload crash artifacts
50+
if: failure()
51+
uses: actions/upload-artifact@v7
52+
with:
53+
name: ${{ matrix.target }}-crashes
54+
path: |
55+
crash-*
56+
leak-*
57+
timeout-*
58+
if-no-files-found: ignore
59+
60+
- name: Upload corpus
61+
if: always()
62+
uses: actions/upload-artifact@v7
63+
with:
64+
name: ${{ matrix.target }}-corpus
65+
path: fuzz/corpus_*/
66+
if-no-files-found: ignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
thinproxy
22
*.o
3+
fuzz_request
4+
fuzz_config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
idle_timeout 0
2 Bytes
Binary file not shown.

fuzz/corpus_config/01042fec7e5cdeb8052b5d1f177d5e14245f6568

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
listen n no
2+
verbose 1
3+
port 80to
4+
verbose 1
5+
port 8ten nodeny_private ye
6+
verbose 1
7+
s
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
deny_private yes
2+
connect_port ����

fuzz/corpus_config/01d94a6f21b47b294553d412889a784d3553cf6f

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
allow 127.8.1.0/24
2+
allow .0/8 1�
14 Bytes
Binary file not shown.
354 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)