From fef9cfadf4df19fda4b946803bcc3ff1e3744935 Mon Sep 17 00:00:00 2001 From: "Christian M. Todie" Date: Mon, 26 Oct 2026 21:04:39 -0400 Subject: [PATCH] feat(idp-domain): add co-founder Sovereign Roots pgray and mmasterson Operator ruling 2026-10-26: Patrick Gray (pgray) and Mark Masterson (mmasterson, madmax983) become Sovereign Roots alongside ctodie and ahackley. SOVEREIGN_ROOT_EMAILS and SOVEREIGN_ROOT_GITHUBS hold the set, and is_sovereign_root_email / is_sovereign_root_github read it. The existing single-root constants stay exported, so dependents do not break. Effect: the directory validator accepts admin: super for them, the reconciler and lifecycle guards refuse to suspend, demote or offboard them, and an estate:superuser token whose sub is one of them resolves to Principal::Superuser. Spec 0004 and the introspection doc comment said only ctodie could; the code already admitted ahackley, so both now name the set. Test: the root-set test fails on the old code (pgray rejected) and passes now; rvita and an outsider stay outside the set. --- CHANGELOG.md | 1 + crates/idp-domain/src/dcr.rs | 6 +-- crates/idp-domain/src/lib.rs | 4 +- crates/idp-domain/src/principal.rs | 55 ++++++++++++++++++---- crates/idp/src/directory.rs | 14 +++--- crates/idp/src/lib.rs | 4 +- specs/0004-ory-hydra-dcr-agent-identity.md | 2 +- 7 files changed, 64 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba69dd7..8980ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `SOVEREIGN_ROOT_EMAILS` and `SOVEREIGN_ROOT_GITHUBS` in `idp-domain::principal`: the Sovereign Root set now holds `ctodie`, `ahackley`, and the co-founders `pgray` and `mmasterson` (`madmax983`), by operator ruling 2026-10-26. `is_sovereign_root_email` and `is_sovereign_root_github` read the set. The existing single-root constants stay exported. - Extracted pure Wave-0 domain leaf crate `idp-domain` (`principal`, `security`, `manifest`) enforcing zero runtime I/O (`cargo xtask zero-io-domain`). - Extracted multi-plane identity primitives into `idp`: - `directory`: Declarative `directory/` models (`users.yaml`, `groups/*.yaml`, `orgunits.yaml`, `licenses.yaml`, `access-matrix.yaml`), schema validators, and byte-preserving `held_exceptions` YAML editor (`hold_text`, `unhold_text`). diff --git a/crates/idp-domain/src/dcr.rs b/crates/idp-domain/src/dcr.rs index 3d60399..dd0eb36 100644 --- a/crates/idp-domain/src/dcr.rs +++ b/crates/idp-domain/src/dcr.rs @@ -1026,10 +1026,10 @@ impl IntrospectedOAuth2Token { /// # Lattice Rules /// 1. Inactive tokens (`!active`), expired tokens (`exp <= now_epoch`), or not-yet-valid tokens /// (`nbf > now_epoch`) evaluate to [`Principal::Denied`]. - /// 2. Any token carrying the `"estate:superuser"` scope whose `sub` is NOT - /// [`SOLE_SUPERADMIN_EMAIL`] (`ctodie@cerebral.work`) is rejected as [`Principal::Denied`] + /// 2. Any token carrying the `"estate:superuser"` scope whose `sub` is NOT a Sovereign Root + /// ([`crate::principal::SOVEREIGN_ROOT_EMAILS`]) is rejected as [`Principal::Denied`] /// (Sovereign Root invariant). - /// 3. When `sub` equals [`SOLE_SUPERADMIN_EMAIL`] and scopes contain `"estate:superuser"`, + /// 3. When `sub` is a Sovereign Root and scopes contain `"estate:superuser"`, /// evaluates to [`Principal::Superuser`]. /// 4. Active tokens with zero scopes evaluate to [`Principal::Unscoped`]; active tokens with /// non-empty scopes evaluate to [`Principal::Scoped`]. diff --git a/crates/idp-domain/src/lib.rs b/crates/idp-domain/src/lib.rs index e245642..5fb25fe 100644 --- a/crates/idp-domain/src/lib.rs +++ b/crates/idp-domain/src/lib.rs @@ -31,8 +31,8 @@ pub use manifest::{AppManifest, ConversionResponse, HookAttributes}; pub use principal::{ CapabilityEnvelope, DELEGATED_SOVEREIGN_ROOT_EMAIL, DELEGATED_SOVEREIGN_ROOT_GITHUB, GroupDecision, PROHIBITED_SENSITIVE_PATHS, Principal, SOLE_SUPERADMIN_EMAIL, - SOLE_SUPERADMIN_GITHUB, SubjectMatterMesh, is_sovereign_root_email, is_sovereign_root_github, - reconcile_group_decisions, + SOLE_SUPERADMIN_GITHUB, SOVEREIGN_ROOT_EMAILS, SOVEREIGN_ROOT_GITHUBS, SubjectMatterMesh, + is_sovereign_root_email, is_sovereign_root_github, reconcile_group_decisions, }; pub use reconciler::{ GroupRecord, HeldException, LicenseRecord, LiveGroup, LiveUser, OrgUnitRecord, ReconcilePlan, diff --git a/crates/idp-domain/src/principal.rs b/crates/idp-domain/src/principal.rs index b30491c..dd5f8ac 100644 --- a/crates/idp-domain/src/principal.rs +++ b/crates/idp-domain/src/principal.rs @@ -21,20 +21,37 @@ pub const DELEGATED_SOVEREIGN_ROOT_EMAIL: &str = "ahackley@cerebral.work"; /// Delegated Sovereign Root co-custodian GitHub login (lowercase for case-insensitive matching). pub const DELEGATED_SOVEREIGN_ROOT_GITHUB: &str = "lordvoid"; -/// Returns true if `email` is either the Primary Sovereign Root (`ctodie@cerebral.work`) -/// or the Delegated Sovereign Root (`ahackley@cerebral.work`). +/// Every Sovereign Root email: the Primary, the Delegated, and the co-founder roots +/// Patrick Gray and Mark Masterson (operator ruling 2026-10-26). +pub const SOVEREIGN_ROOT_EMAILS: &[&str] = &[ + SOLE_SUPERADMIN_EMAIL, + DELEGATED_SOVEREIGN_ROOT_EMAIL, + "pgray@cerebral.work", + "mmasterson@cerebral.work", +]; + +/// Every Sovereign Root GitHub login, lowercase, in the same order as [`SOVEREIGN_ROOT_EMAILS`]. +pub const SOVEREIGN_ROOT_GITHUBS: &[&str] = &[ + SOLE_SUPERADMIN_GITHUB, + DELEGATED_SOVEREIGN_ROOT_GITHUB, + "pgray", + "madmax983", +]; + +/// Returns true if `email` is one of [`SOVEREIGN_ROOT_EMAILS`]. pub fn is_sovereign_root_email(email: &str) -> bool { let trimmed = email.trim(); - trimmed.eq_ignore_ascii_case(SOLE_SUPERADMIN_EMAIL) - || trimmed.eq_ignore_ascii_case(DELEGATED_SOVEREIGN_ROOT_EMAIL) + SOVEREIGN_ROOT_EMAILS + .iter() + .any(|root| trimmed.eq_ignore_ascii_case(root)) } -/// Returns true if `login` is either the Primary Sovereign Root (`todie`) -/// or the Delegated Sovereign Root (`lordvoid`). +/// Returns true if `login` is one of [`SOVEREIGN_ROOT_GITHUBS`]. pub fn is_sovereign_root_github(login: &str) -> bool { let trimmed = login.trim(); - trimmed.eq_ignore_ascii_case(SOLE_SUPERADMIN_GITHUB) - || trimmed.eq_ignore_ascii_case(DELEGATED_SOVEREIGN_ROOT_GITHUB) + SOVEREIGN_ROOT_GITHUBS + .iter() + .any(|root| trimmed.eq_ignore_ascii_case(root)) } /// Paths in `cerebral-work/identity` that Clockwork Elves are never permitted to modify. @@ -276,6 +293,28 @@ mod tests { Principal::for_human("intruder@cerebral.work", false, true, scopes.clone()), Principal::Denied ); + + // Co-founder Sovereign Roots (operator ruling 2026-10-26), and a negative control: + // a live Super Admin outside the root set must stay outside it. + for root in ["pgray@cerebral.work", "mmasterson@cerebral.work"] { + assert!( + is_sovereign_root_email(root), + "{root} must be a sovereign root" + ); + } + for login in ["pgray", "madmax983", "MadMax983"] { + assert!( + is_sovereign_root_github(login), + "{login} must be a sovereign root login" + ); + } + for outsider in ["rvita@cerebral.work", "intruder@cerebral.work"] { + assert!( + !is_sovereign_root_email(outsider), + "{outsider} must not be a sovereign root" + ); + } + assert!(!is_sovereign_root_github("rvita-byte")); assert_eq!( Principal::for_admin_tier( "ahackley@cerebral.work", diff --git a/crates/idp/src/directory.rs b/crates/idp/src/directory.rs index cd92ffe..372b1f8 100644 --- a/crates/idp/src/directory.rs +++ b/crates/idp/src/directory.rs @@ -10,7 +10,7 @@ use crate::error::IdpError; use crate::planes::{all_declared, disjoint_planes_check, unmanaged_declared}; use crate::principal::{ DELEGATED_SOVEREIGN_ROOT_EMAIL, DELEGATED_SOVEREIGN_ROOT_GITHUB, SOLE_SUPERADMIN_EMAIL, - SOLE_SUPERADMIN_GITHUB, is_sovereign_root_email, + SOLE_SUPERADMIN_GITHUB, SOVEREIGN_ROOT_EMAILS, is_sovereign_root_email, }; use crate::registry::is_automation_login; use chrono::NaiveDate; @@ -350,8 +350,8 @@ pub fn missing_matrix_groups(repo: &Path) -> Result, IdpError> /// - Unique emails and unique `github_handle`s in `directory/users.yaml` /// - Every user's `org_unit` exists in `directory/orgunits.yaml` (or `"/"`) /// - `admin` (if set) is in `{"super", "delegated", "delegated-sovereign"}` -/// - `super` / `is_super_admin` is restricted to `ctodie@cerebral.work` and `delegated-sovereign` to `ahackley@cerebral.work` -/// - Sovereign roots (`ctodie@cerebral.work`, `ahackley@cerebral.work`) are never `suspended: true` and reside in `/Humans/Admins` when declared +/// - `super` / `is_super_admin` is restricted to [`SOVEREIGN_ROOT_EMAILS`] and `delegated-sovereign` to `ahackley@cerebral.work` +/// - Sovereign roots ([`SOVEREIGN_ROOT_EMAILS`]) are never `suspended: true` and reside in `/Humans/Admins` when declared /// - Every `groups/.yaml` matches `email` prefix `@` /// - Every `unreconciled_members` entry has a non-empty `reason` and valid ISO `until` date /// - Every user in `directory/licenses.yaml` exists in `directory/users.yaml` @@ -414,7 +414,8 @@ pub fn validate_directory_schema(repo: &Path) -> Result { } if u.is_super_admin && !is_sovereign_root_email(email) { return Err(IdpError::Validation(format!( - "{email}: super admin is restricted exclusively to sovereign roots ({SOLE_SUPERADMIN_EMAIL} and {DELEGATED_SOVEREIGN_ROOT_EMAIL})" + "{email}: super admin is restricted exclusively to sovereign roots ({})", + SOVEREIGN_ROOT_EMAILS.join(", ") ))); } if u.admin.as_deref() == Some("delegated-sovereign") @@ -531,7 +532,7 @@ pub fn validate_directory_schema(repo: &Path) -> Result { } /// Validates `roles.yaml`, `bundles.yaml`, `policies.yaml`, and optional `role-matrix.yaml` invariants, -/// including the sovereign root rules (`ctodie@cerebral.work` / `todie` and `ahackley@cerebral.work` / `LordVoid`) +/// including the sovereign root rules ([`SOVEREIGN_ROOT_EMAILS`] / [`SOVEREIGN_ROOT_GITHUBS`]) /// and Clockwork Elf automation constraints. pub fn validate_identity_models(repo: &Path) -> Result<(), IdpError> { let dir = repo.join("directory"); @@ -720,7 +721,8 @@ pub fn validate_identity_models(repo: &Path) -> Result<(), IdpError> { let email = entry.get("email").and_then(|v| v.as_str()).unwrap_or(""); if !is_sovereign_root_email(email) { return Err(IdpError::Validation(format!( - "{doc_name} break_glass_principals entry must be a sovereign root ({SOLE_SUPERADMIN_EMAIL} or {DELEGATED_SOVEREIGN_ROOT_EMAIL}), found {email}" + "{doc_name} break_glass_principals entry must be a sovereign root ({}), found {email}", + SOVEREIGN_ROOT_EMAILS.join(", ") ))); } } diff --git a/crates/idp/src/lib.rs b/crates/idp/src/lib.rs index 0b2c162..a87b4e1 100644 --- a/crates/idp/src/lib.rs +++ b/crates/idp/src/lib.rs @@ -68,8 +68,8 @@ pub use presence::{ pub use principal::{ CapabilityEnvelope, DELEGATED_SOVEREIGN_ROOT_EMAIL, DELEGATED_SOVEREIGN_ROOT_GITHUB, GroupDecision, PROHIBITED_SENSITIVE_PATHS, Principal, SOLE_SUPERADMIN_EMAIL, - SOLE_SUPERADMIN_GITHUB, SubjectMatterMesh, is_sovereign_root_email, is_sovereign_root_github, - reconcile_group_decisions, + SOLE_SUPERADMIN_GITHUB, SOVEREIGN_ROOT_EMAILS, SOVEREIGN_ROOT_GITHUBS, SubjectMatterMesh, + is_sovereign_root_email, is_sovereign_root_github, reconcile_group_decisions, }; pub use reconcile::{ LiveDirectoryState, LiveGroup, LiveUser, ReconcilePlan, apply_refusal, held_members, diff --git a/specs/0004-ory-hydra-dcr-agent-identity.md b/specs/0004-ory-hydra-dcr-agent-identity.md index b8c0e7f..51f994f 100644 --- a/specs/0004-ory-hydra-dcr-agent-identity.md +++ b/specs/0004-ory-hydra-dcr-agent-identity.md @@ -29,4 +29,4 @@ Provide an Ory Hydra OAuth 2.0 / OIDC Dynamic Client Registration (RFC 7591 / RF 1. **Zero Secret Leakage in Debug/Display/CLI**: `OAuth2ClientMetadata`, `OAuth2TokenResponse`, `TokenExchangeRequest`, `OryHydraConfig`, and `ClientAuth` redact all client secrets, bearer tokens, and PEM keys in `Debug` implementations and `.redacted()` projections. 2. **Cryptographic Agent Authentication**: Autonomous agents registered with `AgentClientMetadata` (`require_cryptographic_agent_auth = true`) must authenticate via `private_key_jwt` or `tls_client_auth` and declare a valid WIMSE/SPIFFE workload URI (`spiffe://` or `wimse://`). -3. **Sovereign Root Guard on Introspection**: An introspected token carrying `estate:superuser` scope is rejected (`Principal::Anonymous`) unless its subject or verified email matches `SOLE_SUPERADMIN_EMAIL` (`ctodie@cerebral.work`) or `SOLE_SUPERADMIN_GITHUB` (`todie`). +3. **Sovereign Root Guard on Introspection**: An introspected token carrying `estate:superuser` scope is rejected (`Principal::Anonymous`) unless its subject is a Sovereign Root: an email in `SOVEREIGN_ROOT_EMAILS` (`ctodie@cerebral.work`, `ahackley@cerebral.work`, `pgray@cerebral.work`, `mmasterson@cerebral.work`; the last two added 2026-10-26 by operator ruling).