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

Add verify functions for encodings (eg base64) #2690

Closed
carlpett opened this issue Sep 10, 2020 · 0 comments
Closed

Add verify functions for encodings (eg base64) #2690

carlpett opened this issue Sep 10, 2020 · 0 comments

Comments

@carlpett
Copy link
Contributor

Currently it is not possible to verify input is in some specific encoding, such as base64. The only option I've found is letting the decode function abort with an error, which isn't quite as nice as a policy failure.

Expected Behavior

_ := base64.verify("not-base64") # false
_ := base64.verify("YWN0dWFsbHktYmFzZTY0") # true

Actual Behavior

_ := base64.decode("not-base64") # ERROR
carlpett added a commit to carlpett/opa that referenced this issue Sep 21, 2020
Adds a builtin to check if a string is valid base64

Fixes: open-policy-agent#2690

Signed-off-by: Calle Pettersson <calle@cape.nu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants