rond-authz/rond

Improve SDK request evaluator interface

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe

The PolicyEvaluation function, when the policy fails, returns an error. The SDK should returns the PolicyResult with Allowed set to false instead, since it is more usable.

rond/sdk/evaluator.go

Lines 97 to 108 in d8c2c8b

// TODO: here if the evaluation result false, it is returned an error. This interface
// for the sdk should be improved, since it should use the PolicyResult and return error
// only if there is some error in policy evaluation.
_, query, err := evaluatorAllowPolicy.PolicyEvaluation(logger, e.policyEvaluationOptions)
if err != nil {
logger.WithField("error", map[string]any{
"policyName": rondConfig.RequestFlow.PolicyName,
"message": err.Error(),
}).Error("RBAC policy evaluation failed")
return PolicyResult{}, err
}