From 9403345ce0127ea3dc6ad7049395c9365393d746 Mon Sep 17 00:00:00 2001 From: Kesha Hietala Date: Mon, 3 Jun 2024 20:39:00 +0000 Subject: [PATCH] Updates for cedar#837 --- cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs | 1 - cedar-drt/fuzz/fuzz_targets/validation-pbt.rs | 1 - cedar-drt/fuzz/src/dump.rs | 4 ++-- cedar-drt/fuzz/src/lib.rs | 3 +-- cedar-drt/src/lean_impl.rs | 3 +-- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs b/cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs index 7ccadce64..ee50c8e37 100644 --- a/cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs +++ b/cedar-drt/fuzz/fuzz_targets/validation-pbt-type-directed.rs @@ -158,7 +158,6 @@ fuzz_target!(|input: FuzzTargetInput| { // this target to fail. EvaluationError::EntityDoesNotExist(_) | EvaluationError::IntegerOverflow(_) - | EvaluationError::InvalidRestrictedExpression(_) | EvaluationError::UnlinkedSlot(_) | EvaluationError::FailedExtensionFunctionExecution(_) | EvaluationError::NonValue(_) diff --git a/cedar-drt/fuzz/fuzz_targets/validation-pbt.rs b/cedar-drt/fuzz/fuzz_targets/validation-pbt.rs index 848c353fa..169a017cd 100644 --- a/cedar-drt/fuzz/fuzz_targets/validation-pbt.rs +++ b/cedar-drt/fuzz/fuzz_targets/validation-pbt.rs @@ -379,7 +379,6 @@ fuzz_target!(|input: FuzzTargetInput| { // this target to fail. EvaluationError::EntityDoesNotExist(_) | EvaluationError::IntegerOverflow(_) - | EvaluationError::InvalidRestrictedExpression(_) | EvaluationError::UnlinkedSlot(_) | EvaluationError::FailedExtensionFunctionExecution(_) | EvaluationError::NonValue(_) diff --git a/cedar-drt/fuzz/src/dump.rs b/cedar-drt/fuzz/src/dump.rs index a0be3a496..79a463285 100644 --- a/cedar-drt/fuzz/src/dump.rs +++ b/cedar-drt/fuzz/src/dump.rs @@ -96,7 +96,7 @@ pub fn dump( .into_iter() .enumerate() .map(|(i, (q, a))| JsonRequest { - desc: format!("Request {i}"), + description: format!("Request {i}"), principal: dump_request_var(q.principal()), action: dump_request_var(q.action()), resource: dump_request_var(q.resource()), @@ -104,7 +104,7 @@ pub fn dump( q.context() .expect("`dump` does not support requests missing context"), ), - enable_request_validation: true, + validate_request: true, decision: a.decision, reason: cedar_policy::Response::from(a.clone()) .diagnostics() diff --git a/cedar-drt/fuzz/src/lib.rs b/cedar-drt/fuzz/src/lib.rs index 35cac110f..6b549c8b0 100644 --- a/cedar-drt/fuzz/src/lib.rs +++ b/cedar-drt/fuzz/src/lib.rs @@ -38,7 +38,6 @@ pub use cedar_testing::cedar_test_impl::{ use libfuzzer_sys::arbitrary::{self, Unstructured}; use log::info; use miette::miette; -use smol_str::ToSmolStr; use std::collections::HashSet; /// Times for cedar-policy authorization and validation. @@ -138,7 +137,7 @@ pub fn run_auth_test( .map(|err| match err { AuthorizationError::PolicyEvaluationError { id, .. } => { ffi::AuthorizationError::new_from_report( - id.to_smolstr(), + PolicyId::new(id.clone()), miette!("{id}"), ) } diff --git a/cedar-drt/src/lean_impl.rs b/cedar-drt/src/lean_impl.rs index 6b58dfdca..f33513487 100644 --- a/cedar-drt/src/lean_impl.rs +++ b/cedar-drt/src/lean_impl.rs @@ -41,7 +41,6 @@ use lean_sys::{ use log::info; use miette::miette; use serde::Deserialize; -use smol_str::ToSmolStr; use std::ffi::CStr; use std::str::FromStr; @@ -180,7 +179,7 @@ impl LeanDefinitionalEngine { // coerce to PolicyId just to ensure it's valid let pid = cedar_policy::PolicyId::from_str(&x) .expect("could not coerce policy id"); - ffi::AuthorizationError::new_from_report(pid.to_smolstr(), miette!("{pid}")) + ffi::AuthorizationError::new_from_report(pid.clone(), miette!("{pid}")) }) .collect(); TestResult::Success(TestResponse {