-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (120 loc) · 5.32 KB
/
Copy pathfuzz.yml
File metadata and controls
123 lines (120 loc) · 5.32 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
name: Fuzzing
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
schedule:
- cron: '50 9 * * *' # Run fuzz tests daily at 09:50 UTC
permissions: {}
jobs:
fuzz:
runs-on: ubuntu-latest
permissions:
contents: read
env:
# 500k runs for releases, 50k for regular CI
FUZZ_RUNS: ${{ startsWith(github.ref, 'refs/tags/') && '500000' || '50000' }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
if: matrix.ext-pqcrypto
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # nightly
with:
toolchain: nightly
components: rustfmt
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: '8.4'
- name: Build and install ext-pqcrypto
shell: bash
run: |
git clone --depth 1 https://github.com/paragonie/ext-pqcrypto.git "$RUNNER_TEMP/ext-pqcrypto"
cd "$RUNNER_TEMP/ext-pqcrypto"
cargo build --release
EXT_DIR="$(php -r "echo ini_get('extension_dir');")"
if [[ "$RUNNER_OS" == "Windows" ]]; then
cp target/release/pqcrypto.dll "$EXT_DIR/pqcrypto.dll"
else
sudo cp target/release/libpqcrypto.so "$EXT_DIR/pqcrypto.so"
fi
echo "extension=pqcrypto" >> "$(php -r "echo php_ini_loaded_file();")"
php -m | grep pqcrypto
- name: Setup PHP-Fuzzer
run: composer global require --dev nikic/php-fuzzer
- name: Install dependencies
run: composer install --optimize-autoloader
- name: Run FuzzProtocol
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzProtocol.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzProtocol-}"; done
- name: Run FuzzRequestHandlers
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzRequestHandlers.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzRequestHandlers-}"; done
- name: Run FuzzActivityStream
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzActivityStream.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzActivityStream-}"; done
- name: Run FuzzJsonParsing
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzJsonParsing.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzJsonParsing-}"; done
- name: Run FuzzMath
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzMath.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzMath-}"; done
- name: Run FuzzNetworkTrait
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzNetworkTrait.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzNetworkTrait-}"; done
- name: Run FuzzParams
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzParams.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzParams-}"; done
- name: Run FuzzRateLimit
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzRateLimit.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzRateLimit-}"; done
- name: Run FuzzBase64
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzBase64.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzBase64-}"; done
- name: Run FuzzMerkleLeaf
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzMerkleLeaf.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzMerkleLeaf-}"; done
- name: Run FuzzMerkleTree
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzMerkleTree.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzMerkleTree-}"; done
- name: Run FuzzTOTP
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/FuzzTOTP.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-FuzzTOTP-}"; done
- name: Run DifferentialFuzzProtocolWitness
run: |
php-fuzzer fuzz --timeout 10 --max-runs "$FUZZ_RUNS" fuzzing/DifferentialFuzzProtocolWitness.php
shopt -s nullglob; for f in crash-*.txt; do mv "$f" "${f/crash-/fuzzed-DifferentialFuzzProtocolWitness-}"; done
- name: Check for crashes
if: always()
run: |
if compgen -G "fuzzed-*.txt" > /dev/null; then
echo "::error::Fuzzing found crashes"
echo "=== Crash files found ==="
for f in fuzzed-*.txt; do
echo "--- $f ---"
cat "$f"
echo ""
echo "Hex dump:"
xxd "$f"
echo ""
done
exit 1
fi
echo "No crashes detected"