Repository navigation
Use serial number arithmetic for RRSIG validity times - #1413
Merged
Merged
Conversation
Contributor
|
Good catch! Do we need to add special test cases given that RFC 4034 §3.1.5 states "As a direct consequence, the values contained in these fields cannot refer to dates more than 68 years in either the past or the future." ? |
Contributor
Author
|
Thanks for the comment. I added tests for both inception and expiration at the 68-year boundary and one second inside it. |
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.
RFC 4034 §3.1.5 requires RFC 1982 serial number arithmetic for comparisons involving the 32-bit RRSIG inception and expiration fields. The current validator compares these fields directly with Unix time, so it rejects an otherwise valid signature whose validity interval crosses the rollover.
For example, a signature with inception
0xfffffff0and expiration0x00000020is valid at Unix times0xffffffffand0x100000001. Both calls tovalidate_rrsig()currently raiseValidationFailure("expired").This change uses
dns.serial.Serialfor both comparisons. It accepts the exact inception and expiration instants and preserves the fractional-second expiration check. Comparisons at the undefined half-range boundary fail the time check. Non-finite validation times raiseValidationFailure.The regression test signs an RRset and exercises both sides of the rollover, both inclusive endpoints, fractional times just outside the interval, and the undefined half-range comparison. The test reproduced the false rejection before the change. The local offline suite passed with 1,645 tests passing and 131 skipped. Black, Ruff, Pyright, and ty also passed.
RFC 4034 §3.1.5 · RFC 4035 §5.3.1 · RFC 1982 §3.2