mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
* feat: Add Schema Registry and Validation Framework This commit introduces a comprehensive schema registry and validation framework, providing schema-based validation of resources and policy effects. - Thread-safe, in-memory registry for schema storage and management - Global registry patterns for effects and resources - Concurrent access with proper error handling - Unicode schema names support - JSON Schema-compliant validation for all primitive types - Advanced constraint validation (patterns, ranges, length limits) - Discriminated union support with anyOf schemas - Detailed error reporting with nested validation paths - Discriminated subobject validation for polymorphic schemas - **Registry Tests**: All registry operations - **Effect Tests**: Policy effect validation - **Resource Tests**: Resource validation - **Validation Tests**: Core validation engine - Thread-safety, error handling, integration scenarios, edge cases - **Dependencies**: dashmap, once_cell, regex - **Thread Safety**: Minimal locking with Rc<Schema> sharing - **Error Types**: TypeMismatch, OutOfRange, PatternMismatch, etc. - Complete schema registry and validation subsystem - Comprehensive test coverage - Foundation for policy validation in Regorus Benchmarks: - Criterion benchmarks for basic types, effects and Azure resources - Performance range: 3.22ns (string) to 34.74µs (Azure VM resource schema validation) - String withs patterns validation: 30.2µs. Need to explore whether regex caching helps bring this down. - Azure policy effects: 188ns-1.4µs Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * feat: Complete target system with C# bindings and resource inference - Add comprehensive target system with TargetRegistry and target-aware compilation - Implement resource type inference from policy equality expressions - Create modular C# bindings with separate wrapper classes for each concept - Add thread-safe CompiledPolicy with reference counting for safe disposal - Enhance FFI with detailed error propagation and target functionality - Create TargetExampleApp demonstrating Azure Policy integration - Add CI/CD pipeline testing for all C# applications - Support target definitions with schema validation and resource selectors - Implement PolicyModule struct and target-aware compilation methods - Add comprehensive test coverage for target functionality Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> --------- Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
190 lines
6.5 KiB
JSON
190 lines
6.5 KiB
JSON
{
|
|
"name": "target.tests.msgraph",
|
|
"description": "Microsoft Graph API target for identity and access management testing",
|
|
"version": "1.0.0",
|
|
"resource_schema_selector": "@odata.type",
|
|
"resource_schemas": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"@odata.type": { "const": "#microsoft.graph.user" },
|
|
"id": { "type": "string" },
|
|
"userPrincipalName": { "type": "string" },
|
|
"displayName": { "type": "string" },
|
|
"givenName": { "type": "string" },
|
|
"surname": { "type": "string" },
|
|
"mail": { "type": "string" },
|
|
"jobTitle": { "type": "string" },
|
|
"department": { "type": "string" },
|
|
"accountEnabled": { "type": "boolean" },
|
|
"userType": { "enum": ["Member", "Guest"] },
|
|
"assignedLicenses": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"skuId": { "type": "string" },
|
|
"disabledPlans": { "type": "array", "items": { "type": "string" } }
|
|
}
|
|
}
|
|
},
|
|
"signInActivity": {
|
|
"type": "object",
|
|
"properties": {
|
|
"lastSignInDateTime": { "type": "string" },
|
|
"lastNonInteractiveSignInDateTime": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
"required": ["@odata.type", "id", "userPrincipalName"]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"@odata.type": { "const": "#microsoft.graph.group" },
|
|
"id": { "type": "string" },
|
|
"displayName": { "type": "string" },
|
|
"description": { "type": "string" },
|
|
"groupTypes": { "type": "array", "items": { "type": "string" } },
|
|
"securityEnabled": { "type": "boolean" },
|
|
"mailEnabled": { "type": "boolean" },
|
|
"mail": { "type": "string" },
|
|
"visibility": { "enum": ["Public", "Private", "HiddenMembership"] },
|
|
"members": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"@odata.type": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": ["@odata.type", "id", "displayName"]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"@odata.type": { "const": "#microsoft.graph.application" },
|
|
"id": { "type": "string" },
|
|
"appId": { "type": "string" },
|
|
"displayName": { "type": "string" },
|
|
"publisherDomain": { "type": "string" },
|
|
"signInAudience": { "enum": ["AzureADMyOrg", "AzureADMultipleOrgs", "AzureADandPersonalMicrosoftAccount", "PersonalMicrosoftAccount"] },
|
|
"requiredResourceAccess": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"resourceAppId": { "type": "string" },
|
|
"resourceAccess": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"type": { "enum": ["Scope", "Role"] }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"web": {
|
|
"type": "object",
|
|
"properties": {
|
|
"redirectUris": { "type": "array", "items": { "type": "string" } },
|
|
"implicitGrantSettings": {
|
|
"type": "object",
|
|
"properties": {
|
|
"enableAccessTokenIssuance": { "type": "boolean" },
|
|
"enableIdTokenIssuance": { "type": "boolean" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": ["@odata.type", "id", "appId", "displayName"]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"@odata.type": { "const": "#microsoft.graph.conditionalAccessPolicy" },
|
|
"id": { "type": "string" },
|
|
"displayName": { "type": "string" },
|
|
"state": { "enum": ["enabled", "disabled", "enabledForReportingButNotEnforced"] },
|
|
"conditions": {
|
|
"type": "object",
|
|
"properties": {
|
|
"users": {
|
|
"type": "object",
|
|
"properties": {
|
|
"includeUsers": { "type": "array", "items": { "type": "string" } },
|
|
"excludeUsers": { "type": "array", "items": { "type": "string" } },
|
|
"includeGroups": { "type": "array", "items": { "type": "string" } },
|
|
"excludeGroups": { "type": "array", "items": { "type": "string" } }
|
|
}
|
|
},
|
|
"applications": {
|
|
"type": "object",
|
|
"properties": {
|
|
"includeApplications": { "type": "array", "items": { "type": "string" } },
|
|
"excludeApplications": { "type": "array", "items": { "type": "string" } }
|
|
}
|
|
},
|
|
"locations": {
|
|
"type": "object",
|
|
"properties": {
|
|
"includeLocations": { "type": "array", "items": { "type": "string" } },
|
|
"excludeLocations": { "type": "array", "items": { "type": "string" } }
|
|
}
|
|
},
|
|
"riskLevels": { "type": "array", "items": { "enum": ["low", "medium", "high", "none"] } }
|
|
}
|
|
},
|
|
"grantControls": {
|
|
"type": "object",
|
|
"properties": {
|
|
"operator": { "enum": ["AND", "OR"] },
|
|
"builtInControls": { "type": "array", "items": { "enum": ["block", "mfa", "compliantDevice", "domainJoinedDevice", "approvedApplication", "compliantApplication"] } }
|
|
}
|
|
}
|
|
},
|
|
"required": ["@odata.type", "id", "displayName", "state"]
|
|
}
|
|
],
|
|
"effects": {
|
|
"allow": { "type": "boolean" },
|
|
"block": {
|
|
"type": "object",
|
|
"properties": {
|
|
"reason": { "type": "string" },
|
|
"blockType": { "enum": ["signin", "access", "registration"] }
|
|
}
|
|
},
|
|
"requireMfa": {
|
|
"type": "object",
|
|
"properties": {
|
|
"methods": { "type": "array", "items": { "enum": ["sms", "voice", "app", "oath"] } }
|
|
}
|
|
},
|
|
"audit": {
|
|
"type": "object",
|
|
"properties": {
|
|
"level": { "enum": ["info", "warning", "error"] },
|
|
"message": { "type": "string" },
|
|
"category": { "enum": ["signin", "audit", "risk", "provisioning"] }
|
|
}
|
|
},
|
|
"remediate": {
|
|
"type": "object",
|
|
"properties": {
|
|
"action": { "enum": ["disable", "enable", "reset", "notify"] },
|
|
"target": { "type": "string" },
|
|
"parameters": { "type": "object" }
|
|
}
|
|
}
|
|
}
|
|
}
|