Skip to content

Fuzzing ​

Coverage-guided fuzzing of the code that reads input an attacker can write: templates, uploaded archives, YAML from repositories and the editor, form patterns, egress rules and bundle paths. Each target is an Atheris harness in fuzz/ with an oracle, a property that must hold for every input, so the fuzzer finds wrong answers and not only crashes. It runs every night, not on pull requests: twelve minutes per target is too slow for every change. Pull requests replay the seed corpus instead, which takes seconds.

Targets ​

HarnessCodeInput it modelsOracle
sandbox_template_fuzzerBoundedSandboxedEnvironment (packages/core/templates/sandbox.py) with the platform's filtersA template or branch condition a flow author writesOnly template and ordinary evaluation errors escape; no printed value is more than a small multiple of MAX_TEMPLATE_VALUE_LENGTH; a private attribute's value never reaches the output
oci_archive_fuzzerread_layout (registry extension, services/oci_archive.py)An image archive uploaded for import, as raw bytes or as a generated OCI layout with true digests, then damagedOnly ArchiveFormatError escapes (the route's 400); an accepted archive's manifests match their digests and its blobs are present at their sizes
yaml_bounded_fuzzerload_bounded (apps/api/services/sync/_shared/yaml_safe.py)flow.yaml, a sync manifest or an import bundleOnly YamlLimitError and yaml.YAMLError escape; the result holds only plain types; alias bombs are refused in time
flow_yaml_fuzzerparse_flow_yaml (apps/api/services/flow_yaml_edit.py)Text edited in the flow editor's YAML tabOnly FlowYamlError escapes (the routes' issue list); a text that parses yields a save request
regex_safety_fuzzeris_safe_regex_pattern (apps/api/services/flow_interface/validation.py) and a port of the browser's work budget (fitsClientRegexBudget in apps/ui/src/lib/safeRegex.ts)A form field's regex rule and a typed valueA pattern the guard calls safe matches, in under a second with Python's backtracking re standing in for the browser's engine, every subject the budget lets the browser match: the typed value and values built to force backtracking
egress_rule_fuzzerparse_egress_rule, rule_covered_by, rule_matches_address (packages/core/egress.py)Step and flow egress allow rulesA rule's canonical spelling parses back to it; when a step rule is "covered" by the flow's rules, every dial it allows (sampled at the edges of its network and ports, for each protocol) is allowed by a flow rule too, so the admission gate cannot widen a flow's egress
path_safety_fuzzernormalize_relative_path, safe_join (apps/api/services/sync/_shared/path_safety.py)A path named by a repository or a bundleOnly UnsafePathError escapes; a normalized path has no .., . or empty segment, no leading /, backslash or NUL; a joined path stays inside the root

Every harness also fails on a hang (libFuzzer -timeout=10) and on memory growth past -rss_limit_mb=2048. The module docstring of each harness says the same in more detail.

How it runs ​

  • Nightly, .github/workflows/fuzz_nightly.yml: one job per target, each fuzzing for 12 minutes on a GitHub-hosted runner, then merging the corpus down to the inputs that add coverage and replaying it under coverage. The corpus is cached per target and saved only from a successful run on the default branch, so each night starts where the last good one stopped. Crash reproducers and the coverage report are uploaded as the run's artifacts. Run it by hand with Run workflow (workflow_dispatch).
  • Pull requests, the Lint & Test (Python) job in ci.yml: every seed in fuzz/seed_corpus.py goes once through its harness, as a regression test. A seed must never fail its oracle.
  • ClusterFuzzLite, .clusterfuzzlite/: builds the same harnesses into libFuzzer binaries, for ClusterFuzzLite or OSS-Fuzz. No workflow uses it yet.

Atheris is pinned in the fuzz dependency group in pyproject.toml, so a plain uv sync and the images never install it.

Running it locally ​

bash
uv sync --frozen --all-extras --group fuzz
task fuzz:replay                                         # the seeds, once (what CI runs)
task fuzz:run TARGET=egress_rule_fuzzer FUZZ_SECONDS=60  # fuzz one target for a minute
task fuzz:run                                            # every target, 60 s each
task fuzz:typecheck                                      # ty on fuzz/, strict

Atheris ships wheels for x86-64 Linux on Python 3.11 to 3.13. A harness also runs directly, taking libFuzzer's options:

bash
uv run python fuzz/path_safety_fuzzer.py build/fuzz-corpus/path_safety_fuzzer \
  -max_total_time=60 -timeout=10 -rss_limit_mb=2048

The corpus is in build/fuzz-corpus/<target>/, reproducers in build/fuzz-crashes/<target>/, and the coverage report in build/fuzz-coverage/html/.

Triaging a crash ​

  1. Download the fuzz-<target> artifact of the failed run. A crash-<sha1> file is an input that broke the oracle, timeout-<sha1> one that hung, oom-<sha1> one that used too much memory. The job log shows the traceback or the stack at the moment of the hang.
  2. The repository is public, and so are a run's artifacts. If the finding could be a security problem (a sandbox escape, an egress widening, a path that leaves its root), report it as SECURITY.md describes before anything else, and do not discuss it in a public issue.
  3. Reproduce it: run the harness on the file alone, uv run python fuzz/<target>.py path/to/crash-<sha1>, or put it in a directory and run uv run python fuzz/replay_corpus.py fuzz/<target>.py <directory> for a plain traceback.
  4. Decide whose bug it is. A broken oracle is a bug in the code under test, unless the harness asked for more than the code promises; then fix the harness and say why in its docstring.
  5. Fix the code, and add the reproducer, shrunk to a readable form, to the target's list in fuzz/seed_corpus.py. From then on every pull request replays it. Add a unit test as well when the behaviour deserves a name.

A timeout is worth reproducing without the fuzzer before believing it: Atheris instruments the code it covers, which makes it several times slower, so a harness instruments only the module it is about.