Skip to content

fix(rpki): scope validation to the ROA state of the requested time - #52

Merged
digizeph merged 2 commits into
mainfrom
fix/rpki-time-scoped-validation
Nov 2, 2026
Merged

digizeph merged 2 commits into
mainfrom
fix/rpki-time-scoped-validation

Conversation

@digizeph

@digizeph digizeph commented Nov 2, 2026

Copy link
Copy Markdown
Member

What

validate_check_expiry now honours the ROA validity window when deciding whether a prefix is covered, and insert_roa treats that window as part of a ROA's identity.

Why

Wiring a historical ROA table into the trie exposed two defects.

  • The coverage test ran before the window filter, 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: Invalid claims RPKI rejected the route, which is only true while the ROA was live.
  • Deduping on (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 with Invalid vs Unknown before the change.
  • cargo fmt --check and cargo clippy --features rpki --lib -- -D warnings: clean. (--all-targets still reports the pre-existing asinfo test and examples/as2org.rs lints.)
  • Parity against the raw RIPE dumps with the fixed library: 2016-06-01, 2020-06-01 and 2025-06-01 all at 0 missing and 0 wrongly rejected.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/rpki/mod.rs Resolved
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the time-scoped RPKI validation changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@digizeph
digizeph merged commit e7cd244 into main Nov 2, 2026
2 checks passed
@digizeph
digizeph deleted the fix/rpki-time-scoped-validation branch November 2, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants