Repository navigation
Reject invalid signed timestamps and fuzz untrusted inputs - #13
Merged
NetworkTheoryAppliedResearchInstitute merged 2 commits intoNov 9, 2026
Conversation
Signed-off-by: Nirmal Khedkar <nirmalhk7@gmail.com>
Signed-off-by: Nirmal Khedkar <nirmalhk7@gmail.com>
NetworkTheoryAppliedResearchInstitute
approved these changes
Nov 6, 2026
NetworkTheoryAppliedResearchInstitute
left a comment
Contributor
There was a problem hiding this comment.
Thanks, @nirmalhk7. This closes a real gap: before this change, a signature over the encoder's skipped-field bytes verified for any out-of-range timestamp. The fix is small and easy to follow.
What I checked: commit f3e09c5 compared with f7c802e (#12), by reading the code. I didn't run anything locally. CI passed on this commit: Go build, vet and test, foreign-implementation conformance, and the zero-dependency check.
What looks right:
- All twelve timestamp-bearing Verify methods check
canon.ValidTimebefore the signature, covering all 14 time fields. - The check matches SPEC §3's verifier rule exactly (the full int64-nanosecond range, both ends included).
- Canonical bytes, vectors, SPEC.md and go.mod are unchanged, so there's no wire change and no new dependency.
- No clock-skew window is added and Seq/replay handling is untouched, so peers that follow SPEC aren't affected.
- The regression tests try each time field on its own and check both ends of the range.
- The CONFORMANCE row claims only what was built.
Non-blocking, fine as follow-ups:
- Zero-time messages (an unset
time.Time) used to verify and now don't, e.g.identity/keylife.go:106andemployment/employment.go:161. The description says the public APIs stay the same, which is true of the signatures but not of the behaviour. Please note this in the next release notes. verification_fuzz_test.go:24-39, 56-61: assert 12 message types and 14time.Timefields visited, so a new or wrapped field can't be skipped silently.operator/verify_fuzz_test.go:24-26: no seed reaches the key-length checks with a malformed key. The malformed seed has no Nonce, so it stops atErrNonceTooShort. Add seeds that pair a valid payload with an empty key and a 31-byte key, and give the malformed seed a 16-byte Nonce. Incanon/verify_fuzz_test.go:51-53, the oracle is the functionVerifySigwraps; assert that the vector seeds verify, or reword the comment.- 🐛 (preexisting)
SPEC.md:114says producers MUST checkValidTimebefore signing, but noSign()does (e.g.fees/fees.go:51-52). After this PR such messages fail Verify with no local error. Worth a producer-side guard or an error-returning signer at the next version bump. - 🐛 (preexisting)
SPEC.md:115andcanon/canon.go:47,133say a "decoder" MUST reject bad timestamps, while SPEC §7 and the reference handler leave that to Verify (decode_fuzz_test.go:48-49). A SPEC-first wording fix would make these agree. - 🐛 (preexisting)
transport/httpjson/server.go:85andclient.go:82decode bodies with no size cap. Suggest a separate hardening PR usinghttp.MaxBytesReaderandio.LimitReader.
Merge note: this branch carries #12's commit. Merge #12 first, then squash-merge this one. If the branch is restacked, the new head needs a fresh approval.
Approved at the tested commit f3e09c5 on Jodson Graves's instruction.
NetworkTheoryAppliedResearchInstitute
merged commit Nov 9, 2026
c3fac19
into
NTARI-RAND:main
4 checks passed
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.
SPEC §3 requires rejecting timestamps outside the range of int64 Unix nanoseconds, but the twelve timestamp-bearing message types did not enforce that during signature verification. The encoder skips an invalid timestamp; a sender could sign those incomplete bytes and still get a successful verification result.
Each affected verifier now checks its timestamps before checking the signature. Regression tests cover every timestamp field, including zero time, values just outside the supported range, and both valid endpoints. They fail before the fix and pass afterward. Valid message formats, canonical bytes, domain tags, and public APIs stay the same.
This also adds malformed-response tests and five fuzz targets covering request/response JSON decoding, signature verification, the timestamp-bearing messages, and operator messages. These exercise untrusted inputs beyond the cases covered by the existing examples.
Validation: local build, vet, race-enabled tests, and all 55 independent Python conformance checks passed. Five 10-second fuzz campaigns completed over one million executions combined without another failure. Golden vectors and module dependencies are unchanged.
This is the second change in a three-PR stack. Its branch includes the transport-test commit; review the timestamp/fuzzing commit separately until the first PR is merged. The CI change follows this one.
Depends on #12. The fix and additional tests are in commit f3e09c5.