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

ConditionEvaluators.java -> throwing exception when conditional evaluates to false. #73

Closed
lukasz-szewc opened this issue Dec 29, 2022 · 0 comments

Comments

@lukasz-szewc
Copy link

lukasz-szewc commented Dec 29, 2022

Software version (AuthzForce Core)

(current master)

Platform JRE

Platform OS

Error stack trace or logs (if any)

If in doubt include the whole thing; often exceptions get wrapped in other exceptions and the exception right near the bottom explains the actual error, not the first few lines at the top.

Your code and/or AuthzForce-specific configuration file(s)

https://github.com/authzforce/core/blob/develop/pdp-engine/src/main/java/org/ow2/authzforce/core/pdp/impl/rule/ConditionEvaluators.java

The following part of code puzzles me:

final Optional<BooleanValue> constant = evaluableExpression.getValue(); if (constant.isPresent()) { if (constant.get().getUnderlyingValue()) { // constant TRUE LOGGER.warn("Condition's expression is equivalent to constant True -> optimization: replacing with constant True condition"); return TRUE_CONDITION; } // constant False -> unacceptable throw INVALID_CONSTANT_FALSE_EXPRESSION_EXCEPTION; }

What is motivation behind this exception throwing, especially is it driven by the specification?
What would happen if that exception throwing line would not be present? Would Policy be considered "valid" and evaluates normally - with condition evaluating into false

cdanger added a commit that referenced this issue Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant