20260506_2 为CIR增加reject list基础能力
This commit is contained in:
@@ -6,7 +6,8 @@ use rpki::ccr::{
|
||||
encode_content_info,
|
||||
};
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir,
|
||||
};
|
||||
|
||||
fn skip_heavy_blackbox_test() -> bool {
|
||||
@@ -43,7 +44,7 @@ fn cir_full_and_delta_pair_reuses_shared_repo_bytes_db() {
|
||||
};
|
||||
|
||||
let full_cir = CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-03-16T11:49:15Z",
|
||||
@@ -58,9 +59,11 @@ fn cir_full_and_delta_pair_reuses_shared_repo_bytes_db() {
|
||||
tal_uri: "https://rpki.apnic.net/tal/apnic-rfc7730-https.tal".to_string(),
|
||||
tal_bytes: b"rsync://example.net/repo/root.cer\nMIIB".to_vec(),
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
};
|
||||
let delta_cir = CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-03-16T11:50:15Z",
|
||||
@@ -82,6 +85,8 @@ fn cir_full_and_delta_pair_reuses_shared_repo_bytes_db() {
|
||||
objects
|
||||
},
|
||||
tals: full_cir.tals.clone(),
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
};
|
||||
let empty_ccr = CcrContentInfo::new(RpkiCanonicalCacheRepresentation {
|
||||
version: 0,
|
||||
|
||||
@@ -7,7 +7,8 @@ use rpki::ccr::{
|
||||
encode_content_info,
|
||||
};
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir,
|
||||
};
|
||||
|
||||
#[test]
|
||||
@@ -33,7 +34,7 @@ fn cir_drop_report_counts_dropped_roa_objects_and_vrps() {
|
||||
.expect("write repo bytes");
|
||||
|
||||
let cir = CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-04-09T00:00:00Z",
|
||||
@@ -48,6 +49,8 @@ fn cir_drop_report_counts_dropped_roa_objects_and_vrps() {
|
||||
tal_uri: "https://example.test/root.tal".to_string(),
|
||||
tal_bytes: b"rsync://example.net/repo/root.cer\nMIIB".to_vec(),
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
};
|
||||
std::fs::write(&cir_path, encode_cir(&cir).unwrap()).unwrap();
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::process::Command;
|
||||
|
||||
use rpki::blob_store::ExternalRepoBytesDb;
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
materialize_cir_from_repo_bytes,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir, materialize_cir_from_repo_bytes,
|
||||
};
|
||||
|
||||
fn skip_heavy_script_replay_test() -> bool {
|
||||
@@ -36,7 +36,7 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
};
|
||||
(
|
||||
CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-04-07T00:00:00Z",
|
||||
@@ -51,6 +51,8 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
tal_uri: "https://example.test/root.tal".to_string(),
|
||||
tal_bytes,
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
},
|
||||
ta_bytes,
|
||||
)
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::process::Command;
|
||||
|
||||
use rpki::blob_store::ExternalRepoBytesDb;
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
materialize_cir_from_repo_bytes,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir, materialize_cir_from_repo_bytes,
|
||||
};
|
||||
|
||||
fn skip_heavy_script_replay_test() -> bool {
|
||||
@@ -36,7 +36,7 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
};
|
||||
(
|
||||
CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-04-07T00:00:00Z",
|
||||
@@ -51,6 +51,8 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
tal_uri: "https://example.test/root.tal".to_string(),
|
||||
tal_bytes,
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
},
|
||||
ta_bytes,
|
||||
)
|
||||
|
||||
@@ -6,7 +6,8 @@ use rpki::ccr::{
|
||||
encode_content_info,
|
||||
};
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir,
|
||||
};
|
||||
|
||||
fn skip_heavy_blackbox_test() -> bool {
|
||||
@@ -35,7 +36,7 @@ fn cir_offline_sequence_writes_parseable_sequence_json_and_steps() {
|
||||
.unwrap();
|
||||
|
||||
let mk_cir = |uri: &str, hash_hex: &str, vt: &str| CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
vt,
|
||||
@@ -50,6 +51,8 @@ fn cir_offline_sequence_writes_parseable_sequence_json_and_steps() {
|
||||
tal_uri: "https://rpki.apnic.net/tal/apnic-rfc7730-https.tal".to_string(),
|
||||
tal_bytes: b"rsync://example.net/repo/root.cer\nMIIB".to_vec(),
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
};
|
||||
let full_hash = {
|
||||
use sha2::{Digest, Sha256};
|
||||
@@ -65,7 +68,7 @@ fn cir_offline_sequence_writes_parseable_sequence_json_and_steps() {
|
||||
"2026-03-16T11:49:15Z",
|
||||
);
|
||||
let delta_cir = CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-03-16T11:50:15Z",
|
||||
@@ -84,6 +87,8 @@ fn cir_offline_sequence_writes_parseable_sequence_json_and_steps() {
|
||||
objects
|
||||
},
|
||||
tals: full_cir.tals.clone(),
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
};
|
||||
let empty_ccr = CcrContentInfo::new(RpkiCanonicalCacheRepresentation {
|
||||
version: 0,
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::process::Command;
|
||||
|
||||
use rpki::blob_store::ExternalRepoBytesDb;
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
materialize_cir_from_repo_bytes,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir, materialize_cir_from_repo_bytes,
|
||||
};
|
||||
|
||||
fn skip_heavy_script_replay_test() -> bool {
|
||||
@@ -36,7 +36,7 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
};
|
||||
(
|
||||
CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-04-07T00:00:00Z",
|
||||
@@ -51,6 +51,8 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
tal_uri: "https://example.test/root.tal".to_string(),
|
||||
tal_bytes,
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
},
|
||||
ta_bytes,
|
||||
)
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::process::Command;
|
||||
|
||||
use rpki::blob_store::ExternalRepoBytesDb;
|
||||
use rpki::cir::{
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
materialize_cir_from_repo_bytes,
|
||||
CIR_VERSION_V2, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
compute_reject_list_sha256, encode_cir, materialize_cir_from_repo_bytes,
|
||||
};
|
||||
|
||||
fn skip_heavy_script_replay_test() -> bool {
|
||||
@@ -36,7 +36,7 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
};
|
||||
(
|
||||
CanonicalInputRepresentation {
|
||||
version: CIR_VERSION_V1,
|
||||
version: CIR_VERSION_V2,
|
||||
hash_alg: CirHashAlgorithm::Sha256,
|
||||
validation_time: time::OffsetDateTime::parse(
|
||||
"2026-04-07T00:00:00Z",
|
||||
@@ -51,6 +51,8 @@ fn build_ta_only_cir() -> (CanonicalInputRepresentation, Vec<u8>) {
|
||||
tal_uri: "https://example.test/root.tal".to_string(),
|
||||
tal_bytes,
|
||||
}],
|
||||
reject_list_sha256: compute_reject_list_sha256(std::iter::empty::<&str>()),
|
||||
rejected_objects: Vec::new(),
|
||||
},
|
||||
ta_bytes,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user