Skip to content

test(agent): fuzz every action validator nightly (part of #244) - #425

Merged
samuelmbabhazi merged 4 commits into
mainfrom
test/244-fuzzing
Nov 23, 2026
Merged

samuelmbabhazi merged 4 commits into
mainfrom
test/244-fuzzing

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Part of #244: the targets, the nightly run, and the fix to the first finding. The issue closes after the first nightly run comes back green: its acceptance is "all targets run nightly with no open finding".

What changed

New fuzz targets (agent/internal/actions/fuzz_test.go), for the validators the threat model lists that had none:

  • FuzzRouteValidation, the route builder. An accepted route has:
    • the sk-route- prefix;
    • valid hosts and a bounded drain;
    • HTTPS matching unless TLS is off;
    • either the agent's maintenance page with no upstream, or one private upstream (an address, or a managed container name with a port).
  • FuzzHealthSpec. An accepted probe has a clean path or a valid port, bounded timings with the timeout no longer than the interval, and thresholds from 1 to 10.
  • FuzzContainerSpec. An accepted spec keeps no-new-privileges, the network and the limits, only volume and tmpfs mounts, no NUL in arguments, Shipkeep's own labels never replaced, and no sk. label from the spec.

Each target states what an accepted input must satisfy, so a validator that lets something through fails, not only one that panics.

fuzz-nightly.yml: every Go target (the 3 new ones and the 4 existing ones) runs for five minutes each night, one job per target. A finding fails the job and prints the failing input in the log, so no new action is needed. CI's Go job now fails when a func Fuzz… is missing from that matrix.

Fixed: the first finding. FuzzLoad found in seconds that a number written 01, +1 or .5 made config.Load fail with a raw JSON encoding error instead of a validation error.

  • Integers are now read as the YAML 1.2 core schema writes them (decimal with a sign and leading zeros, 0o, 0x), as the control plane's TypeScript parser reads them.
  • Floats are written back in JSON's form.
  • Any other form is a validation error.
  • The input stays in the corpus, and a table test covers each form.

Threat model: the fuzzing line now says what runs, where, and how a missing target is caught. The Compose validator is TypeScript and nothing calls it yet: Compose applications are outside the first stable version (#221, #222). The issue offered "choose a TypeScript fuzzer, or change the model", and I chose to change the model: that fuzzing comes with Compose. This assumption is the more reversible option, and it adds no dependency.

How it was tested

  • Locally, fuzzing for real:
    • the 3 new targets for 45 s each, and the 4 existing ones for 30 s each. Only FuzzLoad found something, and it is fixed;
    • after the fix, FuzzLoad again for 60 s: nothing.
  • Checks: go test ./agent/... ./lib/..., golangci-lint (0 issues on agent and lib), actionlint, and the completeness check, which reports no missing target.

Security considerations

  • The fix narrows what the loader accepts to what the control plane already accepts. A form neither reads is now a validation error.
  • The nightly workflow has read-only permissions, uses no new action, and has no input from outside: the matrix values pass through environment variables.

A number YAML writes in a form JSON does not, such as `01`, `+1` or
`.5`, was kept as text and made Load fail with an encoding error instead
of a validation error. Integers are now read as the YAML 1.2 core schema
writes them (decimal with sign and leading zeros, 0o octal, 0x hex), as
the control plane's parser reads them, and floats are written back in
JSON's form. Any other form is a validation error.

Found by FuzzLoad (#244); its input stays in the corpus.

Signed-off-by: samuel mbabhazi <[email protected]>
New targets for the validators the threat model lists: the route builder
(maintenance routes included), the health check and the container spec.
Each states what an accepted input must satisfy, so a validator that
lets something through fails, not only one that panics.

fuzz-nightly.yml runs every Go target for five minutes each night and
prints a failing input. CI fails when a target is missing from it. The
Compose validator is TypeScript and unused until Compose applications,
outside the first stable version: its fuzzing comes with them, as the
threat model now says.

Part of #244.

Signed-off-by: samuel mbabhazi <[email protected]>
@samuelmbabhazi samuelmbabhazi added track:agent v0.1-stable In the scope of the first stable version (docs/PLAN.md) labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f2cd838 and 253952f.

Files selected for processing: 7

  • .github/workflows/ci.yml
  • .github/workflows/fuzz-nightly.yml
  • agent/internal/actions/fuzz_test.go
  • docs/THREAT_MODEL.md
  • lib/config/testdata/fuzz/FuzzLoad/603825a7bd5444cd
  • lib/config/validate.go
  • lib/config/validate_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@samuelmbabhazi
samuelmbabhazi merged commit d3585b6 into main Nov 23, 2026
25 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the test/244-fuzzing branch November 23, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

track:agent v0.1-stable In the scope of the first stable version (docs/PLAN.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant