Expand description
§Chronix Authz — Cedar-based Authorization
Fine-grained authorization for the Chronix time-series database using the Cedar policy language (formally verified, pure Rust).
§Architecture
Request → AuthMiddleware → AuthContext
│
▼
AuthzEngine (Cedar)
├── PolicySet (hot-reloadable)
├── Entities (principal, resource, roles)
└── Decision: Allow | Deny { reasons }§Policy Model
- Principals:
Chronix::User, with role membership viaChronix::Role - Resources:
Chronix::Namespacefor data,Chronix::Systemfor administration — the two thingschronixdasks about, and nothing else - Actions:
Read,Write,Deleteon a namespace; the capabilities in theAdmingroup on the system
The model is compiled in as a Cedar schema (engine::SCHEMA_SRC)
and every policy is validated against it, so a rule naming something
this server never asks about is refused at load rather than accepted and
never consulted.
§Default-Deny
If no policy explicitly permits a request, it is denied. Use forbid
policies to create hard denials that override permissive policies.
§Example
use chronix_security::authz::{
AuthzEngine, ChronixAction, ChronixNamespace, ChronixPrincipal,
};
let engine = AuthzEngine::new();
engine.load_policies(r#"
permit(
principal in Chronix::Role::"operator",
action in [Chronix::Action::"Read", Chronix::Action::"Write"],
resource == Chronix::Namespace::"production"
);
"#).unwrap();
let operator = ChronixPrincipal::new("alice").with_role("operator");
let production = ChronixNamespace::new("production");
assert!(engine
.authorize_namespace(&operator, ChronixAction::Write, &production)
.is_allowed());
assert!(engine
.authorize_namespace(&operator, ChronixAction::Delete, &production)
.is_denied());Re-exports§
pub use error::AuthzError;
Modules§
- error
- Error types for the Chronix authorization system.
Structs§
- Authz
Engine - The Cedar-based authorization engine.
- Chronix
Namespace - A Chronix namespace — the resource of every data-plane decision.
- Chronix
Principal - A Chronix principal (authenticated identity).
- Chronix
System - The server itself — the resource of every administrative decision.
Enums§
- Chronix
Action - An action
chronixdasks about. - Decision
- The result of an authorization decision.
Constants§
- SCHEMA_
SRC - The Chronix Cedar schema, compiled into the binary.
Functions§
- schema_
action_ names - The action names the schema declares, group included.