feat: make policy length limits configurable per engine#624
feat: make policy length limits configurable per engine#624anakrish merged 1 commit intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree company="Amazon" |
8760832 to
f15e958
Compare
|
I added setters to |
anakrish
left a comment
There was a problem hiding this comment.
@antmhs Looks good. Some more feedback about comments and test.
Ideally, we would want to also expose this new config to bindings. But we can do that in a second PR. Are you primarily a Rust based client? Another user from Amazon was mainly Java based.
f15e958 to
d495293
Compare
|
Updated the comments and added the test for
|
bindings/java/src/main/java/com/microsoft/regorus/PolicyLengthConfig.java
Show resolved
Hide resolved
d495293 to
6d77a0a
Compare
|
Addressed the comments. Also, the workflow was failing because the column width was lowered to 200 in the bindings, now it's 2000 which should pass. |
- Add PolicyLengthConfig struct with max_col, max_file_bytes, and max_lines fields, replacing hardcoded constants in the lexer. - Add Engine::set_policy_length_config and clear_policy_length_config to allow callers to override the default limits. - Add Source::from_contents_with_limits and from_file_with_limits for direct Source construction with custom limits; existing from_contents and from_file signatures are preserved using defaults. - Add tests for default rejection, custom limits, and engine plumbing. - Add bindings for C, C++, Python, WASM/JS, Java, Ruby, C#, Go
6d77a0a to
f14467f
Compare
|
Missed one config in |
anakrish
left a comment
There was a problem hiding this comment.
LGTM. Thank you for the contribution!
Trying to update to the latest regorus version pulled in #531 which broke some things on my end. This change makes it so the policy length limits are configurable (the limits from #531 are still the default, though).
Implemented: