Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f84ac575bd | |||
| ff14c8902f |
Generated
+12
-12
@@ -329,14 +329,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-browser"
|
name = "custos-browser"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-gen"
|
name = "custos-gen"
|
||||||
version = "0.17.0"
|
version = "0.17.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.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"argon2",
|
"argon2",
|
||||||
@@ -369,7 +369,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-keys"
|
name = "custos-keys"
|
||||||
version = "0.17.0"
|
version = "0.17.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.17.0"
|
version = "0.17.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.17.0"
|
version = "0.17.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-seal"
|
name = "custos-seal"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chacha20poly1305",
|
"chacha20poly1305",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
@@ -409,7 +409,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-share"
|
name = "custos-share"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"chacha20poly1305",
|
"chacha20poly1305",
|
||||||
@@ -426,7 +426,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-sign"
|
name = "custos-sign"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2 0.10.6",
|
"blake2 0.10.6",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -445,7 +445,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-totp"
|
name = "custos-totp"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-vault",
|
"custos-vault",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -458,7 +458,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-vault"
|
name = "custos-vault"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"bip39",
|
"bip39",
|
||||||
@@ -482,7 +482,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-wasm"
|
name = "custos-wasm"
|
||||||
version = "0.17.0"
|
version = "0.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-qr",
|
"custos-qr",
|
||||||
"custos-seal",
|
"custos-seal",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "3"
|
|||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.17.0"
|
version = "0.17.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"
|
||||||
|
|||||||
@@ -430,8 +430,9 @@ pub fn sha256_hex(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
/// The largest approval text Custos reads (docs/SIGNING.md).
|
/// The largest approval text Custos reads (docs/SIGNING.md).
|
||||||
pub const MAX_APPROVAL: usize = 8 * 1024;
|
pub const MAX_APPROVAL: usize = 8 * 1024;
|
||||||
/// An approval expires at most this many seconds after it is checked.
|
/// An approval expires at most this many seconds after it is checked: 25 hours (a release's approval lives a day,
|
||||||
pub const APPROVAL_MAX_AHEAD: u64 = 3600;
|
/// and its card may wait for Mark that long; an hour before core 0.17.1).
|
||||||
|
pub const APPROVAL_MAX_AHEAD: u64 = 25 * 3600;
|
||||||
|
|
||||||
/// A deploy approval, read from its canonical JSON (docs/SIGNING.md, "approval"). Nothing in it is secret.
|
/// A deploy approval, read from its canonical JSON (docs/SIGNING.md, "approval"). Nothing in it is secret.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
|
||||||
@@ -520,15 +521,16 @@ fn unprintable(c: char) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Checks that `text` is a deploy approval in canonical form that has not expired at `now_secs` and expires at most
|
/// Checks that `text` is a deploy approval in canonical form that has not expired at `now_secs` and expires at most
|
||||||
/// an hour later (docs/SIGNING.md). It is parsed, written again in canonical form and compared byte for byte, so
|
/// 25 hours later ([`APPROVAL_MAX_AHEAD`], docs/SIGNING.md). It is parsed, written again in canonical form and
|
||||||
/// any other spelling of the same values (key order, spaces, escapes, a trailing newline) is refused.
|
/// compared byte for byte, so any other spelling of the same values (key order, spaces, escapes, a trailing newline)
|
||||||
|
/// is refused.
|
||||||
pub fn approval_check(text: &str, now_secs: u64) -> Result<Approval, Error> {
|
pub fn approval_check(text: &str, now_secs: u64) -> Result<Approval, Error> {
|
||||||
let a = approval_parse(text)?;
|
let a = approval_parse(text)?;
|
||||||
if a.expires <= now_secs {
|
if a.expires <= now_secs {
|
||||||
return Err(Error::Approval("it has expired"));
|
return Err(Error::Approval("it has expired"));
|
||||||
}
|
}
|
||||||
if a.expires > now_secs.saturating_add(APPROVAL_MAX_AHEAD) {
|
if a.expires > now_secs.saturating_add(APPROVAL_MAX_AHEAD) {
|
||||||
return Err(Error::Approval("it expires more than an hour from now"));
|
return Err(Error::Approval("it expires more than 25 hours from now"));
|
||||||
}
|
}
|
||||||
Ok(a)
|
Ok(a)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,11 +142,15 @@ fn targets_have_limits() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_expiry_is_after_now_and_within_an_hour() {
|
fn the_expiry_is_after_now_and_within_25_hours() {
|
||||||
let at = |exp: u64| with(&format!("\"expires\":{}", NOW + 600), &format!("\"expires\":{exp}"));
|
let at = |exp: u64| with(&format!("\"expires\":{}", NOW + 600), &format!("\"expires\":{exp}"));
|
||||||
assert!(approval_check(&at(NOW + 1), NOW).is_ok());
|
assert!(approval_check(&at(NOW + 1), NOW).is_ok());
|
||||||
assert!(approval_check(&at(NOW + 3600), NOW).is_ok());
|
assert!(approval_check(&at(NOW + 3600), NOW).is_ok());
|
||||||
for exp in [NOW, NOW - 1, 0, NOW + 3601, u64::MAX] {
|
// A release's approval lives a day, and its card may wait for Mark that long (core 0.17.1).
|
||||||
|
assert_eq!(APPROVAL_MAX_AHEAD, 25 * 3600);
|
||||||
|
assert!(approval_check(&at(NOW + 24 * 3600), NOW).is_ok());
|
||||||
|
assert!(approval_check(&at(NOW + 25 * 3600), NOW).is_ok());
|
||||||
|
for exp in [NOW, NOW - 1, 0, NOW + 25 * 3600 + 1, u64::MAX] {
|
||||||
let e = refused(&at(exp), NOW);
|
let e = refused(&at(exp), NOW);
|
||||||
assert!(e.contains("expire"), "{exp}: {e}");
|
assert!(e.contains("expire"), "{exp}: {e}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ impl Vault {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// [`Vault::signing_check`] at `now` (Unix milliseconds): an approval must not have expired then, and must
|
/// [`Vault::signing_check`] at `now` (Unix milliseconds): an approval must not have expired then, and must
|
||||||
/// expire at most an hour later.
|
/// expire at most 25 hours later (`custos_sign::APPROVAL_MAX_AHEAD`).
|
||||||
pub fn signing_check_at(&self, req: &Request, now: i64) -> Result<KeyView, Refusal> {
|
pub fn signing_check_at(&self, req: &Request, now: i64) -> Result<KeyView, Refusal> {
|
||||||
self.check(req, now).map(|(view, _)| view)
|
self.check(req, now).map(|(view, _)| view)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,8 +322,12 @@ fn an_approval_needs_its_run_a_canonical_unexpired_text_and_a_matching_context()
|
|||||||
spaced.approval = Some(spaced.approval.unwrap().replace(',', ", "));
|
spaced.approval = Some(spaced.approval.unwrap().replace(',', ", "));
|
||||||
invalid(&mut v, &spaced);
|
invalid(&mut v, &spaced);
|
||||||
let mut late = approval_req("r-42");
|
let mut late = approval_req("r-42");
|
||||||
late.approval = Some(approval_text("r-42", "Arca", 3601));
|
late.approval = Some(approval_text("r-42", "Arca", 25 * 3600 + 1));
|
||||||
invalid(&mut v, &late);
|
invalid(&mut v, &late);
|
||||||
|
// A day ahead is fine (core 0.17.1): a release's approval lives that long.
|
||||||
|
let mut day = approval_req("r-42");
|
||||||
|
day.approval = Some(approval_text("r-42", "Arca", 24 * 3600));
|
||||||
|
assert!(v.signing_check_at(&day, NOW).is_ok());
|
||||||
let mut past = approval_req("r-42");
|
let mut past = approval_req("r-42");
|
||||||
past.approval = Some(approval_text("r-42", "Arca", 0));
|
past.approval = Some(approval_text("r-42", "Arca", 0));
|
||||||
invalid(&mut v, &past);
|
invalid(&mut v, &past);
|
||||||
|
|||||||
+2
-2
@@ -140,7 +140,7 @@ exactly this order:
|
|||||||
| `repo`, `pipeline`, `version` | 1–64 of `[A-Za-z0-9._+-]` |
|
| `repo`, `pipeline`, `version` | 1–64 of `[A-Za-z0-9._+-]` |
|
||||||
| `commit` | 40 lower-case hex digits |
|
| `commit` | 40 lower-case hex digits |
|
||||||
| `targets` | 1–16 strings of 1–80 characters (Unicode scalar values); no control characters, and none of the invisible ones that change how a line looks on the card (U+00AD, U+061C, U+180E, U+200B–U+200F, U+2028–U+202E, U+2060–U+2069, U+FEFF) |
|
| `targets` | 1–16 strings of 1–80 characters (Unicode scalar values); no control characters, and none of the invisible ones that change how a line looks on the card (U+00AD, U+061C, U+180E, U+200B–U+200F, U+2028–U+202E, U+2060–U+2069, U+FEFF) |
|
||||||
| `expires` | Unix seconds, later than now and at most 3 600 s after now (checked before the card and again when signing) |
|
| `expires` | Unix seconds, later than now and at most 90 000 s (25 hours) after now (checked before the card and again when signing). Before core 0.17.1 the limit was 3 600 s; a release's approval now lives a day, so its card can wait for Mark that long |
|
||||||
|
|
||||||
Strings use JSON's minimal escaping: a quote is written `\"`, a backslash `\\`, every other character as
|
Strings use JSON's minimal escaping: a quote is written `\"`, a backslash `\\`, every other character as
|
||||||
itself (no `\u` escapes, no `\/`; control characters cannot occur). There is no newline at the end. Custos
|
itself (no `\u` escapes, no `\/`; control characters cannot occur). There is no newline at the end. Custos
|
||||||
@@ -251,7 +251,7 @@ one entry, whatever happened:
|
|||||||
| `standing` | (core 0.16.0) a standing approval fitted; signed without asking |
|
| `standing` | (core 0.16.0) a standing approval fitted; signed without asking |
|
||||||
| `auto` | a test key; signed without asking |
|
| `auto` | a test key; signed without asking |
|
||||||
| `refused` | Mark refused |
|
| `refused` | Mark refused |
|
||||||
| `expired` | nobody answered within 5 minutes |
|
| `expired` | nobody answered before the card's wait ran out (the app's wait: 24 hours since Custos 0.17.0, 5 minutes before), or the requester withdrew it |
|
||||||
| `out-of-scope` | the pipeline or repo is not on the key's lists (whether or not it was approved) |
|
| `out-of-scope` | the pipeline or repo is not on the key's lists (whether or not it was approved) |
|
||||||
| `invalid` | the request was malformed (wrong digest length, a manifest or approval not in canonical form, an expired approval, a kind the key cannot do) |
|
| `invalid` | the request was malformed (wrong digest length, a manifest or approval not in canonical form, an expired approval, a kind the key cannot do) |
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user