Repository navigation
test(agent): fuzz every action validator nightly (part of #244) - #425
Merged
Merged
Conversation
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]>
|
Warning Review limit reachedYou'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. View limit details
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:sk-route-prefix;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 keepsno-new-privileges, the network and the limits, only volume and tmpfs mounts, no NUL in arguments, Shipkeep's own labels never replaced, and nosk.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 afunc Fuzz…is missing from that matrix.Fixed: the first finding.
FuzzLoadfound in seconds that a number written01,+1or.5madeconfig.Loadfail with a raw JSON encoding error instead of a validation error.0o,0x), as the control plane's TypeScript parser reads them.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
FuzzLoadfound something, and it is fixed;FuzzLoadagain for 60 s: nothing.go test ./agent/... ./lib/...,golangci-lint(0 issues onagentandlib),actionlint, and the completeness check, which reports no missing target.Security considerations