feat(manager-core): add authz module with can() / require()
Implements the three-layer capability check from blueprint §11.6: role grant (instance role + app_members) ∩ scope intersection (for API keys) ∩ app binding (for bound keys). Capabilities are finer than scopes (AppWriteScript vs AppWriteRoute, AppManageDomains vs AppAdmin) so a script:write-only key cannot mutate routes; scopes stay at the seven values the blueprint locks down. In-memory AuthzRepo fixture in the test module covers the full matrix: owner / admin / member behavior, scope intersection, bound key isolation, and instance:* denial on bound keys. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ pub mod auth;
|
||||
pub mod auth_api;
|
||||
pub mod auth_bootstrap;
|
||||
pub mod auth_middleware;
|
||||
pub mod authz;
|
||||
pub mod log_sink;
|
||||
pub mod migrations;
|
||||
pub mod repo;
|
||||
@@ -43,6 +44,7 @@ pub use auth_bootstrap::{
|
||||
bootstrap_first_admin, bootstrap_first_admin_with, BootstrapEnv, BootstrapError,
|
||||
};
|
||||
pub use auth_middleware::{require_admin, AuthState, AuthedAdmin, SESSION_COOKIE};
|
||||
pub use authz::{can, require, AuthzDenied, AuthzError, AuthzRepo, Capability, Decision};
|
||||
pub use log_sink::PostgresExecutionLogSink;
|
||||
pub use repo::{
|
||||
ExecutionLogRepository, NewScript, PostgresExecutionLogRepository, PostgresScriptRepository,
|
||||
|
||||
Reference in New Issue
Block a user