mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
This commit introduces a complete multi-threaded evaluation benchmark suite for both Rust and C# implementations of Regorus. - Implemented engine evaluation benchmark with input and engine cloning strategies - Implemented compiled policy evaluation benchmark with input cloning and shared compiled policy strategies. - Created EngineEvaluationBenchmark.cs and CompiledPolicyEvaluationBenchmark.cs with time-based execution (3s warmup + 3s evaluation) - Implemented configuration options matching Rust implementation (useClonedEngines, useSharedPolicies parameters) - Created markdown analysis documentation with cross-platform performance analysis - C# seems to achieve 58-89% of Rust performance on test machine. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
26 lines
473 B
Rego
26 lines
473 B
Rego
package bench
|
|
|
|
default allow := false
|
|
|
|
rbac_roles := {
|
|
"admin": ["read", "write", "delete", "admin"],
|
|
"manager": ["read", "write"],
|
|
"user": ["read"]
|
|
}
|
|
|
|
user_permissions contains perm if {
|
|
some role in input.user.roles
|
|
perm := rbac_roles[role][_]
|
|
}
|
|
|
|
allow if {
|
|
input.action in user_permissions
|
|
input.resource.owner == input.user.id
|
|
}
|
|
|
|
allow if {
|
|
input.action in user_permissions
|
|
input.resource.public == true
|
|
input.action == "read"
|
|
}
|