Repository navigation
Validate raw discovery runner records before forwarding - #82
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Validation misses Unicode case-fold aliases accepted by the signer, allowing records to pass validation with conflicting field interpretations.
1 open issue
What changed in this PR
This PR validates raw runner records before discovery forwards them, while preserving unknown extensions and original numeric tokens. Shared decoding and signer normalization remain unchanged.
Changes:
- Validate known field casing and types, timestamps, duplicate keys, and Unicode.
- Expand schema and forwarding tests, plus signer compatibility coverage.
- Document discovery’s malformed-record filtering.
| File | Description |
|---|---|
signer/discovery_test.go |
Verify signer normalization remains lenient. |
docs/http-api.md |
Document field validation and malformed-record filtering. |
discovery/server.go |
Validate raw runner fields before retaining records. |
discovery/server_test.go |
Verify malformed runners are skipped during forwarding. |
discovery/schema_test.go |
Expand schema and raw-record validation coverage. |
Review effort: Balanced
Comment on lines
+207
to
+208
| for name, value := range fields { | ||
| key := strings.ToLower(name) |
3 tasks
This branch was successfully deployed
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.

Discovery could forward runner records with string prices, nonnumeric capacities, or conflicting field names, leaving clients to interpret the same response differently.
Validate raw runner records before retaining them for forwarding. JSON v2 rejects duplicate keys and invalid Unicode; known fields require the documented casing and types, and observation timestamps must be RFC3339. Integer checks inspect digits and exponents without expanding large numbers. Malformed runners are skipped individually, while unknown extensions and exact numeric tokens are preserved. Shared decoding and signer normalization remain unchanged.
Validation:
go test -race ./discovery/... ./signer -count=1go vet ./discovery/... ./signerLocal Apple M4 Max benchmark (median of three runs, complete inventory decoding): 100 full runner records increased from 0.254 ms to 0.572 ms, and 1,000 from 2.43 ms to 5.47 ms. The latter allocates 3.99 MiB versus 1.27 MiB cumulatively. Validation runs during upstream refresh; cached HTTP reads do not repeat it.
Related to #64.