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>
29 lines
686 B
Rego
29 lines
686 B
Rego
package bench
|
|
|
|
default allow := false
|
|
|
|
# Complex data filtering and aggregation
|
|
sensitive_fields := ["ssn", "credit_card", "password"]
|
|
|
|
contains_sensitive_data if {
|
|
some field in sensitive_fields
|
|
object.get(input.data, field, null) != null
|
|
}
|
|
|
|
user_clearance_level := object.get(input.user.attributes, "clearance", 0)
|
|
|
|
required_clearance := 3 if contains_sensitive_data else := 1
|
|
|
|
allow if {
|
|
user_clearance_level >= required_clearance
|
|
input.operation in ["read", "export"]
|
|
count(input.data) > 0
|
|
count(input.data) <= 1000 # Limit data size
|
|
}
|
|
|
|
allow if {
|
|
input.user.role == "data_processor"
|
|
input.operation == "transform"
|
|
not contains_sensitive_data
|
|
}
|