Hi team,
We're hitting an issue where the %q format verb in Rego's sprintf function isn't being handled correctly by the WASM runtime. In standard OPA (non-WASM), %q wraps a string value in double quotes and escapes special characters, but when the same policy is evaluated via the WASM build, it fails.
Example:
package example
result := sprintf("requested %q is invalid", ["String"])
Expected output (standard OPA):
"requested "String" is invalid"
Actual output (WASM):
[throws exception]
for %s
result := sprintf("requested %s is invalid", ["String"])
output for both wasm and standard OPA:
"requested String is invalid"
We're currently working around this by switching %q to %s in our policies, but it would be great to have %q supported natively since it's part of the standard Rego sprintf spec. Could you let us know if support for %q is on the roadmap?
version: 1.0.2
Thanks!
Hi team,
We're hitting an issue where the %q format verb in Rego's sprintf function isn't being handled correctly by the WASM runtime. In standard OPA (non-WASM), %q wraps a string value in double quotes and escapes special characters, but when the same policy is evaluated via the WASM build, it fails.
Example:
package example
result := sprintf("requested %q is invalid", ["String"])
Expected output (standard OPA):
"requested "String" is invalid"
Actual output (WASM):
[throws exception]
for %s
result := sprintf("requested %s is invalid", ["String"])
output for both wasm and standard OPA:
"requested String is invalid"
We're currently working around this by switching %q to %s in our policies, but it would be great to have %q supported natively since it's part of the standard Rego sprintf spec. Could you let us know if support for %q is on the roadmap?
version: 1.0.2
Thanks!