From 97a69e09021244e994602ac5038b4bd7bc16ba78 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2026 04:44:36 +0000 Subject: 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//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. --- src/access/envelope.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/access/envelope.rs') diff --git a/src/access/envelope.rs b/src/access/envelope.rs index e99a06e..5b1b368 100644 --- a/src/access/envelope.rs +++ b/src/access/envelope.rs @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; use sha2::{Digest, Sha256}; -use super::{Right, registry, sshsig}; +use super::{Right, agree, registry, sshsig}; use crate::document::{ReadDoc, meta, store}; /// What a signature over a payload is for (`sshsig`). @@ -97,14 +97,6 @@ pub(crate) fn reaches_signed(signed: &[Vec], path: &[String]) -> bool { signed.iter().any(|pattern| agree(pattern, path)) } -/// Whether `pattern` and `path` agree as far as both go (`*`: any key). -fn agree(pattern: &[String], path: &[String]) -> bool { - pattern - .iter() - .zip(path) - .all(|(segment, key)| segment == "*" || segment == key) -} - /// A signed value's payload. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub(crate) struct Payload { -- cgit v1.3.1