Repository navigation
125 lines (106 loc) · 4.97 KB
/
Copy pathfuzz.yml
File metadata and controls
125 lines (106 loc) · 4.97 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
name: Fuzz
# Scheduled coverage-guided fuzzing of the .pqfe parsers. The corpus is cached between runs so
# coverage accumulates over time. A crash fails the job and uploads the reproducing input.
on:
schedule:
- cron: '17 4 * * *' # nightly, 04:17 UTC
workflow_dispatch:
inputs:
duration_seconds:
description: 'Fuzz duration per target (seconds)'
default: '300'
permissions:
contents: read
concurrency:
group: fuzz
cancel-in-progress: false
jobs:
rust-cargo-fuzz:
name: Rust parser (cargo-fuzz)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust nightly + cargo-fuzz
run: |
rustup toolchain install nightly --profile minimal
cargo install cargo-fuzz --locked
- name: Restore fuzz corpus
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: samples/pqfe-wasm/fuzz/corpus
key: cargo-fuzz-corpus-${{ github.run_id }}
restore-keys: cargo-fuzz-corpus-
- name: Seed the corpus with the known-answer vectors
working-directory: samples/pqfe-wasm
# Committed seeds (fuzz/seed-corpus) are valid containers; the working
# corpus (fuzz/corpus, cached above) is gitignored. -n keeps any
# coverage-accumulated inputs restored from cache.
run: |
mkdir -p fuzz/corpus/decrypt fuzz/corpus/decrypt_hybrid
cp -n fuzz/seed-corpus/*.pqfe fuzz/corpus/decrypt/ 2>/dev/null || true
cp -n fuzz/seed-corpus/*.pqfe fuzz/corpus/decrypt_hybrid/ 2>/dev/null || true
- name: Fuzz the decrypt parser
working-directory: samples/pqfe-wasm
run: |
DURATION="${{ github.event.inputs.duration_seconds || '300' }}"
cargo +nightly fuzz run decrypt -- -max_total_time="$DURATION" -rss_limit_mb=4096 -timeout=20
- name: Fuzz the hybrid decrypt parser
working-directory: samples/pqfe-wasm
# The recipient-block parsers (KeySource 3/4) are unreachable from the passphrase
# target; this one drives decrypt_bytes_hybrid with the pinned conformance key.
run: |
DURATION="${{ github.event.inputs.duration_seconds || '300' }}"
cargo +nightly fuzz run decrypt_hybrid -- -max_total_time="$DURATION" -rss_limit_mb=4096 -timeout=20
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cargo-fuzz-crashes
path: samples/pqfe-wasm/fuzz/artifacts
dotnet-sharpfuzz:
name: .NET parser (SharpFuzz)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Install clang + SharpFuzz CLI
run: |
sudo apt-get update && sudo apt-get install -y clang
dotnet tool install -g SharpFuzz.CommandLine
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
- name: Build the libFuzzer driver
run: |
curl -sSL https://raw.githubusercontent.com/Metalnem/libfuzzer-dotnet/master/libfuzzer-dotnet.cc -o libfuzzer-dotnet.cc
clang -g -O2 -fsanitize=fuzzer libfuzzer-dotnet.cc -o libfuzzer-dotnet
- name: Publish & instrument the harness
run: |
dotnet publish fuzz/PostQuantum.FileEncryption.Fuzz/PostQuantum.FileEncryption.Fuzz.csproj -c Release -o fuzzpub
sharpfuzz fuzzpub/PostQuantum.FileEncryption.dll
- name: Restore corpus
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: dotnet-corpus
key: sharpfuzz-corpus-${{ github.run_id }}
restore-keys: sharpfuzz-corpus-
- name: Fuzz the .NET decrypt parser
run: |
DURATION="${{ github.event.inputs.duration_seconds || '300' }}"
mkdir -p dotnet-corpus
# Seed with the committed known-answer vectors (valid containers +
# a PQKF key file); -n preserves cache-restored, coverage-accumulated inputs.
cp -n fuzz/PostQuantum.FileEncryption.Fuzz/seed-corpus/*.pqfe fuzz/PostQuantum.FileEncryption.Fuzz/seed-corpus/*.pqkf dotnet-corpus/ 2>/dev/null || true
./libfuzzer-dotnet --target_path=dotnet --target_arg="$PWD/fuzzpub/PostQuantum.FileEncryption.Fuzz.dll" \
dotnet-corpus -max_total_time="$DURATION" -rss_limit_mb=4096 -timeout=20
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sharpfuzz-crashes
# libFuzzer writes crash-*, timeout-*, and oom-* reproducers to the working
# directory — upload all three shapes, not just crashes.
path: |
crash-*
timeout-*
oom-*