fix(manager-core): F-Q-005 preserve AuthzDenied::Repo through service-layer authz checks
Every check_read/check_write/check_publish helper across kv, docs, files, pubsub, queue services used `.map_err(|_| KvError::Forbidden)?`, collapsing AuthzDenied::Denied AND AuthzDenied::Repo(repo_err) into a single Forbidden. A transient Postgres blip during the membership lookup surfaced as 403 to scripts; operators couldn't distinguish "real forbidden" from "DB flap during permission check". Replace each call site with the explicit match pattern already used by users_service::require (users_service.rs:177-181): Ok(()) → continue Err(AuthzDenied::Denied) → Err(ServiceError::Forbidden) Err(AuthzDenied::Repo(e)) → Err(ServiceError::Backend(e.to_string())) 7 call sites updated (2 in kv_service, 2 in docs_service, 2 in files_service, 2 in pubsub_service, 1 in queue_service). AUDIT.md anchor: F-Q-005. Depends on F-Q-004 (which added Backend to QueueError/PubsubError). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,13 +59,17 @@ impl QueueService for QueueServiceImpl {
|
||||
// check (cx.principal is None); authenticated callers must hold
|
||||
// AppQueueEnqueue.
|
||||
if let Some(principal) = cx.principal.as_ref() {
|
||||
authz::require(
|
||||
match authz::require(
|
||||
&*self.authz,
|
||||
principal,
|
||||
Capability::AppQueueEnqueue(cx.app_id),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| QueueError::Forbidden)?;
|
||||
{
|
||||
Ok(()) => {}
|
||||
Err(authz::AuthzDenied::Denied) => return Err(QueueError::Forbidden),
|
||||
Err(authz::AuthzDenied::Repo(e)) => return Err(QueueError::Backend(e.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let deliver_after = opts
|
||||
|
||||
Reference in New Issue
Block a user