diff options
| author | tv <tv@krebsco.de> | 2026-11-07 22:35:21 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 22:35:21 +0100 |
| commit | 7fed3e4478ad28151fab288d569a1268c1f3e4cf (patch) | |
| tree | 1d406a10393b16b7f85295e14b855ca5ac7c741f /src/api/users.rs | |
| parent | 41657a4d749b1f1d44663ff6504f2e784f091537 (diff) | |
api: signed values at the store
PUT with application/continuum-signed writes an envelope where values
are signed (403/409 saying why); reads open envelopes and name the
signer (x-continuum-signed-by), ?raw=true shows them. Under strict,
unsigned writes reaching a signed value and the users API are 409.
Auth plan M7.
Diffstat (limited to 'src/api/users.rs')
| -rw-r--r-- | src/api/users.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/api/users.rs b/src/api/users.rs index 3b8174d..8972566 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -122,7 +122,7 @@ fn may_manage(state: &AppState, user: &str, access: &Access) -> Result<(), ApiEr /// A user's entry as the API shows it: as recorded, with its name. fn shown(doc: &impl crate::document::ReadDoc, name: &str) -> Option<JsonValue> { - let mut entry = store::read_path(doc, ®istry::user_path(name)).ok()??; + let mut entry = store::read_plain(doc, ®istry::user_path(name)).ok()??; if let Some(object) = entry.as_object_mut() { object.insert("name".to_owned(), json!(name)); } @@ -168,6 +168,16 @@ async fn change( let since = state.clock.now_millis().as_u64(); state .mutate_doc_for(Some(user.to_owned()), Sign::Protocol, move |doc| { + if crate::access::policy::of(&*doc).strict() { + return Err(ApiError( + StatusCode::CONFLICT, + Some( + "users sign their entries (strict policy): PUT each signed to \ + /store/_continuum/users/<name> (docs/access.md)" + .to_owned(), + ), + )); + } let before = Before::of(&*doc, &writer); f(doc, &by, since)?; registry_kept(&*doc, ®istry::users_dir(), before, &writer) |
