Compare commits

..

1 Commits

Author SHA1 Message Date
mnovak 0eee7632ae [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.
2026-11-21 09:06:35 +01:00
7 changed files with 32 additions and 29 deletions
Generated
+13 -13
View File
@@ -329,14 +329,14 @@ dependencies = [
[[package]] [[package]]
name = "custos-browser" name = "custos-browser"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"zeroize", "zeroize",
] ]
[[package]] [[package]]
name = "custos-gen" name = "custos-gen"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-vault", "custos-vault",
"data-encoding", "data-encoding",
@@ -348,7 +348,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-kdbx" name = "custos-kdbx"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"aes", "aes",
"argon2", "argon2",
@@ -369,7 +369,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-keys" name = "custos-keys"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-vault", "custos-vault",
"ed25519-dalek", "ed25519-dalek",
@@ -382,7 +382,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-native" name = "custos-native"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-browser", "custos-browser",
"serde_json", "serde_json",
@@ -392,11 +392,11 @@ dependencies = [
[[package]] [[package]]
name = "custos-qr" name = "custos-qr"
version = "0.19.0" version = "0.19.1"
[[package]] [[package]]
name = "custos-seal" name = "custos-seal"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"chacha20poly1305", "chacha20poly1305",
"hkdf", "hkdf",
@@ -409,7 +409,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-share" name = "custos-share"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"argon2", "argon2",
"chacha20poly1305", "chacha20poly1305",
@@ -426,7 +426,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-sign" name = "custos-sign"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"blake2 0.10.6", "blake2 0.10.6",
"data-encoding", "data-encoding",
@@ -446,7 +446,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-team" name = "custos-team"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-seal", "custos-seal",
"custos-sign", "custos-sign",
@@ -464,7 +464,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-totp" name = "custos-totp"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-vault", "custos-vault",
"data-encoding", "data-encoding",
@@ -477,7 +477,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-vault" name = "custos-vault"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"argon2", "argon2",
"bip39", "bip39",
@@ -503,7 +503,7 @@ dependencies = [
[[package]] [[package]]
name = "custos-wasm" name = "custos-wasm"
version = "0.19.0" version = "0.19.1"
dependencies = [ dependencies = [
"custos-qr", "custos-qr",
"custos-seal", "custos-seal",
+1 -1
View File
@@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/*"] members = ["crates/*"]
[workspace.package] [workspace.package]
version = "0.19.0" version = "0.19.1"
edition = "2024" edition = "2024"
license = "MPL-2.0" license = "MPL-2.0"
repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic" repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic"
+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 /// 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. /// key's id). Written by [`Vault::recover`] only.
Recovered, 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. /// 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). /// `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) { 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(); let detail: String = detail.chars().filter(|c| !c.is_control()).take(500).collect();
self.notice_expiry(now); self.notice_expiry(now);
self.audit.push(SecurityEntry { at: now, action, item: None, auth: None, detail: Some(detail) }); 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 /// 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 /// 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`. /// 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> { 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 no = |why: String| Err(Error::Signing(why));
let Some(g) = self.signing.android.clone() else { return no("there is no Android grant".into()) }; 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()); g.made.push(id.clone());
} }
let words = format!("{id} for {repo} pipeline {ANDROID_PIPELINE}"); let words = format!("Android grant made {id} for {repo} pipeline {ANDROID_PIPELINE}");
self.security.standing_note(crate::security::Action::AndroidKeyMade, &words, now); self.security.standing_note(crate::security::Action::StandingGranted, &words, now);
Ok(id) 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(); 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!((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); 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!(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. // 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] #[test]
+4 -3
View File
@@ -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 `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 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 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 grant"), which older cores ignore and drop (the grant is lost, never widened). It adds no closed-list value:
`android-key-made`: a vault in which the grant made a key does not open in a core before 0.19.0. 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) ### 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 | | `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` | | `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 | | `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: The **level** is computed, never stored:
+4 -2
View File
@@ -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 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=<Name>` (the repository's name, first letter upper case), `O` and `C` makes the RSA-4096 key with the certificate `CN=<Name>` (the repository's name, first letter upper case), `O` and `C`
from the grant, named `<Name> Android`, scoped to exactly that repository and `release`, adds the id to `made`, and from the grant, named `<Name> Android`, scoped to exactly that repository and `release`, adds the id to `made`, and
writes `android-key-made` to the security audit (`<id> for <repo> pipeline release`). It is a key like any other: writes `standing-granted` to the security audit (`Android grant made <id> for <repo> pipeline release`). Core 0.19.0
not exportable, removed only as any key is. 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 **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: <patterns> pipeline release, keys made on first use`. It is writes `standing-granted` with `Android releases: <patterns> pipeline release, keys made on first use`. It is