From 0eee7632ae26b21f0bf5efbe152495050db212ad Mon Sep 17 00:00:00 2001 From: mnovak Date: Sat, 21 Nov 2026 09:06:35 +0100 Subject: [PATCH] [vault] Signing: a key the Android grant makes is standing-granted, a value older cores read; v0.19.1 0.19.0 wrote a new security action, android-key-made, which every older core refuses. The phone app and the web vault open the same vault with their own pinned core, so a vault in which the grant made a key would stop opening there. The key's creation is now standing-granted with 'Android grant made for pipeline release'; the grant itself is a member older cores ignore. --- Cargo.lock | 26 +++++++++++----------- Cargo.toml | 2 +- crates/custos-vault/src/security.rs | 5 +---- crates/custos-vault/src/signing.rs | 8 ++++--- crates/custos-vault/tests/android_grant.rs | 7 +++--- docs/FORMAT.md | 7 +++--- docs/SIGNING.md | 6 +++-- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f3ac9e..2ca63ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,14 +329,14 @@ dependencies = [ [[package]] name = "custos-browser" -version = "0.19.0" +version = "0.19.1" dependencies = [ "zeroize", ] [[package]] name = "custos-gen" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-vault", "data-encoding", @@ -348,7 +348,7 @@ dependencies = [ [[package]] name = "custos-kdbx" -version = "0.19.0" +version = "0.19.1" dependencies = [ "aes", "argon2", @@ -369,7 +369,7 @@ dependencies = [ [[package]] name = "custos-keys" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-vault", "ed25519-dalek", @@ -382,7 +382,7 @@ dependencies = [ [[package]] name = "custos-native" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-browser", "serde_json", @@ -392,11 +392,11 @@ dependencies = [ [[package]] name = "custos-qr" -version = "0.19.0" +version = "0.19.1" [[package]] name = "custos-seal" -version = "0.19.0" +version = "0.19.1" dependencies = [ "chacha20poly1305", "hkdf", @@ -409,7 +409,7 @@ dependencies = [ [[package]] name = "custos-share" -version = "0.19.0" +version = "0.19.1" dependencies = [ "argon2", "chacha20poly1305", @@ -426,7 +426,7 @@ dependencies = [ [[package]] name = "custos-sign" -version = "0.19.0" +version = "0.19.1" dependencies = [ "blake2 0.10.6", "data-encoding", @@ -446,7 +446,7 @@ dependencies = [ [[package]] name = "custos-team" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-seal", "custos-sign", @@ -464,7 +464,7 @@ dependencies = [ [[package]] name = "custos-totp" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-vault", "data-encoding", @@ -477,7 +477,7 @@ dependencies = [ [[package]] name = "custos-vault" -version = "0.19.0" +version = "0.19.1" dependencies = [ "argon2", "bip39", @@ -503,7 +503,7 @@ dependencies = [ [[package]] name = "custos-wasm" -version = "0.19.0" +version = "0.19.1" dependencies = [ "custos-qr", "custos-seal", diff --git a/Cargo.toml b/Cargo.toml index e56f242..974d623 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.19.0" +version = "0.19.1" edition = "2024" license = "MPL-2.0" repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic" diff --git a/crates/custos-vault/src/security.rs b/crates/custos-vault/src/security.rs index 34636ed..ed3c583 100644 --- a/crates/custos-vault/src/security.rs +++ b/crates/custos-vault/src/security.rs @@ -90,9 +90,6 @@ pub enum Action { /// The vault was opened with its recovery key: every factor and the key were replaced (`detail`: the used /// key's id). Written by [`Vault::recover`] only. Recovered, - /// The Android grant made an app's key (core 0.19.0; `detail`: the key's id, its repository and pipeline). - /// Written by [`Vault::android_grant_make_key`] only. - AndroidKeyMade, } /// What *Connect via SSH* needs. @@ -255,7 +252,7 @@ impl State { /// `standing-granted` or `standing-revoked`, with the rule as its detail (cut to what a note may hold). pub(crate) fn standing_note(&mut self, action: Action, detail: &str, now: i64) { - debug_assert!(matches!(action, Action::StandingGranted | Action::StandingRevoked | Action::AndroidKeyMade)); + debug_assert!(matches!(action, Action::StandingGranted | Action::StandingRevoked)); let detail: String = detail.chars().filter(|c| !c.is_control()).take(500).collect(); self.notice_expiry(now); self.audit.push(SecurityEntry { at: now, action, item: None, auth: None, detail: Some(detail) }); diff --git a/crates/custos-vault/src/signing.rs b/crates/custos-vault/src/signing.rs index 0384adf..02b995f 100644 --- a/crates/custos-vault/src/signing.rs +++ b/crates/custos-vault/src/signing.rs @@ -1272,7 +1272,9 @@ impl Vault { /// Makes `repo`'s app key under the Android grant, when its first release asks (`custos-sign apk`): the grant /// covers `repo`, `pipeline` is `release`, `via` is local, *Sign only with a card* is not ticked, and there is /// no key under that id. RSA-4096, `CN=`, the grant's O and C, scoped to exactly `repo` and `release`. - /// Writes `android-key-made`. The caller saves. Slow: one RSA-4096 key. + /// Writes `standing-granted` with `Android grant made for pipeline release`: a value every core since + /// 0.16.0 reads, so the phone and the web vault still open the vault (core 0.19.1). The caller saves. Slow: one + /// RSA-4096 key. pub fn android_grant_make_key(&mut self, repo: &str, pipeline: &str, via: Via, now: i64) -> Result { let no = |why: String| Err(Error::Signing(why)); let Some(g) = self.signing.android.clone() else { return no("there is no Android grant".into()) }; @@ -1314,8 +1316,8 @@ impl Vault { { g.made.push(id.clone()); } - let words = format!("{id} for {repo} pipeline {ANDROID_PIPELINE}"); - self.security.standing_note(crate::security::Action::AndroidKeyMade, &words, now); + let words = format!("Android grant made {id} for {repo} pipeline {ANDROID_PIPELINE}"); + self.security.standing_note(crate::security::Action::StandingGranted, &words, now); Ok(id) } diff --git a/crates/custos-vault/tests/android_grant.rs b/crates/custos-vault/tests/android_grant.rs index 2bb5055..6a11ef8 100644 --- a/crates/custos-vault/tests/android_grant.rs +++ b/crates/custos-vault/tests/android_grant.rs @@ -100,12 +100,13 @@ fn the_grant_makes_an_apps_key_and_signs_its_first_apk_without_a_card() { let g = v.android_grant().unwrap(); assert_eq!((g.uses, g.last_used, g.made.clone()), (2, Some(NOW + 3), s(&["culina-android"]))); - assert_eq!(notes(&v, Action::AndroidKeyMade), ["culina-android for mnovak/Culina pipeline release"]); + // Granting, then the key it made: both `standing-granted`, a value cores since 0.16.0 read (core 0.19.1). let granted_note = notes(&v, Action::StandingGranted); - assert_eq!(granted_note.len(), 1); + assert_eq!(granted_note.len(), 2, "{granted_note:?}"); assert!(granted_note[0].contains("Android releases") && granted_note[0].contains("mnovak/*"), "{granted_note:?}"); + assert_eq!(granted_note[1], "Android grant made culina-android for mnovak/Culina pipeline release"); // The public note call cannot write it. - assert!(v.security_note(Action::AndroidKeyMade, "x", NOW).is_err()); + assert!(v.security_note(Action::StandingGranted, "x", NOW).is_err()); } #[test] diff --git a/docs/FORMAT.md b/docs/FORMAT.md index 4e46719..4b1e369 100644 --- a/docs/FORMAT.md +++ b/docs/FORMAT.md @@ -150,8 +150,9 @@ core before 0.14.0. Core 0.16.0 adds the `signing` audit outcome `standing` and `standing-granted` and `standing-revoked` (docs/SIGNING.md, "Standing approvals"): a vault in which a standing approval was ever granted does not open in a core before 0.16.0. The rules themselves (`signing.standing`) are a member older cores ignore and drop. Core 0.19.0 adds the member `signing.android` (the Android grant, docs/SIGNING.md "The Android -grant"), which older cores ignore and drop (the grant is lost, never widened), and the `security` action -`android-key-made`: a vault in which the grant made a key does not open in a core before 0.19.0. +grant"), which older cores ignore and drop (the grant is lost, never widened). It adds no closed-list value: +a key the grant makes is `standing-granted` in the security audit (core 0.19.1), so a vault with the grant still +opens in every core since 0.16.0, as the phone app and the web vault may be. ### The provision audit (core 0.11.0) @@ -215,7 +216,7 @@ an outcome; a code the server then refuses (its exit 10) is not seen by Custos, | `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`, 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?, 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`, or (core 0.16.0) `standing-granted`, `standing-revoked` (also for the Android grant), or (core 0.19.0) `android-key-made`, or (core 0.17.0) `recovery-created`, `recovery-removed`, `recovered` (docs/FACTORS.md, "The recovery key"; their `detail` is the key's id); `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`); `detail` (core 0.13.0, the four notes; core 0.16.0, the two standing actions) names what happened, never a value: 1–500 characters, no control characters | +| `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`, or (core 0.16.0) `standing-granted`, `standing-revoked` (also for the Android grant and the keys it makes), or (core 0.17.0) `recovery-created`, `recovery-removed`, `recovered` (docs/FACTORS.md, "The recovery key"; their `detail` is the key's id); `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`); `detail` (core 0.13.0, the four notes; core 0.16.0, the two standing actions) names what happened, never a value: 1–500 characters, no control characters | The **level** is computed, never stored: diff --git a/docs/SIGNING.md b/docs/SIGNING.md index 23fdb9c..74609f3 100644 --- a/docs/SIGNING.md +++ b/docs/SIGNING.md @@ -288,8 +288,10 @@ and counts the use on whichever fitted. pipeline is `release`, `via` is `local`, `card-signing` is not ticked, and the vault has no key under that id. It makes the RSA-4096 key with the certificate `CN=` (the repository's name, first letter upper case), `O` and `C` from the grant, named ` Android`, scoped to exactly that repository and `release`, adds the id to `made`, and -writes `android-key-made` to the security audit (` for pipeline release`). It is a key like any other: -not exportable, removed only as any key is. +writes `standing-granted` to the security audit (`Android grant made for pipeline release`). Core 0.19.0 +wrote a new action, `android-key-made`, which older cores refuse; 0.19.1 keeps to the values every core since 0.16.0 +reads, because the phone app and the web vault open the same vault. It is a key like any other: not exportable, +removed only as any key is. **Granting** (`android_grant_set(repos, o, c, now)`) stores or replaces the grant (the counts and `made` stay) and writes `standing-granted` with `Android releases: pipeline release, keys made on first use`. It is -- 2.53.0