Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down
6 changes: 3 additions & 3 deletions crates/idp-domain/src/dcr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
Expand Down
4 changes: 2 additions & 2 deletions crates/idp-domain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
55 changes: 47 additions & 8 deletions crates/idp-domain/src/principal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down
14 changes: 8 additions & 6 deletions crates/idp/src/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -350,8 +350,8 @@ pub fn missing_matrix_groups(repo: &Path) -> Result<BTreeSet<String>, 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/<stem>.yaml` matches `email` prefix `<stem>@`
/// - 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`
Expand Down Expand Up @@ -414,7 +414,8 @@ pub fn validate_directory_schema(repo: &Path) -> Result<usize, IdpError> {
}
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")
Expand Down Expand Up @@ -531,7 +532,7 @@ pub fn validate_directory_schema(repo: &Path) -> Result<usize, IdpError> {
}

/// 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");
Expand Down Expand Up @@ -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(", ")
)));
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/idp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion specs/0004-ory-hydra-dcr-agent-identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Loading