Skip to content

Commit 52edb2d

Browse files
committed
Run fuzzer in CI.
1 parent 8416fe9 commit 52edb2d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.github/workflows/build.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,19 @@ jobs:
5858
path: './pages/dist/'
5959
- name: Deploy to GitHub Pages
6060
id: deployment
61-
uses: actions/deploy-pages@v2
61+
uses: actions/deploy-pages@v2
62+
fuzz:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v2
66+
- uses: actions-rs/toolchain@v1
67+
with:
68+
toolchain: nightly
69+
override: true
70+
- name: Install cargo-fuzz
71+
uses: baptiste0928/cargo-install@v3
72+
with:
73+
crate: cargo-fuzz
74+
locked: false
75+
- name: Fuzz
76+
run: RUST_BACKTRACE=1 cargo fuzz run fuzz -- -max_total_time=900

fuzz/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ libfuzzer-sys = "0.4"
1313

1414
[dependencies.rustrict]
1515
path = ".."
16-
features = ["width"]
16+
features = ["pii", "width"]
1717

1818
# Prevent this from interfering with workspaces
1919
[workspace]

fuzz/fuzz_targets/fuzz.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fuzz_target!(|data: &[u8]| {
1010
if let Ok(text) = std::str::from_utf8(input) {
1111
let _ = rustrict::width_str(text);
1212
let _ = rustrict::trim_to_width(text, 10);
13+
let _ = rustrict::censor_and_analyze_pii(text);
1314

1415
let (_censored, _analysis) = Censor::from_str(text)
1516
.with_ignore_self_censoring(flag(flags, 0))

0 commit comments

Comments
 (0)