[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 <id> for <repo> pipeline
release'; the grant itself is a member older cores ignore.
This commit is contained in:
2026-11-21 09:06:35 +01:00
parent 6588461438
commit 0eee7632ae
7 changed files with 32 additions and 29 deletions
+1 -4
View File
@@ -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) });
+5 -3
View File
@@ -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=<Name>`, 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 <id> for <repo> 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<String, Error> {
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)
}
+4 -3
View File
@@ -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]