fn parse_imported_audit()

in src/storage.rs [1334:1356]


fn parse_imported_audit(valid_criteria: &[CriteriaName], value: toml::Value) -> Option<AuditEntry> {
    let mut audit: AuditEntry = parse_from_value(value)
        .map_err(|err| info!("imported audit parsing failed due to {err}"))
        .ok()?;

    // Remove any unrecognized criteria to avoid later errors caused by being
    // unable to find criteria, and ignore the entry if it names no known
    // criteria.
    audit.criteria.retain(|criteria_name| {
        if !is_known_criteria(valid_criteria, criteria_name) {
            info!("discarding unknown criteria in imported audit: {criteria_name}");
            return false;
        }
        true
    });

    if audit.criteria.is_empty() {
        info!("imported audit parsing failed due to no known criteria");
        return None;
    }

    Some(audit)
}