aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/sealed.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-09 04:44:36 +0000
committertv <tv@krebsco.de>2026-11-09 05:48:12 +0100
commit97a69e09021244e994602ac5038b4bd7bc16ba78 (patch)
treea3a570b2620e4c370630d94987f98cde0210d1a4 /src/access/sealed.rs
parentc04bbc8781b69fd3aee59c1ee03c37dd4a1403cf (diff)
access: `*` for any one key in a capability's path
A capability's path covered by prefix only, so what is the same at every key of a map (each node's log filter, say, at `_continuum/local/<id>/log` from the next patch on) took a capability per key. Now a `*` segment stands for any one key, as it already does in signed paths and sealed places (`envelope`, `sealed`, which now share one `agree`): * covering (`Capability::covers`): the pattern no longer than the path, and agreeing with it segment by segment; * listings (`reaches`): pattern and path agreeing on the segments both have, so every key on the way shows, nothing past where the pattern differs; * narrowing (`Capability::holds`, for a token's limit narrowed again and a refresh's): at or below, a `*` only under a `*`: a limit naming one key never widens to all. A `*` first is outside protocol data, so it never covers `_continuum`, as `[]` doesn't. A key that is `*` itself can't be named alone. Every node judges changes by capabilities, so all must read them alike: they run the same version.
Diffstat (limited to 'src/access/sealed.rs')
-rw-r--r--src/access/sealed.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/access/sealed.rs b/src/access/sealed.rs
index ed5024c..7e48e34 100644
--- a/src/access/sealed.rs
+++ b/src/access/sealed.rs
@@ -24,7 +24,7 @@ use base64::{
use serde_json::Value as JsonValue;
use sha2::{Digest, Sha256};
-use super::{envelope, registry, sshsig};
+use super::{agree, envelope, registry, sshsig};
use crate::document::{ReadDoc, meta, store};
/// What every sealed value starts with.
@@ -90,13 +90,6 @@ fn reaches(declared: &[Declared], path: &[String]) -> bool {
declared.iter().any(|declared| agree(&declared.path, path))
}
-fn agree(pattern: &[String], path: &[String]) -> bool {
- pattern
- .iter()
- .zip(path)
- .all(|(segment, key)| segment == "*" || segment == key)
-}
-
/// How an age file names `key` as a recipient: the first four bytes of the SHA-256 of
/// its SSH encoding, base64, unpadded.
pub(crate) fn tag(key: &sshsig::PublicKey) -> String {