Testing — Property Tests For Untrusted Input
RULES.md
New or changed code that sanitizes, validates, parses or saves untrusted or bulk input (HTML/URL sanitizers, path and name validators, importers, `saveOutline`-style bulk writes) ships with a fast-check property test next to its example tests. Follow the HAX fuzz convention (<https://github.com/haxtheweb/issues/issues/3272>): read parameters through the repo's `fuzzConfig()` helper (`test/_helpers/fuzz-config.cjs` in `create` and `haxcms-nodejs`, `scripts/test-setup/fuzz-config.mjs` in `webcomponents`) with a fixed `defaultSeed`, never a bare `{ numRuns }` that draws a new random seed on every CI run; name the file `*-fuzz.test.js` so `test:fuzz` hunt mode picks it up (`.js`, not `.cjs`, where the repo allows it, because the OpenSSF Scorecard Fuzzing check only scans `.js`/`.jsx`); and when a hunt finds a failure, fix it and pin the shrunk counterexample as a fast-check `examples` entry or a plain test so the default run guards it. Replay a reported failure with `HAX_FUZZ_SEED=<seed> HAX_FUZZ_PATH=<path>`. Properties state what must always hold ("never throws", "never lets a `javascript:` URL through", "output equals the old implementation"), not one expected output. In PRAW RULES.md (scope: global). Enforced by Fuzz hunt, fuzz-nightly, nightly.
Connects to
- Build & Development Workflow includes this
- Fuzz hunt enforces this
- fuzz-nightly, nightly enforces this
- Serves Sustainable
- Applies to HAX CLI
- Applies to HAXcms Node.js
- Applies to Web components