Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update main from upstream #3

Merged
merged 66 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3ac9b11
Lockdown kata test prints as well as prints of various values (#249)
anakrish May 23, 2024
3d08f6e
Use correct docsrs feature annotation (#248)
anakrish May 23, 2024
33fe9d5
update ruby bindings version to 0.1.5, bump deps (#251)
thedavemarshall May 24, 2024
d09c445
Update bindings to include newer APIs (#250)
anakrish May 25, 2024
2b82f28
Fix merge issue (#252)
anakrish May 25, 2024
ff0adf0
every: non collections should evaluate to false (#253)
anakrish May 28, 2024
536c6ed
Fix release-plz hash (#256)
anakrish May 30, 2024
ffb79f1
chore: release v0.2.0 (#257)
anakrish May 30, 2024
97914d5
Revert "chore: release v0.2.0 (#257)" (#258)
anakrish May 30, 2024
5eda76f
Add release-plz config to publish only regorus package (#259)
anakrish May 30, 2024
658f347
chore: release (#260)
anakrish May 30, 2024
e62bfdf
Allow lexer to be used for other policy languages (#262)
anakrish Jun 5, 2024
25902ba
Update OPA tests to v0.65.0 (#264)
anakrish Jun 5, 2024
df98c8d
Provide ability to get JSON representation of policy AST (#266)
anakrish Jun 9, 2024
45627aa
Suppress clippy unused warning (#269)
anakrish Jun 18, 2024
e6f2ec8
rename method from 'Clone' to 'clone' in 'Engine' class to match the …
balcanuc Jun 19, 2024
ee898e1
Update binding versions for next release (#270)
anakrish Jun 19, 2024
46e28b3
feat: get_policies: Way to obtain policy files and content (#267)
anakrish Jun 19, 2024
4a2a724
Fix c,cpp,no-std binding examples (#272)
anakrish Jun 19, 2024
5a0048c
chore: release (#271)
anakrish Jun 19, 2024
292948a
Update to OPA v0.66.0 (#274)
anakrish Jun 28, 2024
25dbd27
Update pyo3 requirement from 0.21.0 to 0.22.0 (#275)
dependabot[bot] Jul 1, 2024
37d283c
Fix build break (#278)
anakrish Jul 11, 2024
fb5151e
add extension_list example (#281)
yangjie-msft Jul 16, 2024
6e1f8cd
build.rs create hooks dir if not exists (#283)
sneivandt Jul 21, 2024
7095e26
fix: Handle aliases in scheduler (#285)
anakrish Jul 27, 2024
6599ce6
feat: Update to opa v0.67.0 (#286)
anakrish Jul 28, 2024
20eece5
Update binding versions (#287)
anakrish Jul 28, 2024
f0576ce
Update readme (#288)
anakrish Jul 28, 2024
52afcbe
chore: release (#289)
anakrish Jul 28, 2024
ef549a6
fix: Merge data to init document (#293)
anakrish Aug 7, 2024
430a453
Update csbindgen requirement from =1.9.0 to =1.9.3 (#292)
dependabot[bot] Aug 7, 2024
e4a58ad
Bump rexml in /bindings/ruby in the bundler group across 1 directory …
dependabot[bot] Aug 7, 2024
a488a84
fix: Match OPA behavior for split (#295)
anakrish Aug 8, 2024
6bf40c7
Update cbindgen requirement from 0.26.0 to 0.27.0 (#296)
dependabot[bot] Aug 12, 2024
dff65f0
chore: release (#298)
anakrish Aug 16, 2024
fec6f8f
Bump rexml in /bindings/ruby in the bundler group across 1 directory …
dependabot[bot] Aug 22, 2024
edd0ccc
fix: Issues #302, #303 (#304)
anakrish Aug 29, 2024
af50714
feat: OPA v0.68.0. Engine::set_rego_v1 (#305)
anakrish Aug 30, 2024
a4a80d7
fix: Propagate errors encountered in argument evaluation (#308)
anakrish Aug 31, 2024
8003cfc
fix: Handle parsing corner cases (#309)
anakrish Sep 4, 2024
502b830
chore: release (#310)
anakrish Sep 4, 2024
b6935d1
fix: Update readme with correct path to example policy (#312)
anakrish Sep 10, 2024
ecd341b
Add tests for builtin strings::indexof method (#311)
Sumynwa Sep 11, 2024
8498274
Add tests for builtin strings::lower method (#313)
Sumynwa Sep 11, 2024
7565ec3
feat: or keyword (#315)
anakrish Sep 13, 2024
334db3d
Update chrono-tz requirement from 0.8.5 to 0.10.0 (#316)
dependabot[bot] Sep 16, 2024
dc0f48f
Update jsonschema requirement from 0.18.0 to 0.19.1 (#317)
dependabot[bot] Sep 16, 2024
adb9da0
fix: Null terminate C# strings in Rust boundary (#318)
anakrish Sep 18, 2024
d2b27ee
chore: release (#320)
anakrish Sep 18, 2024
13d8289
chore: update to jsonschema 0.20.0 (#323)
anakrish Sep 23, 2024
f0a3cf2
build(deps): update jsonschema requirement from 0.20.0 to 0.21.0 (#325)
dependabot[bot] Sep 30, 2024
dcd040c
build(deps): update jsonschema requirement from 0.21.0 to 0.22.3 (#326)
dependabot[bot] Oct 7, 2024
37262cc
chore: update to OPA v0.69.0 (#327)
anakrish Oct 9, 2024
ce6ecd6
feat: integer conversion functions for Value (#328)
anakrish Oct 9, 2024
992b202
chore: release (#329)
anakrish Oct 9, 2024
df73b20
build(deps): update jsonschema requirement from 0.22.3 to 0.23.0 (#331)
anakrish Oct 15, 2024
00f45c7
build(deps): update jsonschema requirement from 0.23.0 to 0.24.0 (#332)
dependabot[bot] Oct 21, 2024
61f82d1
fix: docs failing to build (#334)
anakrish Oct 22, 2024
c56da34
chore: release (#335)
anakrish Oct 22, 2024
5bf7cd7
build(deps): bump rexml (#337)
dependabot[bot] Nov 4, 2024
1bfe38f
fix: Lock wasm-bindgen version to 0.2.94 (#342)
anakrish Nov 6, 2024
c281d28
chore: Update to OPA v0.70.0 (#341)
anakrish Nov 6, 2024
4ec25f3
build(deps): update jsonschema requirement from 0.24.0 to 0.26.1 (#343)
anakrish Nov 6, 2024
cabd086
chore: release (#344)
anakrish Nov 6, 2024
d955ae1
build(deps): update prettydiff requirement from 0.7.0 to 0.8.0 (#348)
dependabot[bot] Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Match OPA behavior for split (microsoft#295)
In case of empty delimiter, Rust's split returns leading and trailing
empty strings whereas Golang's doesn't.
Change behavior to match Golang/OPA.

fixes microsoft#291

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
  • Loading branch information
anakrish authored Aug 8, 2024
commit a488a84969cbd65971910a3804391d24c5773c8d
13 changes: 10 additions & 3 deletions src/builtins/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,18 @@ fn split(span: &Span, params: &[Ref<Expr>], args: &[Value], _strict: bool) -> Re
let s = ensure_string(name, &params[0], &args[0])?;
let delimiter = ensure_string(name, &params[1], &args[1])?;

Ok(Value::from_array(
// Handle https://github.com/microsoft/regorus/issues/291
let parts: Vec<Value> = if delimiter.as_ref() == "" {
// If delimiter is "", str::split returns a leading and trailing "" whereas Golang's split doesn't.
// Therefore avoid str::split and instead return each char as a Value::String.
s.chars().map(|c| Value::from(c.to_string())).collect()
} else {
s.split(delimiter.as_ref())
.map(|s| Value::String(s.into()))
.collect(),
))
.collect()
};

Ok(Value::from(parts))
}

fn to_string(v: &Value, unescape: bool) -> String {
Expand Down
17 changes: 17 additions & 0 deletions tests/interpreter/cases/builtins/strings/split.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cases:
- note: empty separator
data: {}
modules: []
query: "x := split(\"test\", \"\")"
want_result:
x: ["t", "e", "s", "t"]

- note: empty separator, empty string
data: {}
modules: []
query: "x := split(\"\", \"\")"
want_result:
x: []