feat: environments and production-to-staging relations (auth M6b)
- environment (production/staging/development) on source orbits and on restore targets; an unlabelled target fails closed and a production target is refused - directed, versioned relations from a managed source orbit to a restore target: one active relation per pair, retargeting makes a new id and ends the old one - refusals name the rule: unknown or unlabelled source/target, not a managed capture profile, not restore-ready, application or engine mismatch, inactive Outpost, and a target whose identity matches a database captured as production in any snapshot - relations end in the same transaction when their target is relabelled production or an Outpost is revoked; usability is re-read live - refresh.run is granted per relation id in its own table (user or group, expiry), never global, never carried to a new version, and never accepted by the orbit gate - admin API under /api/v1/relations plus environment endpoints; people holding only a relation grant see names and environments, never identity, host, Outpost or application - Relations console; sign-in form without SSO no longer shows a stray "Details" label Tests extend the access matrix with relation fixtures and a caller that holds only a relation grant. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,12 @@ pub enum AuditAction {
|
||||
ExportReady,
|
||||
ExportFinished,
|
||||
ExportDisconnected,
|
||||
EnvironmentSet,
|
||||
RelationCreate,
|
||||
RelationRetarget,
|
||||
RelationDeactivate,
|
||||
RelationGrantCreate,
|
||||
RelationGrantDelete,
|
||||
}
|
||||
|
||||
impl AuditAction {
|
||||
@@ -63,6 +69,12 @@ impl AuditAction {
|
||||
Self::ExportReady => "export.ready",
|
||||
Self::ExportFinished => "export.finished",
|
||||
Self::ExportDisconnected => "export.disconnected",
|
||||
Self::EnvironmentSet => "environment.set",
|
||||
Self::RelationCreate => "relation.create",
|
||||
Self::RelationRetarget => "relation.retarget",
|
||||
Self::RelationDeactivate => "relation.deactivate",
|
||||
Self::RelationGrantCreate => "relation.grant_create",
|
||||
Self::RelationGrantDelete => "relation.grant_delete",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,6 +106,8 @@ pub enum AuditResource {
|
||||
Grant(Uuid),
|
||||
User(Uuid),
|
||||
Snapshot(Uuid),
|
||||
Relation(Uuid),
|
||||
RestoreTarget(Uuid),
|
||||
}
|
||||
|
||||
impl AuditResource {
|
||||
@@ -107,6 +121,8 @@ impl AuditResource {
|
||||
Self::Grant(id) => ("grant", Some(id.to_string())),
|
||||
Self::User(id) => ("user", Some(id.to_string())),
|
||||
Self::Snapshot(id) => ("snapshot", Some(id.to_string())),
|
||||
Self::Relation(id) => ("relation", Some(id.to_string())),
|
||||
Self::RestoreTarget(id) => ("restore_target", Some(id.to_string())),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +143,10 @@ pub enum Permission {
|
||||
SnapshotDelete,
|
||||
RecoveryManage,
|
||||
AccessManage,
|
||||
/// Configuring environments and relations. Administrators only.
|
||||
RelationManage,
|
||||
/// Refreshing a staging target. Never held through `access_grants`: it is granted per relation, in `relation_grants`.
|
||||
RefreshRun,
|
||||
}
|
||||
|
||||
impl Permission {
|
||||
@@ -142,13 +162,15 @@ impl Permission {
|
||||
Self::SnapshotDelete => "snapshot.delete",
|
||||
Self::RecoveryManage => "recovery.manage",
|
||||
Self::AccessManage => "access.manage",
|
||||
Self::RelationManage => "relation.manage",
|
||||
Self::RefreshRun => "refresh.run",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse(text: &str) -> Option<Self> {
|
||||
[
|
||||
Self::OrbitRead, Self::SnapshotRead, Self::CaptureRun, Self::SnapshotDownload, Self::OrbitManage,
|
||||
Self::OutpostManage, Self::RetentionManage, Self::SnapshotDelete, Self::RecoveryManage, Self::AccessManage,
|
||||
Self::OutpostManage, Self::RetentionManage, Self::SnapshotDelete, Self::RecoveryManage, Self::AccessManage, Self::RelationManage, Self::RefreshRun,
|
||||
]
|
||||
.into_iter()
|
||||
.find(|permission| permission.as_str() == text)
|
||||
|
||||
Reference in New Issue
Block a user