Anand Krishnamoorthi
cc917ea75d
feat: Complete target system with C# bindings and resource inference ( #458 )
...
* 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 >
2025-08-19 20:23:43 -05:00
Anand Krishnamoorthi
db718654b5
feat: Add Schema Registry and Validation Framework ( #456 )
...
* 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 >
* Address PR feedback
- move error to a separate file
- use meaningful var names
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
* Refactor
- Reusable Registry struct
- Split and simplify tests
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
---------
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-08-14 15:59:30 -05:00
Denis Komissarov
c5b2b0df97
build: Run format and clippy during C# binding build ( #451 )
2025-08-04 19:57:38 -05:00
Anand Krishnamoorthi
fc09802bfb
deps: Update dependencies across all Cargo.toml files and ignore .sln files ( #450 )
...
Dependencies updated:
- cc: 1.2.29 -> 1.2.31
- chrono-tz: 0.10.3 -> 0.10.4
- clap: 4.5.40 -> 4.5.42
- clap_builder: 4.5.40 -> 4.5.42
- clap_derive: 4.5.40 -> 4.5.41
- phf: 0.11.3 -> 0.12.1
- phf_shared: 0.11.3 -> 0.12.1
- rand: 0.9.1 -> 0.9.2
- rb-sys: 0.9.116 -> 0.9.117
- rb-sys-build: 0.9.116 -> 0.9.117
- redox_syscall: 0.5.13 -> 0.5.17
- rustix: 1.0.7 -> 1.0.8
- serde_json: 1.0.140 -> 1.0.142
- windows-targets: 0.53.2 -> 0.53.3
- winnow: 0.7.11 -> 0.7.12
Removed obsolete build dependencies:
- chrono-tz-build, parse-zoneinfo, phf_codegen, phf_generator, rand_core
Updated in: main, ffi, java, python, ruby, and wasm bindings
Added *.sln to .gitignore to exclude Visual Studio solution files
Also fix python publishing pipeline by removing non-existent dependency.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-08-04 19:56:27 -05:00
Denis Komissarov
9fce2ccc00
feat: Implement methods to get package names and parameters ( #425 )
2025-08-04 15:02:22 -05:00
Anand Krishnamoorthi
9487defa20
chore: Regorus v0.5.0 release ( #432 )
...
Also update binding versions and lock files.
Note:
- Ruby binding is not updated
- C# binding is v0.7.0. We will make it match Regorus version later.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-07-08 16:40:06 -05:00
Anand Krishnamoorthi
9cba07b778
fix: Fix mut_from_ref clippy warning ( #428 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-07-08 11:48:13 -05:00
Anand Krishnamoorthi
444b2970a1
feat!: Indexes for nodes in the AST ( #414 )
...
Indexes allow associating extra data with nodes in the AST
using an array and then quickly looking up the array to fetch
the extra data.
- Index eidx for expressions
- Index sidx for statements
- Index qidx for queries.
AST nodes are not cloneable. Therefore once a module is created,
it is not possible to accidentally create two nodes with the same
index inadvertently via clone.
Also added IndexChecker in debug builds. When a module is parsed,
it will assert that indexes have been constructed correctly.
AST Cleanup
- Make literal expressions (null, val, number, string etc) also structs
to match all other expressions
- Merge True and False nodes into a single Bool node.
Also update dependencies.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-06-20 15:09:07 -05:00
Anand Krishnamoorthi
39f10326cc
build(deps): Update criterion and other deps ( #412 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-05-23 14:00:14 -05:00
Anand Krishnamoorthi
130f9685fd
feat: Updates for Policy Framework ( #405 )
...
- Documentation
- Regorus Engine is intended to be used from a single thread
- Clone the engine after adding policies and data to use from another thread
- Builtin errors strictness:
- default to less strict for OPA compatibility
- Provide API to change strictness
- Expose GetAstAsJson to C#,
This can allow writing policy validations in C#.
- Use spectre mitigated msvc crt libs (binskim compliance)
- Update dependencies
fixes #404
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-04-30 15:33:40 -05:00
Anand Krishnamoorthi
6719456468
build: Update dependencies ( #401 )
...
Also bump up C# package version
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-04-29 11:06:05 -05:00
Anand Krishnamoorthi
9e43bd9878
fix!: Remove cryptographic builtins ( #396 )
...
Cryptographic builtins are removed due to various reasons like FIPS
compliance. Users needing crypto builtins are encouraged to use
extensions.
Deprecated functions are also removed.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-04-16 12:24:19 -07:00
Anand Krishnamoorthi
f46ab5b697
fix!: Fix glob.match behavior in presence of : ( #390 )
...
glob.match("api://*/appId", null, "api://foo.com/appId") wasn't
being handled correctly. Switch to globset crate.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-04-09 11:11:57 -07:00
Anand Krishnamoorthi
c28bde3f56
build: Check-in Cargo.lock files and lockdown .net ( #384 )
...
Use frozen and locked builds
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-03-31 07:55:47 -07:00
Anand Krishnamoorthi
2858b63cd4
feat: Regorus nuget package ( #383 )
...
Organize C# binding example into separate Regorus nuget package and
a test app.
The nuget package targets netstandard 2.0 and 2.1.
The test app is tested for netframework 8.0.
Implement IDisposable for Engine cleanup.
Also remove net40 example. Can be added back later if needed.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-03-25 11:31:13 -07:00
Anand Krishnamoorthi
4a2df93ae2
fix!: Remove sha1 dependency ( #379 )
...
Removed cryptographically insecure sha1. This existed only for OPA
compatibility.
Also exclude bindings from main workspace
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-03-13 12:34:11 -07:00
Anand Krishnamoorthi
c963e477a3
feat: Update to OPA v1.2.0 ( #373 )
...
Regorus now defaults to rego v1. `import rego.v1` is no longer needed.
Additionally, `future` keywords are automatically imported.
See
https://www.openpolicyagent.org/docs/latest/v0-upgrade/#changes-to-rego-in-opa-v10
to understand the differences between rego v1 and v0.
BREAKING CHANGE:
v0 style policies will error out by default. To enable v0 behavior, call engine.set_rego_v0(true) before
loading policies.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-03-10 11:56:01 -07:00
dependabot[bot]
11aaa555aa
build(deps): update cbindgen requirement from 0.27.0 to 0.28.0 ( #361 )
...
Updates the requirements on [cbindgen](https://github.com/mozilla/cbindgen ) to permit the latest version.
- [Release notes](https://github.com/mozilla/cbindgen/releases )
- [Changelog](https://github.com/mozilla/cbindgen/blob/master/CHANGES )
- [Commits](https://github.com/mozilla/cbindgen/compare/v0.27.0...0.28.0 )
---
updated-dependencies:
- dependency-name: cbindgen
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 16:23:44 -08:00
Anand Krishnamoorthi
6174af1781
Update dependencies ( #369 )
...
Specify `js` feature for `uuid` when building wasm by
specifying it as a non-optional dependency in wasm binding's Cargo.toml.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2025-03-03 15:53:47 -08:00
dependabot[bot]
6bf40c7394
Update cbindgen requirement from 0.26.0 to 0.27.0 ( #296 )
...
Updates the requirements on [cbindgen](https://github.com/mozilla/cbindgen ) to permit the latest version.
- [Release notes](https://github.com/mozilla/cbindgen/releases )
- [Changelog](https://github.com/mozilla/cbindgen/blob/master/CHANGES )
- [Commits](https://github.com/mozilla/cbindgen/compare/0.26.0...v0.27.0 )
---
updated-dependencies:
- dependency-name: cbindgen
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 09:09:53 -07:00
dependabot[bot]
430a453fde
Update csbindgen requirement from =1.9.0 to =1.9.3 ( #292 )
...
Updates the requirements on [csbindgen](https://github.com/Cysharp/csbindgen ) to permit the latest version.
- [Release notes](https://github.com/Cysharp/csbindgen/releases )
- [Commits](https://github.com/Cysharp/csbindgen/compare/1.9.0...1.9.3 )
---
updated-dependencies:
- dependency-name: csbindgen
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 11:39:56 -07:00
Anand Krishnamoorthi
20eece58ed
Update binding versions ( #287 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-07-28 12:32:39 +05:30
Anand Krishnamoorthi
37d283cb38
Fix build break ( #278 )
...
- Fix warning due to use of deprecated function.
This was causing a build issue in the hava and csharp bindings
- Lock use of csbindgen@1.9.0
The newer version 1.9.2 causes a "type of namespace C could not be fond" error
In the generated code, struct inherits from C instead of uint
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-07-12 05:28:25 +05:30
Anand Krishnamoorthi
46e28b36f8
feat: get_policies: Way to obtain policy files and content ( #267 )
...
closes #254
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-06-19 00:01:55 -07:00
Anand Krishnamoorthi
ee898e112e
Update binding versions for next release ( #270 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-06-18 23:39:12 -07:00
Anand Krishnamoorthi
df98c8d168
Provide ability to get JSON representation of policy AST ( #266 )
...
closes #265
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-06-08 18:58:30 -07:00
Anand Krishnamoorthi
97914d5596
Revert "chore: release v0.2.0 ( #257 )" ( #258 )
...
This reverts commit ffb79f1b30 .
2024-05-30 06:09:47 -07:00
Anand Krishnamoorthi
ffb79f1b30
chore: release v0.2.0 ( #257 )
...
v0.2.0
Signed-off-by: Anand Krishnamoorthi <35780660+anakrish@users.noreply.github.com >
---------
Signed-off-by: Anand Krishnamoorthi <35780660+anakrish@users.noreply.github.com >
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-30 05:45:43 -07:00
Anand Krishnamoorthi
d09c445add
Update bindings to include newer APIs ( #250 )
...
- c, cpp
- csharp
- ffi
- go
- Java
- Python
- WASM
`arc` feature is turned on for all bindings
Use pretty string instead of colored string.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-05-25 10:24:06 -07:00
thedavemarshall
33fe9d5039
update ruby bindings version to 0.1.5, bump deps ( #251 )
...
* update ruby bindings version to 0.1.5, bump deps
* update ruby bindings for coverage and print methods
2024-05-24 07:57:39 -07:00
Anand Krishnamoorthi
9894f00829
Fix bindings and add CI tests ( #247 )
...
Also update version numbers of binding Rust projects to match Regorus
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-05-22 08:15:42 -07:00
Anand Krishnamoorthi
67f65c0561
c_no_std binding to show use in C freestanding environments. (#238 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-05-17 18:31:11 -07:00
Anand Krishnamoorthi
de56cce7cb
Fix anyhow dependency issues ( #208 )
...
- Do not require backtrace feature
- Starting version 1.0.77, anyhow gathers backtrace is std feature (enabled by default)
is specified even if backtrace feature is not enabled.
Therefore specify default features as false.
- Specify version 1.0.45 since that is the minimul version required to successfully
compile regorus
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-04-20 09:57:52 -07:00
Anand Krishnamoorthi
bb1b25ff2f
chore: release ( #137 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-08 07:09:22 -08:00
Anand Krishnamoorthi
dda525b989
C++ binding ( #129 )
...
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-02-05 00:22:27 -08:00
Anand Krishnamoorthi
22260ac46f
Bindings for C, C#, Golang ( #124 )
...
* FFI bindings
Generate C FFI as well as C# FFI
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
* Regorus C binding
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
* C# binding
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
* Golang binding
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
---------
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com >
2024-02-04 19:50:44 -08:00