mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
* build: consolidate dependabot cargo entries and add commit prefixes Consolidate all 9 separate cargo ecosystem entries into a single entry using the 'directories' key. This ensures Dependabot creates one PR per dependency update across the root workspace and all bindings, preventing version skew that caused build failures. Also add semantic commit-message prefixes to all ecosystem entries: - build(deps) for cargo, gomod, maven, nuget, pip, bundler - ci(deps) for github-actions Rename the cargo group to 'rust-dependencies' and the github-actions group to 'github-actions' for clarity. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * fix: remove mimalloc from default features, fix indexmap/std propagation Address #595: the vendored mimalloc allocator should not be imposed on library consumers. Remove allocator-memory-limits and mimalloc from the full-opa feature so that users of regorus as a library can choose their own global allocator. Bindings (ffi, java, python, ruby) that ship as standalone artifacts continue to opt in to regorus/allocator-memory-limits explicitly so they retain the performant allocator. Also propagate indexmap/std via the std feature (using the indexmap?/std weak-dependency syntax) so that users enabling std + rvm without default features no longer hit 'IndexMap takes 3 generic arguments' errors. Closes #595 Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * ci: add feature-combination checks to PR CI and weekly matrix PR CI (xtask): add cargo check for 5 non-default feature combos in run_ci_suite(). These run on every PR and catch compile failures from feature-gating issues (e.g. #595) with near-zero overhead. Weekly workflow: new feature-matrix.yml runs cargo build + cargo test across 9 feature combinations every Monday. Uses a GitHub Actions matrix with fail-fast: false so all combos are tested even if one fails. Combinations tested weekly: - std,arc (minimal library) - std,arc,rvm (common library usage) - std,arc,full-opa (full-opa without mimalloc) - std,arc,full-opa,allocator-memory-limits (binding-style) - std,arc,rvm,regex,time,semver,cache (cherry-picked builtins) - std,arc,rvm,coverage,cache (observability) - std,arc,full-opa,azure_policy (Azure Policy) - std,arc,full-opa,azure-rbac (Azure RBAC) - arc,opa-no-std (no_std codepath) Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * fix: gate benchmark memory-limit calls behind allocator-memory-limits feature The set_global_memory_limit function is only available when the allocator-memory-limits feature is enabled. After removing mimalloc from the default feature set, the rvm_benchmark failed to compile. Add #[cfg(feature = "allocator-memory-limits")] guards around the call sites and the MEMORY_LIMIT_BYTES constant. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> --------- Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
regorus
Regorus is
- Rego-Rus(t) - A fast, light-weight Rego interpreter written in Rust.
- Rigorous - A rigorous enforcer of well-defined Rego semantics.
Regorus can be used in Python via regorus package. (It is not yet available in PyPI, but can be manually built.)
See Repository.
Automation
Run cargo xtask build-python to produce wheels via maturin, or cargo xtask test-python to reinstall the package locally and execute the sample script and pytest suite.
To build this binding, see building
Usage
import regorus
# Create engine
engine = regorus.Engine()
# Load policies
engine.add_policy_from_file('../../tests/aci/framework.rego')
engine.add_policy_from_file('../../tests/aci/api.rego')
engine.add_policy_from_file('../../tests/aci/policy.rego')
# Add policy data
data = {
"metadata": {
"devices": {
"/run/layers/p0-layer0": "1b80f120dbd88e4355d6241b519c3e25290215c469516b49dece9cf07175a766",
"/run/layers/p0-layer1": "e769d7487cc314d3ee748a4440805317c19262c7acd2fdbdb0d47d2e4613a15c",
"/run/layers/p0-layer2": "eb36921e1f82af46dfe248ef8f1b3afb6a5230a64181d960d10237a08cd73c79",
"/run/layers/p0-layer3": "41d64cdeb347bf236b4c13b7403b633ff11f1cf94dbc7cf881a44d6da88c5156",
"/run/layers/p0-layer4": "4dedae42847c704da891a28c25d32201a1ae440bce2aecccfa8e6f03b97a6a6c",
"/run/layers/p0-layer5": "fe84c9d5bfddd07a2624d00333cf13c1a9c941f3a261f13ead44fc6a93bc0e7a"
}
}
}
engine.add_data(data)
# Set input
input = {
"containerID": "container0",
"layerPaths": [
"/run/layers/p0-layer0",
"/run/layers/p0-layer1",
"/run/layers/p0-layer2",
"/run/layers/p0-layer3",
"/run/layers/p0-layer4",
"/run/layers/p0-layer5"
],
"target": "/run/gcs/c/container0/rootfs"
}
engine.set_input(input)
# Eval rule
value = engine.eval_rule('data.framework.mount_overlay')
# Print value
print(value)