Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cedar_drt_inner::*;
use cedar_policy_core::ast;
use cedar_policy_core::authorizer::{AuthorizationError, Authorizer};
use cedar_policy_core::entities::Entities;
use cedar_policy_core::evaluator::EvaluationErrorKind;
use cedar_policy_core::evaluator::EvaluationError;
use cedar_policy_generators::{
abac::{ABACPolicy, ABACRequest},
hierarchy::{Hierarchy, HierarchyGenerator},
Expand Down Expand Up @@ -142,29 +142,27 @@ fuzz_target!(|input: FuzzTargetInput| {
.iter()
.filter_map(|error| match error {
AuthorizationError::PolicyEvaluationError { error, .. } => {
match error.error_kind() {
match error {
// Evaluation errors the validator should prevent.
EvaluationErrorKind::UnspecifiedEntityAccess(_)
| EvaluationErrorKind::RecordAttrDoesNotExist(_, _)
| EvaluationErrorKind::EntityAttrDoesNotExist { .. }
| EvaluationErrorKind::FailedExtensionFunctionLookup(_)
| EvaluationErrorKind::TypeError { .. }
| EvaluationErrorKind::WrongNumArguments { .. } => {
EvaluationError::UnspecifiedEntityAccess(_)
| EvaluationError::RecordAttrDoesNotExist(_)
| EvaluationError::EntityAttrDoesNotExist(_)
| EvaluationError::FailedExtensionFunctionLookup(_)
| EvaluationError::TypeError(_)
| EvaluationError::WrongNumArguments(_) => {
Some(error.to_string())
}
// Evaluation errors it shouldn't prevent. Not
// written with a catch all so that we must
// consider if a new error type should cause
// this target to fail.
EvaluationErrorKind::EntityDoesNotExist(_)
| EvaluationErrorKind::IntegerOverflow(_)
| EvaluationErrorKind::InvalidRestrictedExpression(_)
| EvaluationErrorKind::UnlinkedSlot(_)
| EvaluationErrorKind::FailedExtensionFunctionApplication {
..
}
| EvaluationErrorKind::NonValue(_)
| EvaluationErrorKind::RecursionLimit => None,
EvaluationError::EntityDoesNotExist(_)
| EvaluationError::IntegerOverflow(_)
| EvaluationError::InvalidRestrictedExpression(_)
| EvaluationError::UnlinkedSlot(_)
| EvaluationError::FailedExtensionFunctionExecution(_)
| EvaluationError::NonValue(_)
| EvaluationError::RecursionLimit(_) => None,
}
}
})
Expand Down
32 changes: 15 additions & 17 deletions cedar-drt/fuzz/fuzz_targets/validation-pbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cedar_drt_inner::*;
use cedar_policy_core::ast;
use cedar_policy_core::authorizer::{AuthorizationError, Authorizer};
use cedar_policy_core::entities::Entities;
use cedar_policy_core::evaluator::EvaluationErrorKind;
use cedar_policy_core::evaluator::EvaluationError;
use cedar_policy_generators::{
abac::{ABACPolicy, ABACRequest},
err::{Error, Result},
Expand Down Expand Up @@ -363,29 +363,27 @@ fuzz_target!(|input: FuzzTargetInput| {
.iter()
.filter_map(|error| match error {
AuthorizationError::PolicyEvaluationError { error, .. } => {
match error.error_kind() {
match error {
// Evaluation errors the validator should prevent.
EvaluationErrorKind::UnspecifiedEntityAccess(_)
| EvaluationErrorKind::RecordAttrDoesNotExist(_, _)
| EvaluationErrorKind::EntityAttrDoesNotExist { .. }
| EvaluationErrorKind::FailedExtensionFunctionLookup(_)
| EvaluationErrorKind::TypeError { .. }
| EvaluationErrorKind::WrongNumArguments { .. } => {
EvaluationError::UnspecifiedEntityAccess(_)
| EvaluationError::RecordAttrDoesNotExist(_)
| EvaluationError::EntityAttrDoesNotExist(_)
| EvaluationError::FailedExtensionFunctionLookup(_)
| EvaluationError::TypeError(_)
| EvaluationError::WrongNumArguments(_) => {
Some(error.to_string())
}
// Evaluation errors it shouldn't prevent. Not
// written with a catch all so that we must
// consider if a new error type should cause
// this target to fail.
EvaluationErrorKind::EntityDoesNotExist(_)
| EvaluationErrorKind::IntegerOverflow(_)
| EvaluationErrorKind::InvalidRestrictedExpression(_)
| EvaluationErrorKind::UnlinkedSlot(_)
| EvaluationErrorKind::FailedExtensionFunctionApplication {
..
}
| EvaluationErrorKind::NonValue(_)
| EvaluationErrorKind::RecursionLimit => None,
EvaluationError::EntityDoesNotExist(_)
| EvaluationError::IntegerOverflow(_)
| EvaluationError::InvalidRestrictedExpression(_)
| EvaluationError::UnlinkedSlot(_)
| EvaluationError::FailedExtensionFunctionExecution(_)
| EvaluationError::NonValue(_)
| EvaluationError::RecursionLimit(_) => None,
}
}
})
Expand Down