diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index b4b832ccd..29e3a7905 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,11 +1,19 @@ name: Fuzz # Coverage-guided fuzzing of the two parsers of zone bytes (docs/design/broker.md), weekly on a pinned nightly. +# A pull request that touches their code builds both targets without fuzzing them, so a new request +# variant the harness does not match fails there, not on the next weekly run. on: schedule: - cron: '0 4 * * 0' workflow_dispatch: + pull_request: + paths: + - 'compartments/kryptikd/src/**' + - 'compartments/kryptikd/fuzz/**' + - 'compositor/wlproxy/**' + - '.github/workflows/fuzz.yml' permissions: contents: read @@ -59,8 +67,14 @@ jobs: fi echo "$(find "$RUNNER_TEMP/corpus" -type f | wc -l) seeds" + - name: The target builds + if: github.event_name == 'pull_request' + working-directory: ${{ matrix.dir }} + run: cargo fuzz build --sanitizer none "$FUZZ_TARGET" + # Safe Rust throughout, so no sanitizer: panics, overflow checks and the harness's asserts are the oracle. - name: Twenty minutes of fuzzing + if: github.event_name != 'pull_request' working-directory: ${{ matrix.dir }} run: cargo fuzz run --sanitizer none "$FUZZ_TARGET" "$RUNNER_TEMP/corpus" -- -max_total_time=1200 -max_len="$MAX_LEN" -timeout=10 -print_final_stats=1 diff --git a/compartments/kryptikd/fuzz/broker_request.rs b/compartments/kryptikd/fuzz/broker_request.rs index 3012a5111..dfa6e5bfc 100644 --- a/compartments/kryptikd/fuzz/broker_request.rs +++ b/compartments/kryptikd/fuzz/broker_request.rs @@ -11,7 +11,7 @@ fuzz_target!(|data: &[u8]| { let Some(nl) = data.iter().position(|b| *b == b'\n') else { return }; let header = String::from_utf8_lossy(&data[..nl]); match parse_request(&header) { - Err(_) | Ok(Request::Version | Request::ClipboardGet | Request::UpdatePoll) => {} + Err(_) | Ok(Request::Version | Request::ClipboardGet | Request::UpdatePoll | Request::Stick) => {} Ok(Request::ClipboardSet { mime, len }) => assert!(MIME_TYPES.contains(&mime.as_str()) && len <= CLIPBOARD_MAX), Ok(Request::Transfer { dest, name }) => { assert!((1..=12).contains(&dest.len()));