{
  "schema": "lattice.agents/governance-policies/v1",
  "role_permission_catalogue": {
    "operations": [
      "Admin",
      "AppInstall",
      "AtomicWrite",
      "Backup",
      "BulkLoad",
      "CrdtApply",
      "Delete",
      "RangeDelete",
      "RangeRead",
      "Read",
      "Replication",
      "Restore",
      "SchemaAdmin",
      "Telemetry",
      "TreeLifecycle",
      "Write"
    ],
    "effects": [
      "Allow",
      "Deny"
    ],
    "subjects": [
      "Group",
      "User"
    ],
    "scopes": [
      "ClusterWide",
      "Key",
      "Prefix",
      "Tree"
    ],
    "source": "src/lattice/LatticeOperation.cs"
  },
  "policy_definitions": [
    {
      "id": "app-capability-ceiling",
      "fields": [
        "allowed_operations",
        "approved_exception_scopes"
      ],
      "definition": "An app install stores a version-pinned ceiling; compiled app rules may use only operations inside the ceiling and exception scopes outside the app's structural namespace that the ceiling covers.",
      "source": "src/lattice.apps/Install/AppCapabilityCeiling.cs"
    },
    {
      "id": "app-install-capability",
      "fields": [
        "operation",
        "scope"
      ],
      "definition": "AppInstall is a scopeless cluster-wide capability granted over LatticeScope.ClusterWide(); it is excluded from the all data-plane operation aggregate and must be granted explicitly.",
      "source": "src/lattice/LatticeOperation.cs"
    },
    {
      "id": "app-owned-authorization-rules",
      "fields": [
        "rule_id_prefix",
        "owning_app",
        "compiled_rules"
      ],
      "definition": "Rules whose id starts with app: are owned by an installed app and may be written or deleted only by system-origin reconciliation; operators must author separate rules outside that prefix.",
      "source": "src/lattice.auth/LatticeAppRuleIds.cs"
    },
    {
      "id": "app-role-bindings",
      "fields": [
        "role_name",
        "group_id"
      ],
      "definition": "An app role binding maps one manifest role to one membership group; compiled rules always use a group subject selector, never a user selector.",
      "source": "src/lattice.apps/Compiler/AppRoleCompiler.cs"
    },
    {
      "id": "backup-restore-capability",
      "fields": [
        "operation",
        "authorized_scope",
        "fallback_scope"
      ],
      "definition": "Restore authorizes authoring a backup into the resolved target scope; when no restore target can be resolved, the control facade authorizes Restore on the reserved backup catalog tree rather than skipping the gate.",
      "source": "src/lattice.api.backup/LatticeBackupControl.cs"
    },
    {
      "id": "cross-tenant-grant",
      "fields": [
        "granter_tenant_id",
        "grantee_tenant_id",
        "scope",
        "operations",
        "state"
      ],
      "definition": "A grant scope is a full t/{tenant}/... tree id or a /-boundary prefix of one; pending grants authorize nothing until the grantee approves.",
      "source": "src/lattice.api.abstractions/TenantAdmin/ILatticeTenantGrantAdmin.cs"
    },
    {
      "id": "lattice-authorization-rule",
      "fields": [
        "rule_id",
        "subject",
        "scope",
        "operations",
        "effect",
        "condition"
      ],
      "definition": "A rule grants or denies operation flags over a tree, key, or prefix to a user or group.",
      "source": "src/lattice.auth/LatticeAuthorizationRule.cs"
    },
    {
      "id": "tenant-quotas",
      "fields": [
        "max_bytes",
        "max_keys",
        "max_memory_bytes",
        "max_tree_count",
        "max_ops_per_second",
        "burst_percent"
      ],
      "definition": "Nullable quota dimensions are unbounded; bounded quota dimensions must be non-negative; BurstPercent is transient headroom above bounded ceilings.",
      "source": "src/lattice.tenancy/TenantQuotas.cs"
    },
    {
      "id": "tenant-region-policy",
      "fields": [
        "allowed_regions",
        "region_status"
      ],
      "definition": "Allowed regions are operator authored and residency must stay within that allowed set.",
      "source": "src/lattice.api.abstractions/TenantAdmin/ILatticeTenantRegionAdmin.cs"
    }
  ],
  "security_options": [
    {
      "id": "api-auth-grpc-options",
      "type": "LatticeAuthApiGrpcOptions",
      "properties": [
        {
          "name": "CredentialHeaderName",
          "type": "string",
          "default": "authorization"
        },
        {
          "name": "CredentialScheme",
          "type": "string",
          "default": "Bearer"
        },
        {
          "name": "RequireAuthorization",
          "type": "bool",
          "default": true
        },
        {
          "name": "ActiveTenantHeaderName",
          "type": "string?",
          "default": "lattice-active-tenant"
        }
      ],
      "source": "src/lattice.api.auth.grpc/LatticeAuthApiGrpcOptions.cs"
    },
    {
      "id": "api-tenantadmin-grpc-options",
      "type": "LatticeTenantAdminApiGrpcOptions",
      "properties": [
        {
          "name": "ActiveTenantHeaderName",
          "type": "string",
          "default": "lattice-active-tenant"
        },
        {
          "name": "AdvertisedAuthSchemes",
          "type": "IList<AuthSchemeDescriptor>",
          "default": "empty"
        },
        {
          "name": "CredentialHeaderName",
          "type": "string",
          "default": "authorization"
        },
        {
          "name": "CredentialScheme",
          "type": "string",
          "default": "Bearer"
        },
        {
          "name": "RequireAuthorization",
          "type": "bool",
          "default": true
        }
      ],
      "source": "src/lattice.api.tenantadmin.grpc/LatticeTenantAdminApiGrpcOptions.cs"
    },
    {
      "id": "apps-api-grpc-options",
      "type": "LatticeAppsApiGrpcOptions",
      "properties": [
        {
          "name": "ActiveTenantHeaderName",
          "type": "string",
          "default": "lattice-active-tenant"
        },
        {
          "name": "AdvertisedAuthSchemes",
          "type": "IList<AuthSchemeDescriptor>",
          "default": "empty"
        },
        {
          "name": "CredentialHeaderName",
          "type": "string",
          "default": "authorization"
        },
        {
          "name": "CredentialScheme",
          "type": "string",
          "default": "Bearer"
        },
        {
          "name": "RequireAuthorization",
          "type": "bool",
          "default": true
        }
      ],
      "source": "src/lattice.api.apps.grpc/LatticeAppsApiGrpcOptions.cs"
    },
    {
      "id": "apps-options",
      "type": "LatticeAppsOptions",
      "properties": [
        {
          "name": "ReconcileOnStartup",
          "type": "bool",
          "default": true
        },
        {
          "name": "StartupRetryDelay",
          "type": "TimeSpan",
          "default": "00:00:00.2500000"
        },
        {
          "name": "StartupRetryMaxDelay",
          "type": "TimeSpan",
          "default": "00:00:30"
        }
      ],
      "source": "src/lattice.apps/LatticeAppsOptions.cs"
    },
    {
      "id": "auth-options",
      "type": "LatticeAuthOptions",
      "properties": [
        {
          "name": "AccessAdministrationDelegationEnabled",
          "type": "bool",
          "default": false
        },
        {
          "name": "AllTreesGrantsEnabled",
          "type": "bool",
          "default": false
        },
        {
          "name": "AuditSamplingRatio",
          "type": "double",
          "default": 1.0
        },
        {
          "name": "AuditTrailTimeToLive",
          "type": "TimeSpan?",
          "default": null
        },
        {
          "name": "AuditVerbosity",
          "type": "LatticeAuthAuditVerbosity",
          "default": "DenyOnly"
        },
        {
          "name": "BootstrapAdministrators",
          "type": "ISet<string>",
          "default": "empty"
        },
        {
          "name": "DefaultEffect",
          "type": "LatticeEffect",
          "default": "Deny"
        },
        {
          "name": "EnableAuditSink",
          "type": "bool",
          "default": false
        },
        {
          "name": "EnableDurableAuditTrail",
          "type": "bool",
          "default": false
        },
        {
          "name": "EnableDurableHistoryView",
          "type": "bool",
          "default": true
        },
        {
          "name": "HistoryRetentionMode",
          "type": "HistoryRetentionMode",
          "default": "MetadataOnly"
        },
        {
          "name": "HistoryRetentionWindow",
          "type": "TimeSpan?",
          "default": null
        },
        {
          "name": "StrictConsistencyTrees",
          "type": "ISet<string>?",
          "default": null
        },
        {
          "name": "UserRuleBeatsGroupRuleAtEqualScope",
          "type": "bool",
          "default": true
        }
      ],
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "entra-authenticator-options",
      "type": "LatticeEntraAuthenticatorOptions",
      "properties": [
        {
          "name": "Algorithms",
          "type": "IList<string>",
          "default": "RS256"
        },
        {
          "name": "Audiences",
          "type": "IList<string>",
          "default": "empty invalid until configured"
        },
        {
          "name": "GroupResolutionMode",
          "type": "EntraGroupResolutionMode",
          "default": "TokenOnly"
        },
        {
          "name": "TenantIds",
          "type": "IList<string>",
          "default": "empty allow-list"
        },
        {
          "name": "Authority",
          "type": "string",
          "default": ""
        },
        {
          "name": "MetadataAddress",
          "type": "string?",
          "default": null
        },
        {
          "name": "IssuerTemplate",
          "type": "string",
          "default": "https://login.microsoftonline.com/{tenantid}/v2.0"
        },
        {
          "name": "SchemeHint",
          "type": "string?",
          "default": null
        },
        {
          "name": "ValidateLifetime",
          "type": "bool",
          "default": true
        },
        {
          "name": "ClockSkew",
          "type": "TimeSpan",
          "default": "00:05:00"
        },
        {
          "name": "AutomaticRefreshInterval",
          "type": "TimeSpan",
          "default": "12:00:00"
        },
        {
          "name": "RefreshInterval",
          "type": "TimeSpan",
          "default": "00:05:00"
        }
      ],
      "source": "src/lattice.membership.entra/LatticeEntraAuthenticatorOptions.cs"
    },
    {
      "id": "identity-directory-options",
      "type": "LatticeIdentityDirectoryOptions",
      "properties": [
        {
          "name": "DefaultPageSize",
          "type": "int",
          "default": 25
        },
        {
          "name": "MaxPageSize",
          "type": "int",
          "default": 100
        },
        {
          "name": "ValidationRequired",
          "type": "bool",
          "default": false
        }
      ],
      "source": "src/lattice.membership/LatticeIdentityDirectoryOptions.cs"
    },
    {
      "id": "jwt-authenticator-options",
      "type": "JwtAuthenticatorOptions",
      "properties": [
        {
          "name": "Algorithms",
          "type": "IList<string>",
          "default": "derived from key families"
        },
        {
          "name": "Audiences",
          "type": "IList<string>",
          "default": "empty invalid when ValidateAudience true"
        },
        {
          "name": "Issuer",
          "type": "string",
          "default": "empty invalid until configured"
        },
        {
          "name": "RequireAlgorithmPin",
          "type": "bool",
          "default": false
        },
        {
          "name": "ValidateAudience",
          "type": "bool",
          "default": true
        },
        {
          "name": "SchemeHint",
          "type": "string?",
          "default": null
        },
        {
          "name": "SigningKeys",
          "type": "IList<SecurityKey>",
          "default": "empty"
        },
        {
          "name": "SubjectClaimTypes",
          "type": "IList<string>",
          "default": "sub, nameid"
        },
        {
          "name": "GroupClaimTypes",
          "type": "IList<string>",
          "default": "groups, roles, role"
        },
        {
          "name": "ValidateLifetime",
          "type": "bool",
          "default": true
        },
        {
          "name": "ClockSkew",
          "type": "TimeSpan",
          "default": "00:05:00"
        },
        {
          "name": "ValidationParameters",
          "type": "TokenValidationParameters?",
          "default": null
        }
      ],
      "source": "src/lattice.membership/JwtAuthenticatorOptions.cs"
    },
    {
      "id": "membership-options",
      "type": "LatticeMembershipOptions",
      "properties": [
        {
          "name": "ClaimToGroups",
          "type": "Func<IReadOnlyDictionary<string,string>,IEnumerable<string>>?",
          "default": null
        },
        {
          "name": "EnableDurableHistoryView",
          "type": "bool",
          "default": true
        },
        {
          "name": "GroupMergeMode",
          "type": "SubjectGroupMergeMode",
          "default": "Union"
        },
        {
          "name": "ResolutionCacheTtl",
          "type": "TimeSpan",
          "default": "00:05:00"
        },
        {
          "name": "HistoryRetentionMode",
          "type": "HistoryRetentionMode",
          "default": "MetadataOnly"
        },
        {
          "name": "HistoryRetentionWindow",
          "type": "TimeSpan?",
          "default": null
        }
      ],
      "source": "src/lattice.membership/LatticeMembershipOptions.cs"
    },
    {
      "id": "oidc-authenticator-options",
      "type": "LatticeOidcAuthenticatorOptions",
      "properties": [
        {
          "name": "Algorithms",
          "type": "IList<string>",
          "default": "provider discovery"
        },
        {
          "name": "Audiences",
          "type": "IList<string>",
          "default": "empty invalid until configured"
        },
        {
          "name": "Issuer",
          "type": "string",
          "default": "empty invalid until configured"
        },
        {
          "name": "SubjectClaimTypes",
          "type": "IList<string>",
          "default": "sub"
        },
        {
          "name": "Authority",
          "type": "string",
          "default": ""
        },
        {
          "name": "MetadataAddress",
          "type": "string?",
          "default": null
        },
        {
          "name": "GroupClaimTypes",
          "type": "IList<string>",
          "default": "groups, roles, role"
        },
        {
          "name": "SchemeHint",
          "type": "string?",
          "default": null
        },
        {
          "name": "ValidateLifetime",
          "type": "bool",
          "default": true
        },
        {
          "name": "ClockSkew",
          "type": "TimeSpan",
          "default": "00:05:00"
        },
        {
          "name": "AutomaticRefreshInterval",
          "type": "TimeSpan",
          "default": "12:00:00"
        },
        {
          "name": "RefreshInterval",
          "type": "TimeSpan",
          "default": "00:05:00"
        }
      ],
      "source": "src/lattice.membership.oidc/LatticeOidcAuthenticatorOptions.cs"
    },
    {
      "id": "tenancy-options",
      "type": "LatticeTenancyOptions",
      "properties": [
        {
          "name": "EnableDurableHistoryView",
          "type": "bool",
          "default": true
        },
        {
          "name": "HistoryRetentionMode",
          "type": "HistoryRetentionMode",
          "default": "MetadataOnly"
        },
        {
          "name": "HistoryRetentionWindow",
          "type": "TimeSpan?",
          "default": null
        },
        {
          "name": "SeedDefaultTenant",
          "type": "bool",
          "default": true
        },
        {
          "name": "PolicySnapshotLeaseDuration",
          "type": "TimeSpan",
          "default": "00:00:10"
        },
        {
          "name": "DelegatedAccessAdministrationEnabled",
          "type": "bool",
          "default": false
        }
      ],
      "source": "src/lattice.tenancy/LatticeTenancyOptions.cs"
    },
    {
      "id": "tenant-usage-accounting-options",
      "type": "TenantUsageAccountingOptions",
      "properties": [
        {
          "name": "DefaultEnforcementScope",
          "type": "TenantEnforcementScope",
          "default": "GlobalConverged"
        },
        {
          "name": "MeterInterval",
          "type": "TimeSpan",
          "default": "00:00:30"
        },
        {
          "name": "PublishMinAbsoluteDelta",
          "type": "long",
          "default": 65536
        },
        {
          "name": "PublishMinRelativeDelta",
          "type": "double",
          "default": 0.05
        }
      ],
      "source": "src/lattice.tenancy/TenantUsageAccountingOptions.cs"
    }
  ],
  "allow_lists": [
    {
      "id": "app-owned-rule-prefix",
      "definition": "Authorization rule ids starting with app: are reserved for app compiler output and direct non-system writes or deletes are rejected.",
      "source": "src/lattice.auth/LatticeAppRuleIds.cs"
    },
    {
      "id": "bootstrap-administrators",
      "definition": "Subject ids listed here are treated as Admin on every tree and operation.",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "entra-tenant-ids",
      "definition": "Only tokens whose tid is in TenantIds are handled by the Entra authenticator.",
      "source": "src/lattice.membership.entra/LatticeEntraAuthenticatorOptions.cs"
    },
    {
      "id": "jwt-algorithms",
      "definition": "Configured or derived token signature algorithm allow-list; required pins fail closed when configured by provider options.",
      "source": "src/lattice.membership/JwtAuthenticatorOptions.cs"
    },
    {
      "id": "strict-consistency-trees",
      "definition": "Tree ids listed here reject user writes when the required policy epoch floor has not converged locally.",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    }
  ]
}
