Skip to main content

verifyos_cli/rules/
privacy.rs

1use crate::rules::core::{
2    AppStoreRule, ArtifactContext, RuleCategory, RuleError, RuleReport, RuleStatus, Severity,
3};
4
5pub struct MissingPrivacyManifestRule;
6
7impl AppStoreRule for MissingPrivacyManifestRule {
8    fn id(&self) -> &'static str {
9        "RULE_PRIVACY_MANIFEST"
10    }
11
12    fn name(&self) -> &'static str {
13        "Missing Privacy Manifest"
14    }
15
16    fn category(&self) -> RuleCategory {
17        RuleCategory::Privacy
18    }
19
20    fn severity(&self) -> Severity {
21        Severity::Error
22    }
23
24    fn recommendation(&self) -> &'static str {
25        "Add a PrivacyInfo.xcprivacy file to the app bundle."
26    }
27
28    fn evaluate(&self, artifact: &ArtifactContext) -> Result<RuleReport, RuleError> {
29        let manifest_path = artifact.app_bundle_path.join("PrivacyInfo.xcprivacy");
30        if !manifest_path.exists() {
31            return Ok(RuleReport {
32                status: RuleStatus::Fail,
33                message: Some("Missing PrivacyInfo.xcprivacy".to_string()),
34                evidence: Some(format!("Not found at {}", manifest_path.display())),
35            });
36        }
37
38        Ok(RuleReport {
39            status: RuleStatus::Pass,
40            message: None,
41            evidence: None,
42        })
43    }
44}