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

Rule name hides builtin functions thus "undefined function" on call #2567

Closed
SuchSkill opened this issue Jul 22, 2020 · 3 comments
Closed

Rule name hides builtin functions thus "undefined function" on call #2567

SuchSkill opened this issue Jul 22, 2020 · 3 comments
Labels

Comments

@SuchSkill
Copy link

Running rego with rule name the same as builtin function will produce obscure error.

package play
regex{
	regex.split(" ", "str ing")
}

Expected Behavior

Forbid rule name that may hide builtin functions

Actual Behavior

1 error occurred: policy.rego:5: rego_type_error: undefined function data.play.regex.split

Steps to Reproduce the Problem

https://play.openpolicyagent.org/p/5gNrsNDZBV

@tsandall
Copy link
Member

@SuchSkill thanks for a filing an issue!

As is, rejecting rules that overlap with built-in functions would be problematic since addition of any new built-in functions could potentially break existing policies. We definitely do not want that.

I'm not sure there is a great way around this. One option is to namespace all builtins under a reserved keyword (e.g., builtin) however that would need to be done over time in a backwards compatible manner.

@tsandall
Copy link
Member

tsandall commented Aug 7, 2020

This is related to #2600.

@tsandall
Copy link
Member

tsandall commented Dec 2, 2021

Closing this for now because we can't reject polices that redefine built-in functions as that would make any new built-in function addition (potentially) backwards incompatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants