Skip to content

fix: RPKI validation returns Invalid for max_length exceeded#28

Merged
digizeph merged 4 commits intomainfrom
fix/rpki-validation-bug
Feb 26, 2026
Merged

fix: RPKI validation returns Invalid for max_length exceeded#28
digizeph merged 4 commits intomainfrom
fix/rpki-validation-bug

Conversation

@digizeph
Copy link
Member

Summary

Fixed a bug where RPKI validation incorrectly returned Unknown when a prefix was covered by an ROA but exceeded the max_length restriction. Now correctly returns Invalid.

Root Cause

In lookup_by_prefix(), ROAs were filtered by max_length >= prefix.prefix_len(). When validating a more specific prefix (e.g., /24 covered by a /23 ROA with max_length 23), the ROA was filtered out, causing validate() to see empty matches and return Unknown instead of Invalid.

Changes

  • Added lookup_covering_roas() helper method to find all covering ROAs without max_length filter
  • Modified validate() to check coverage first before filtering by max_length
  • Modified validate_check_expiry() with the same fix
  • Added comprehensive tests for the bug scenarios

Validation Logic

  • No covering ROA exists → Unknown
  • Covering ROAs exist but none authorize prefix (wrong ASN or max_length exceeded) → Invalid
  • Covering ROA matches ASN and max-length → Valid

Tests

  • test_validate_max_length_exceeded - Core bug scenario
  • test_validate_check_expiry_max_length_exceeded - Expiry-aware validation
  • test_lookup_covering_roas - Helper method

All RPKI tests pass.

Fixed a bug where validate() and validate_check_expiry() incorrectly
returned Unknown when a prefix was covered by an ROA but exceeded
the max_length restriction. Now returns Invalid instead.

Changes:
- Added lookup_covering_roas() helper to find all covering ROAs
- Modified validate() to check coverage first before filtering
- Modified validate_check_expiry() with same fix
- Added tests for max_length exceeded scenarios
@digizeph digizeph enabled auto-merge February 25, 2026 23:48
@digizeph digizeph disabled auto-merge February 25, 2026 23:59
@digizeph digizeph enabled auto-merge February 26, 2026 00:00
@digizeph digizeph merged commit 8b67787 into main Feb 26, 2026
1 of 2 checks passed
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.

1 participant