Repository navigation
fix(rpki): scope validation to the ROA state of the requested time - #52
Merged
Merged
Conversation
Two defects surfaced while wiring a historical ROA table into the trie. `validate_check_expiry` ran the coverage test before applying the validity window, so an expired ROA still counted as coverage and a route with a different origin came back `Invalid`. A time at which no ROA was in effect is `Unknown`; reporting `Invalid` claims RPKI rejected the route, which is only true while the ROA was live. `insert_roa` deduped on (prefix, asn, max_length) alone, so every re-issued certificate was dropped. Loaded from a historical source that is most of the history: on 2016-06-01 it lost 11.15% of the ROAs in effect, and the parity check against the day's RIPE dump went from 0 mismatches to 2,256. Both changes are no-ops for a source that publishes only the current set, where every entry carries the same empty window.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation overstates historical effectiveness from snapshots without observation windows and retains an incorrect Cloudflare deduplication example.
1 open issue
What changed in this PR
This PR makes RPKI validation time-aware so a single trie can retain ROA history and validate routes at a requested time.
Changes:
- Filter ROAs by their validity windows before determining coverage and authorization.
- Preserve reissued ROAs with different validity windows.
- Add three regression tests and document the fixes in the changelog.
| File | Description |
|---|---|
src/rpki/mod.rs |
Adds time-window checks, window-aware deduplication, and regression tests. |
CHANGELOG.md |
Records the time-scoped validation and historical ROA retention fixes. |
Review effort: Balanced
The built-in loaders fill not_after from the certificate expiry and leave not_before unset, so effective_at cannot establish that a ROA was in effect at a past time on its own. Say that, and drop the Cloudflare example from insert_roa: entries that each carry an expiry now stay distinct.
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.

What
validate_check_expirynow honours the ROA validity window when deciding whether a prefix is covered, andinsert_roatreats that window as part of a ROA's identity.Why
Wiring a historical ROA table into the trie exposed two defects.
Invalid. A time at which no ROA was in effect isUnknown:Invalidclaims RPKI rejected the route, which is only true while the ROA was live.(prefix, asn, max_length)alone dropped every re-issued certificate, which deletes the older part of the history. Loading 2016-06-01 from the archive and comparing against the day's RIPE dump, that discarded 11.15% of the ROAs in effect (2,256 of 20,314).Both changes are no-ops for a current-state source such as the Cloudflare VRP set, where every entry carries an empty window.
Verification
cargo test --features rpki --lib: 75 passed, including three new tests (expired_covering_roa_is_not_coverage,one_trie_answers_different_days,reissued_roa_keeps_both_windows); the first failed withInvalidvsUnknownbefore the change.cargo fmt --checkandcargo clippy --features rpki --lib -- -D warnings: clean. (--all-targetsstill reports the pre-existingasinfotest andexamples/as2org.rslints.)