diff --git a/Cargo.lock b/Cargo.lock index 5b9a654..ead1fc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,7 +329,7 @@ dependencies = [ [[package]] name = "custos-gen" -version = "0.12.0" +version = "0.13.0" dependencies = [ "custos-vault", "data-encoding", @@ -341,7 +341,7 @@ dependencies = [ [[package]] name = "custos-kdbx" -version = "0.12.0" +version = "0.13.0" dependencies = [ "aes", "argon2", @@ -362,7 +362,7 @@ dependencies = [ [[package]] name = "custos-keys" -version = "0.12.0" +version = "0.13.0" dependencies = [ "custos-vault", "ed25519-dalek", @@ -375,11 +375,11 @@ dependencies = [ [[package]] name = "custos-qr" -version = "0.12.0" +version = "0.13.0" [[package]] name = "custos-seal" -version = "0.12.0" +version = "0.13.0" dependencies = [ "chacha20poly1305", "hkdf", @@ -392,7 +392,7 @@ dependencies = [ [[package]] name = "custos-share" -version = "0.12.0" +version = "0.13.0" dependencies = [ "argon2", "chacha20poly1305", @@ -409,7 +409,7 @@ dependencies = [ [[package]] name = "custos-sign" -version = "0.12.0" +version = "0.13.0" dependencies = [ "blake2 0.10.6", "data-encoding", @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "custos-totp" -version = "0.12.0" +version = "0.13.0" dependencies = [ "custos-vault", "data-encoding", @@ -441,7 +441,7 @@ dependencies = [ [[package]] name = "custos-vault" -version = "0.12.0" +version = "0.13.0" dependencies = [ "argon2", "bip39", @@ -465,7 +465,7 @@ dependencies = [ [[package]] name = "custos-wasm" -version = "0.12.0" +version = "0.13.0" dependencies = [ "custos-qr", "custos-seal", diff --git a/Cargo.toml b/Cargo.toml index 6ce828d..7e91a5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.12.0" +version = "0.13.0" edition = "2024" license = "MPL-2.0" repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic" diff --git a/crates/custos-vault/src/lib.rs b/crates/custos-vault/src/lib.rs index ec3cf64..c213a26 100644 --- a/crates/custos-vault/src/lib.rs +++ b/crates/custos-vault/src/lib.rs @@ -690,6 +690,37 @@ impl Vault { Ok(()) } + /// A machine-key vault: one device factor opens it alone (a Claude Code store, or Custos's hands-off vault + /// before it is taken over). + pub fn opens_with_machine_key(&self) -> bool { + self.is_store() + } + + /// *Take over the vault* (Custos docs/12_hands_off.md, section 6): adds the master password as a factor paired + /// with the device key, removes the PC-only access, and ticks the items that end unattended work. Returns the + /// password factor's id. Only on a machine-key vault, once. The caller saves. + pub fn take_over(&mut self, password: &SecretString, kdf: KdfParams, now: i64) -> Result { + if !self.is_store() { + return Err(Error::FactorRejected); + } + let slots = self.slots.clone(); + let kdf_was = self.kdf_new; + // Without its single slot the vault is an ordinary version-2 vault with one factor; the password pairs with it. + self.slots.retain(|s| s.kind != format::SLOT_SINGLE); + self.kdf_new = kdf; + match self.add_factor(Unlock::Password(password), "Master password") { + Ok(id) => { + self.security_taken_over(now); + Ok(id) + } + Err(e) => { + self.slots = slots; + self.kdf_new = kdf_was; + Err(e) + } + } + } + fn is_store(&self) -> bool { self.slots.iter().any(|s| s.kind == format::SLOT_SINGLE) } diff --git a/crates/custos-vault/src/security.rs b/crates/custos-vault/src/security.rs index 58a37f6..45b276f 100644 --- a/crates/custos-vault/src/security.rs +++ b/crates/custos-vault/src/security.rs @@ -29,6 +29,12 @@ pub enum Item { NoSsh, /// The phone approves this PC. PhoneApproves, + /// Turn off auto-connect (Custos docs/12_hands_off.md). + NoAutoConnect, + /// Never accept unattended: a new connect opens no Setup window. + NoUnattended, + /// Sign only with a card. + CardSigning, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] @@ -61,6 +67,16 @@ pub enum Action { Unticked, SshConnected, TotpMoved, + /// Connected by itself at start (`detail`: where and as whom). + AutoConnected, + /// A setup run stored items without a card (`detail`: the run and the item names). + UnattendedStored, + /// One of those items was removed (`detail`: the run and the item). + SetupItemRemoved, + /// Signed without a card (`detail`: the key, the kind, the run and the file). + UnattendedSigned, + /// *Take over the vault*: a master password added, the PC-only access removed. + TakenOver, } /// What *Connect via SSH* needs. @@ -103,6 +119,10 @@ pub struct SecurityEntry { /// How an undo was confirmed, for `unticked`. #[serde(default, skip_serializing_if = "Option::is_none")] pub auth: Option, + /// What a note says (`auto-connected`, `unattended-stored`, `setup-item-removed`, `unattended-signed`): names, + /// never a value. At most 500 characters, no control characters. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub detail: Option, } /// Everything *Settings → Security* shows. @@ -152,6 +172,14 @@ fn kept_ok(list: &[String]) -> Result<(), Error> { Ok(()) } +/// A note's detail: 1 to 500 characters, no control characters. The error names the rule, never the text. +fn detail_ok(d: &str) -> Result<(), Error> { + if !(1..=500).contains(&d.chars().count()) || d.chars().any(char::is_control) { + return Err(Error::Security("a note is 1 to 500 characters without control characters")); + } + Ok(()) +} + fn trim(audit: &mut Vec) { if audit.len() > AUDIT_LIMIT { audit.drain(..audit.len() - AUDIT_LIMIT); @@ -200,7 +228,7 @@ impl State { } fn push(&mut self, at: i64, action: Action, item: Option, auth: Option) { - self.audit.push(SecurityEntry { at, action, item, auth }); + self.audit.push(SecurityEntry { at, action, item, auth, detail: None }); trim(&mut self.audit); } @@ -246,6 +274,89 @@ pub fn totp_offer_allowed(ticked: &BTreeSet) -> bool { !ticked.contains(&Item::TotpOnPhone) } +/// The Provisio namespaces a setup run may fill without a card (Custos docs/12_hands_off.md, section 3). +pub const UNATTENDED_NAMESPACES: [&str; 5] = ["arca/", "custos/", "fabrica/", "aula/", "gitea/"]; + +/// A setup run's id: `setup-` and 1 to 58 of `[A-Za-z0-9._-]`. +pub fn is_setup_run(run: &str) -> bool { + run.strip_prefix("setup-").is_some_and(|rest| { + (1..=58).contains(&rest.len()) && rest.bytes().all(|b| b.is_ascii_alphanumeric() || b"._-".contains(&b)) + }) +} + +/// Whether Custos may connect to the factor service by itself (at start, with no device token). +pub fn auto_connect_allowed(level: Level, ticked: &BTreeSet) -> bool { + level != Level::Hardened && !ticked.contains(&Item::NoAutoConnect) && !ticked.contains(&Item::NoSsh) +} + +/// Whether a new connection opens the Setup window. +pub fn setup_on_connect(ticked: &BTreeSet) -> bool { + !ticked.contains(&Item::NoUnattended) && !ticked.contains(&Item::NoSsh) +} + +/// Ask or offer. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Verb { + Ask, + Offer, +} + +/// Where a Provisio line goes. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Store { + Vault, + Claude, + Display, +} + +/// A Provisio line as the unattended rule sees it. +#[derive(Debug, Clone, Copy)] +pub struct ProvisionAsk<'a> { + pub verb: Verb, + /// `--generate`: Custos makes the value. + pub generate: bool, + /// The item exists already (an ask would read it, an offer would replace it). + pub exists: bool, + pub store: Store, + pub item: &'a str, + /// An offer of kind `totp`. + pub totp: bool, +} + +/// Whether a Provisio line is answered without a card: a setup run, in Setup, new items in the allowed namespaces. +pub fn unattended_provision(level: Level, ticked: &BTreeSet, run: &str, req: &ProvisionAsk) -> bool { + if level != Level::Setup || !is_setup_run(run) || ticked.contains(&Item::NoUnattended) || req.exists { + return false; + } + if req.totp && !totp_offer_allowed(ticked) { + return false; + } + match (req.store, req.verb) { + // The Claude Code store takes the names the server offers; it is never read this way. + (Store::Claude, Verb::Offer) => true, + (Store::Vault, Verb::Ask) if !req.generate => false, + (Store::Vault, _) => UNATTENDED_NAMESPACES + .iter() + .any(|ns| req.item.strip_prefix(ns).is_some_and(|rest| !rest.is_empty() && !rest.contains(".."))), + _ => false, + } +} + +/// Whether a run's signature is made without a card: a machine-key vault (not taken over), the release kinds. +pub fn unattended_sign( + level: Level, + ticked: &BTreeSet, + machine_key_vault: bool, + kind: &str, + has_run: bool, +) -> bool { + machine_key_vault + && has_run + && level != Level::Hardened + && !ticked.contains(&Item::CardSigning) + && matches!(kind, "minisign" | "manifest" | "authenticode" | "approval") +} + /// Whether *Sign & release*, *Accept*, *Accept all* and approvals ask for Windows Hello first. pub fn hello_for_approvals(ticked: &BTreeSet) -> bool { ticked.contains(&Item::HelloApprovals) @@ -340,6 +451,34 @@ impl Vault { self.security.kept_scope.take() } + /// Records a note with its detail: `auto-connected`, `unattended-stored`, `setup-item-removed` or + /// `unattended-signed`. The caller saves. + pub fn security_note(&mut self, action: Action, detail: &str, now: i64) -> Result<(), Error> { + if !matches!( + action, + Action::AutoConnected | Action::UnattendedStored | Action::SetupItemRemoved | Action::UnattendedSigned + ) { + return Err(Error::Security( + "only auto-connected, unattended-stored, setup-item-removed and unattended-signed are notes", + )); + } + detail_ok(detail)?; + let st = &mut self.security; + st.notice_expiry(now); + st.audit.push(SecurityEntry { at: now, action, item: None, auth: None, detail: Some(detail.to_owned()) }); + trim(&mut st.audit); + Ok(()) + } + + /// The take-over's half in this member: ticks the items that end unattended work and writes `taken-over`. + pub(crate) fn security_taken_over(&mut self, now: i64) { + self.security.notice_expiry(now); + for item in [Item::NoAutoConnect, Item::NoUnattended, Item::CardSigning] { + self.security_tick(item, now); + } + self.security.push(now, Action::TakenOver, None, None); + } + /// Records `ssh-connected` or `totp-moved`; the other actions are written by the calls above. The caller saves. pub fn security_record(&mut self, action: Action, item: Option, now: i64) -> Result<(), Error> { if !matches!(action, Action::SshConnected | Action::TotpMoved) { diff --git a/crates/custos-vault/tests/hands_off.rs b/crates/custos-vault/tests/hands_off.rs new file mode 100644 index 0000000..e46ba03 --- /dev/null +++ b/crates/custos-vault/tests/hands_off.rs @@ -0,0 +1,210 @@ +//! Hands off (Custos docs/12_hands_off.md): a machine-key vault that Custos opens itself, the rules for auto-connect, +//! the unattended setup run and unattended signing, and *Take over the vault*. + +use std::collections::BTreeSet; + +use custos_vault::security::{ + Action, Item, Level, ProvisionAsk, Store, Verb, auto_connect_allowed, is_setup_run, setup_on_connect, + unattended_provision, unattended_sign, +}; +use custos_vault::{Error, FactorKind, KdfParams, SecretString, Unlock, Vault}; + +const FAST: KdfParams = KdfParams { m_cost_kib: 64, t_cost: 1, p_cost: 1 }; +const NOW: i64 = 1_793_750_000_000; +const PC: [u8; 32] = [7; 32]; + +fn none() -> BTreeSet { + BTreeSet::new() +} +fn ticked(items: &[Item]) -> BTreeSet { + items.iter().copied().collect() +} + +// ---------------------------------------------------------------- take over + +#[test] +fn a_machine_key_vault_is_taken_over_with_a_master_password() { + let mut v = Vault::create_machine_store(&PC, "MARK-PC").unwrap(); + assert!(v.opens_with_machine_key()); + // The hands-off vault holds the release set (with the approval key) from its first start. + v.signing_create(custos_vault::signing::Role::Release, &[], &[], NOW).unwrap(); + + let id = v.take_over(&SecretString::from("a long password"), FAST, NOW).expect("taken over"); + assert!(!v.opens_with_machine_key()); + assert!(v.factors().iter().any(|f| f.id == id && f.kind == FactorKind::Password)); + let bytes = v.to_bytes().unwrap(); + + // This PC alone no longer opens it; the password and this PC do, and the keys are still there. + assert!(Vault::open_machine_store(&bytes, &PC).is_err(), "the PC-only access is gone"); + let pw = SecretString::from("a long password"); + let w = Vault::open_with(&bytes, Unlock::Password(&pw), Unlock::Material(FactorKind::Device, &PC)) + .expect("two factors"); + assert!(w.same_key_as(&v)); + assert_eq!(w.signing_keys().len(), v.signing_keys().len()); + assert!(!w.signing_keys().is_empty()); + + // Unattended work is turned off, and it is audited. + let view = w.security_view(NOW); + assert!(view.ticked.contains(&Item::NoAutoConnect)); + assert!(view.ticked.contains(&Item::NoUnattended)); + assert!(view.ticked.contains(&Item::CardSigning)); + assert_eq!(view.level, Level::Hardened); + assert!(view.audit.iter().any(|e| e.action == Action::TakenOver)); +} + +#[test] +fn only_a_machine_key_vault_is_taken_over_and_only_once() { + let mut user = Vault::create(&SecretString::from("pw"), FAST).unwrap(); + assert!(!user.opens_with_machine_key()); + assert!(user.take_over(&SecretString::from("a long password"), FAST, NOW).is_err()); + + let mut v = Vault::create_machine_store(&PC, "MARK-PC").unwrap(); + v.take_over(&SecretString::from("a long password"), FAST, NOW).unwrap(); + assert!(v.take_over(&SecretString::from("another long one"), FAST, NOW).is_err(), "once"); +} + +#[test] +fn after_the_take_over_a_phone_can_be_added_as_for_any_vault() { + let mut v = Vault::create_machine_store(&PC, "MARK-PC").unwrap(); + assert!(v.add_factor(Unlock::Material(FactorKind::Approval, &[3; 32]), "phone").is_err(), "not before"); + v.take_over(&SecretString::from("a long password"), FAST, NOW).unwrap(); + v.add_factor(Unlock::Material(FactorKind::Approval, &[3; 32]), "phone").expect("after"); + let bytes = v.to_bytes().unwrap(); + assert!( + Vault::open_with( + &bytes, + Unlock::Material(FactorKind::Device, &PC), + Unlock::Material(FactorKind::Approval, &[3; 32]) + ) + .is_ok() + ); +} + +#[test] +fn notes_carry_their_detail_and_refuse_other_actions() { + let mut v = Vault::create_machine_store(&PC, "MARK-PC").unwrap(); + v.security_note(Action::AutoConnected, "Connected to 192.168.100.217 as MARK-PC", NOW).unwrap(); + v.security_note(Action::UnattendedStored, "setup-1: arca/authelia-mark, arca/totp-mark", NOW).unwrap(); + v.security_note(Action::SetupItemRemoved, "setup-1: arca/totp-mark", NOW).unwrap(); + v.security_note(Action::UnattendedSigned, "domi-release minisign run r42 Arca_0.3.0_x64-setup.exe", NOW).unwrap(); + assert!(v.security_note(Action::Ticked, "x", NOW).is_err()); + assert!(v.security_note(Action::AutoConnected, "line\nbreak", NOW).is_err(), "no control characters"); + assert!(v.security_note(Action::AutoConnected, &"x".repeat(501), NOW).is_err(), "at most 500 characters"); + + let bytes = v.to_bytes().unwrap(); + let w = Vault::open_machine_store(&bytes, &PC).unwrap(); + let audit = w.security_view(NOW).audit; + assert_eq!(audit.len(), 4); + assert_eq!(audit[0].detail.as_deref(), Some("Connected to 192.168.100.217 as MARK-PC")); + assert_eq!(audit[3].action, Action::UnattendedSigned); +} + +// ---------------------------------------------------------------- auto-connect and the Setup window + +#[test] +fn auto_connect_runs_in_setup_and_standard_and_stops_when_hardened() { + assert!(auto_connect_allowed(Level::Setup, &none())); + assert!(auto_connect_allowed(Level::Standard, &none())); + assert!(!auto_connect_allowed(Level::Hardened, &ticked(&[Item::HelloApprovals]))); + assert!(!auto_connect_allowed(Level::Setup, &ticked(&[Item::NoAutoConnect])), "the item holds in Setup too"); + assert!(!auto_connect_allowed(Level::Setup, &ticked(&[Item::NoSsh])), "no SSH implies no auto-connect"); +} + +#[test] +fn a_new_connect_opens_setup_unless_unattended_is_off() { + assert!(setup_on_connect(&none())); + assert!(!setup_on_connect(&ticked(&[Item::NoUnattended]))); + assert!(!setup_on_connect(&ticked(&[Item::NoSsh]))); +} + +#[test] +fn setup_runs_are_named_setup_dash_something_short() { + assert!(is_setup_run("setup-1")); + assert!(is_setup_run("setup-2026-11-05.first_run")); + assert!(is_setup_run(&format!("setup-{}", "a".repeat(58)))); + assert!(!is_setup_run(&format!("setup-{}", "a".repeat(59)))); + assert!(!is_setup_run("setup-")); + assert!(!is_setup_run("setup-a b")); + assert!(!is_setup_run("setup-a/b")); + assert!(!is_setup_run("Setup-1")); + assert!(!is_setup_run("r42")); +} + +// ---------------------------------------------------------------- the unattended setup run + +fn ask(item: &str) -> ProvisionAsk<'_> { + ProvisionAsk { verb: Verb::Ask, generate: true, exists: false, store: Store::Vault, item, totp: false } +} +fn offer(item: &str) -> ProvisionAsk<'_> { + ProvisionAsk { verb: Verb::Offer, generate: false, exists: false, store: Store::Vault, item, totp: false } +} + +#[test] +fn a_setup_run_in_setup_takes_new_items_in_the_allowed_namespaces() { + for item in ["arca/authelia-mark", "custos/x", "fabrica/hub-token", "aula/admin", "gitea/read-token"] { + assert!(unattended_provision(Level::Setup, &none(), "setup-1", &ask(item)), "{item}"); + assert!(unattended_provision(Level::Setup, &none(), "setup-1", &offer(item)), "{item}"); + } + let totp = ProvisionAsk { totp: true, ..offer("arca/totp-mark") }; + assert!(unattended_provision(Level::Setup, &none(), "setup-1", &totp)); + let claude = ProvisionAsk { store: Store::Claude, ..offer("fabrica-hub-token") }; + assert!(unattended_provision(Level::Setup, &none(), "setup-1", &claude), "the Claude store's names"); +} + +#[test] +fn everything_else_waits_for_a_card() { + let s = |l, t: &BTreeSet, run, r: &ProvisionAsk| unattended_provision(l, t, run, r); + let n = none(); + // Existing items, asks without --generate, replacing offers. + assert!(!s(Level::Setup, &n, "setup-1", &ProvisionAsk { exists: true, ..ask("arca/x") }), "an existing item"); + assert!(!s(Level::Setup, &n, "setup-1", &ProvisionAsk { generate: false, ..ask("arca/x") }), "no --generate"); + assert!(!s(Level::Setup, &n, "setup-1", &ProvisionAsk { exists: true, ..offer("arca/x") }), "a replacing offer"); + // Namespaces. + for item in ["mark/bank", "domi/root", "arcax/y", "arca", "../arca/x", "ARCA/x"] { + assert!(!s(Level::Setup, &n, "setup-1", &ask(item)), "{item}"); + } + // Display offers, and asks from the Claude store. + assert!(!s(Level::Setup, &n, "setup-1", &ProvisionAsk { store: Store::Display, ..offer("arca/totp-mark") })); + assert!(!s(Level::Setup, &n, "setup-1", &ProvisionAsk { store: Store::Claude, ..ask("fabrica-hub-token") })); + // The run and the level. + assert!(!s(Level::Setup, &n, "r42", &ask("arca/x")), "not a setup run"); + assert!(!s(Level::Standard, &n, "setup-1", &ask("arca/x")), "after the window"); + assert!(!s(Level::Hardened, &ticked(&[Item::NarrowScope]), "setup-1", &ask("arca/x"))); + // Items that turn it off. + assert!(!s(Level::Setup, &ticked(&[Item::NoUnattended]), "setup-1", &ask("arca/x"))); + let totp = ProvisionAsk { totp: true, ..offer("arca/totp-mark") }; + assert!(!s(Level::Setup, &ticked(&[Item::TotpOnPhone]), "setup-1", &totp), "the TOTP lives on the phone"); +} + +// ---------------------------------------------------------------- unattended signing + +#[test] +fn a_machine_key_vault_signs_run_requests_of_the_release_kinds_without_a_card() { + for kind in ["minisign", "manifest", "authenticode", "approval"] { + assert!(unattended_sign(Level::Standard, &none(), true, kind, true), "{kind}"); + assert!(unattended_sign(Level::Setup, &none(), true, kind, true), "{kind} in Setup"); + } +} + +#[test] +fn signing_waits_for_a_card_otherwise() { + assert!(!unattended_sign(Level::Standard, &none(), false, "minisign", true), "taken over"); + assert!(!unattended_sign(Level::Standard, &none(), true, "minisign", false), "no run"); + assert!(!unattended_sign(Level::Standard, &none(), true, "ssh", true), "another kind"); + assert!(!unattended_sign(Level::Hardened, &ticked(&[Item::CardSigning]), true, "minisign", true)); + assert!(!unattended_sign(Level::Hardened, &ticked(&[Item::HelloApprovals]), true, "minisign", true), "hardened"); +} + +#[test] +fn the_new_items_round_trip_and_can_be_undone() { + let mut v = Vault::create(&SecretString::from("pw"), FAST).unwrap(); + for item in [Item::NoAutoConnect, Item::NoUnattended, Item::CardSigning] { + assert!(v.security_tick(item, NOW)); + } + let bytes = v.to_bytes().unwrap(); + let mut w = Vault::open(&bytes, &SecretString::from("pw")).unwrap(); + assert_eq!(w.security_view(NOW).ticked, ticked(&[Item::NoAutoConnect, Item::NoUnattended, Item::CardSigning])); + assert!(w.security_untick(Item::CardSigning, custos_vault::security::Auth::Hello, NOW)); + assert!(!w.security_view(NOW).ticked.contains(&Item::CardSigning)); + let _ = Error::Corrupted; +} diff --git a/docs/FACTORS.md b/docs/FACTORS.md index 8c1320b..fa78899 100644 --- a/docs/FACTORS.md +++ b/docs/FACTORS.md @@ -10,6 +10,13 @@ on, Custos writes it as v2 only. A **machine store** (the Claude Code store) is the one exception: a separate file whose vault key is wrapped by one device key alone, so a program can open it unattended. It never holds the user's secrets. +**Taking over a machine-key vault** (core 0.13.0, Custos's hands-off vault): `Vault::take_over(password)` adds the +master password as a factor paired with the device key and removes the single slot, in one step. From then on it is +an ordinary version-2 vault: two factors open it, the device key alone does not, and factors are added as for any +vault (a phone, a TOTP backup). Only a machine-key vault is taken over, and only once; `opens_with_machine_key()` +says which it is. The take-over also ticks `no-auto-connect`, `no-unattended` and `card-signing` and writes +`taken-over` (FORMAT.md, "The security member"). + ## Keys ``` diff --git a/docs/FORMAT.md b/docs/FORMAT.md index 854e599..f8feb51 100644 --- a/docs/FORMAT.md +++ b/docs/FORMAT.md @@ -181,7 +181,7 @@ an outcome; a code the server then refuses (its exit 10) is not seen by Custos, - Readers ignore members of an entry they do not know. A file whose `provision` has an `outcome`, `direction` or `store` this core does not know does not open (`Corrupted`), as for `signing`. -### The security member (core 0.12.0) +### The security member (core 0.12.0; hands-off values 0.13.0) ```json "security": { @@ -202,9 +202,9 @@ an outcome; a code the server then refuses (its exit 10) is not seen by Custos, | :-- | :-- | | `setup` | optional: the last Setup window, Unix milliseconds; `until` is 2 hours after `started` | | `finished` | optional: when that window ended, by *Finish setup*, or `until` once its expiry was noticed | -| `ticked` | the checklist items that are ticked: `totp-on-phone`, `hello-approvals`, `narrow-scope`, `rotate-setup`, `no-ssh`, `phone-approves` | +| `ticked` | the checklist items that are ticked: `totp-on-phone`, `hello-approvals`, `narrow-scope`, `rotate-setup`, `no-ssh`, `phone-approves`, and (core 0.13.0) `no-auto-connect`, `no-unattended`, `card-signing` | | `keptScope` | optional: the server scope prefixes *Narrow the server scope* replaced (`ask`, `offer`: at most 64 each, 1–200 characters, no control characters), kept for its undo | -| `audit` | `{at, action, item?, auth?}`; `action` is `setup-started`, `setup-finished`, `setup-expired`, `ticked`, `unticked`, `ssh-connected` or `totp-moved`; `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`) | +| `audit` | `{at, action, item?, auth?, detail?}`; `action` is `setup-started`, `setup-finished`, `setup-expired`, `ticked`, `unticked`, `ssh-connected`, `totp-moved`, or (core 0.13.0) `auto-connected`, `unattended-stored`, `setup-item-removed`, `unattended-signed`, `taken-over`; `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`); `detail` (core 0.13.0, the four notes) names what happened, never a value: 1–500 characters, no control characters | The **level** is computed, never stored: @@ -218,6 +218,15 @@ the first change after it, not by reading. - **Append-only** like `provision`: the API adds entries and lists them; the log keeps the newest 5 000. - Absent while nothing was ever set, so a vault without it is written exactly as before. +- The values new in core 0.13.0 make a vault unreadable for a core before 0.13.0 once one is written, as the + 0.12.0 values did before. +- **Hands-off rules** (core 0.13.0, `security`): `is_setup_run` (`setup-` and 1–58 of `[A-Za-z0-9._-]`), + `auto_connect_allowed` (not Hardened, neither `no-auto-connect` nor `no-ssh`), `setup_on_connect` (neither + `no-unattended` nor `no-ssh`), `unattended_provision` (in Setup, a setup run, `no-unattended` not ticked, never an + existing item: an `ask --generate` or an `offer` into `arca/`, `custos/`, `fabrica/`, `aula/`, `gitea/`, an offer + into the Claude Code store, a TOTP offer unless `totp-on-phone`; never `display`) and `unattended_sign` (a + machine-key vault, a request with a run, not Hardened, `card-signing` not ticked, the kinds `minisign`, + `manifest`, `authenticode`, `approval`). The app enforces them; the server never decides. - Readers ignore members they do not know. A file whose `security` has an item, action or auth this core does not know, a window whose `until` is not after `started`, `finished` without `setup`, or a kept scope that breaks the rules above does not open (`Corrupted`).