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

topdown+builtins: Block all ND builtins from partial eval. #5172

Conversation

philipaconrad
Copy link
Contributor

This commit removes the IgnoreDuringPartialEval list in ast/builtins, and instead changes the partial evaluator to simply ignore all non-deterministic builtins. This keeps true to the intent of the original list, and reduces the potential for human error in maintenance in the future.

Fixes: #5171

This commit removes the `IgnoreDuringPartialEval` list in
`ast/builtins`, and instead changes the partial evaluator to simply
ignore all non-deterministic builtins. This keeps true to the intent of
the original list, and reduces the potential for human error in
maintenance in the future.

Fixes: open-policy-agent#5171

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit a0be1dd
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/632d1dd8bd53ac00087a9c64
😎 Deploy Preview https://deploy-preview-5172--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@anderseknert anderseknert merged commit d56d3b6 into open-policy-agent:main Sep 23, 2022
// IgnoreDuringPartialEval is a set of built-in functions that should not be
// evaluated during partial evaluation. These functions are not partially
// evaluated because they are not pure.
var IgnoreDuringPartialEval = []*Builtin{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Removing a public field is breaking compatibility. We'll need to call this out, and mention a workaround in the release notes.

philipaconrad added a commit to philipaconrad/opa that referenced this pull request Sep 23, 2022
This commit is a followup to the work done in PR open-policy-agent#5172, and partially
reverts the changes there to avoid breaking library users of OPA.

The fix restores the `IgnoreDuringPartialEval` list while still
ensuring that non-deterministic builtins are not run during partial
evaluation.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
srenatus pushed a commit that referenced this pull request Sep 26, 2022
This commit is a followup to the work done in PR #5172, and partially
reverts the changes there to avoid breaking library users of OPA.

The fix restores the `IgnoreDuringPartialEval` list while still
ensuring that non-deterministic builtins are not run during partial
evaluation.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-deterministic builtin functions can break policies run through partial evaluation
3 participants