20261112 完成#187真实序列录制回放与七指标评估
This commit is contained in:
@@ -3904,6 +3904,30 @@ fn audit_detail_from_vcir_status(
|
||||
}
|
||||
}
|
||||
|
||||
// A manifest hash lock alone is not stage2 validation. Keep the same default
|
||||
// status in fresh audit and persisted artifacts used by PP/fallback reuse.
|
||||
fn snapshot_file_initial_audit_result(file: &PackFile) -> (AuditObjectResult, Option<String>) {
|
||||
if !file.rsync_uri.ends_with(".crl") {
|
||||
return (
|
||||
AuditObjectResult::Skipped,
|
||||
Some("skipped: not processed in stage2".to_string()),
|
||||
);
|
||||
}
|
||||
let ok = file
|
||||
.bytes()
|
||||
.ok()
|
||||
.and_then(|bytes| crate::data_model::crl::RpkixCrl::decode_der(bytes).ok())
|
||||
.is_some();
|
||||
if ok {
|
||||
(AuditObjectResult::Ok, None)
|
||||
} else {
|
||||
(
|
||||
AuditObjectResult::Error,
|
||||
Some("CRL decode failed".to_string()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn build_publication_point_audit_from_snapshot(
|
||||
ca: &CaInstanceHandle,
|
||||
source: PublicationPointSource,
|
||||
@@ -3916,49 +3940,20 @@ fn build_publication_point_audit_from_snapshot(
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
child_audits: &[ObjectAuditEntry],
|
||||
) -> PublicationPointAudit {
|
||||
use crate::data_model::crl::RpkixCrl;
|
||||
use std::collections::HashMap;
|
||||
|
||||
let locked_files = &pack.files;
|
||||
let mut audit_by_uri: HashMap<String, ObjectAuditEntry> = HashMap::new();
|
||||
for f in locked_files {
|
||||
let (result, detail) = snapshot_file_initial_audit_result(f);
|
||||
audit_by_uri.insert(
|
||||
f.rsync_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: f.rsync_uri.clone(),
|
||||
sha256_hex: sha256_hex_from_32(&f.sha256),
|
||||
kind: kind_from_rsync_uri(&f.rsync_uri),
|
||||
result: AuditObjectResult::Skipped,
|
||||
detail: Some("skipped: not processed in stage2".to_string()),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
for f in locked_files {
|
||||
if !f.rsync_uri.ends_with(".crl") {
|
||||
continue;
|
||||
}
|
||||
let ok = f
|
||||
.bytes()
|
||||
.ok()
|
||||
.and_then(|bytes| RpkixCrl::decode_der(bytes).ok())
|
||||
.is_some();
|
||||
audit_by_uri.insert(
|
||||
f.rsync_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: f.rsync_uri.clone(),
|
||||
sha256_hex: sha256_hex_from_32(&f.sha256),
|
||||
kind: AuditObjectKind::Crl,
|
||||
result: if ok {
|
||||
AuditObjectResult::Ok
|
||||
} else {
|
||||
AuditObjectResult::Error
|
||||
},
|
||||
detail: if ok {
|
||||
None
|
||||
} else {
|
||||
Some("CRL decode failed".to_string())
|
||||
},
|
||||
result,
|
||||
detail,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -6111,12 +6106,12 @@ fn build_vcir_related_artifacts(
|
||||
|
||||
for file in &pack.files {
|
||||
let audit_entry = audit_by_uri.get(file.rsync_uri.as_str()).copied();
|
||||
let result = audit_entry
|
||||
.map(|entry| entry.result.clone())
|
||||
.unwrap_or(AuditObjectResult::Ok);
|
||||
let (result, detail) = audit_entry
|
||||
.map(|entry| (entry.result.clone(), entry.detail.clone()))
|
||||
.unwrap_or_else(|| snapshot_file_initial_audit_result(file));
|
||||
let validation_status = audit_result_to_vcir_status(&result);
|
||||
let reject_reason = if validation_status == VcirArtifactValidationStatus::Rejected {
|
||||
audit_entry.and_then(|entry| entry.detail.clone())
|
||||
detail
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user