diff --git a/installer-rs/crates/phoebus-ai/src/lib.rs b/installer-rs/crates/phoebus-ai/src/lib.rs index fa48364..64fb5ee 100644 --- a/installer-rs/crates/phoebus-ai/src/lib.rs +++ b/installer-rs/crates/phoebus-ai/src/lib.rs @@ -321,9 +321,29 @@ impl ReviewOutcome { } } -/// Validate a proposal with mandatory evidence, reject conflicts, and apply it -/// atomically (fail closed). This is the path a guided install uses; the model -/// never reaches the executor without passing it. +/// Changes that would weaken a required, non-negotiable setting. +/// +/// Phoebus is a LUKS2 + Btrfs system; aggressive kernel profiles are +/// speculative. The model may propose these, but a deterministic check refuses +/// them so the proven security posture is never traded for convenience. +fn fixed_policy_violation(change: &ProposedChange) -> Option { + match change { + ProposedChange::SetEncryption { + value: Encryption::None, + } => Some("encryption must remain LUKS2".into()), + ProposedChange::SetFilesystem { + value: Filesystem::Ext4, + } => Some("the filesystem must remain Btrfs".into()), + ProposedChange::SetKernelProfile { + value: KernelProfile::Aggressive, + } => Some("aggressive kernel profiles are not accepted".into()), + _ => None, + } +} + +/// Validate a proposal with mandatory evidence, reject conflicts and unsafe +/// changes, and apply it atomically (fail closed). This is the path a guided +/// install uses; the model never reaches the executor without passing it. pub fn review(config: &mut InstallConfig, proposal: &AiProposal) -> Result { if proposal.version != 1 { return Err(AiError::UnsupportedVersion(proposal.version)); @@ -355,6 +375,12 @@ pub fn review(config: &mut InstallConfig, proposal: &AiProposal) -> Result println!("{}", outcome.render()), + Err(e) => eprintln!("AI proposal rejected; continuing with the proven defaults: {e}"), + } Ok(()) }