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

Updates for cedar#837 #346

Merged
merged 1 commit into from
Jun 4, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ fuzz_target!(|input: FuzzTargetInput| {
// this target to fail.
EvaluationError::EntityDoesNotExist(_)
| EvaluationError::IntegerOverflow(_)
| EvaluationError::InvalidRestrictedExpression(_)
| EvaluationError::UnlinkedSlot(_)
| EvaluationError::FailedExtensionFunctionExecution(_)
| EvaluationError::NonValue(_)
Expand Down
1 change: 0 additions & 1 deletion cedar-drt/fuzz/fuzz_targets/validation-pbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ fuzz_target!(|input: FuzzTargetInput| {
// this target to fail.
EvaluationError::EntityDoesNotExist(_)
| EvaluationError::IntegerOverflow(_)
| EvaluationError::InvalidRestrictedExpression(_)
| EvaluationError::UnlinkedSlot(_)
| EvaluationError::FailedExtensionFunctionExecution(_)
| EvaluationError::NonValue(_)
Expand Down
4 changes: 2 additions & 2 deletions cedar-drt/fuzz/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ 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()),
context: dump_context(
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()
Expand Down
3 changes: 1 addition & 2 deletions cedar-drt/fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}"),
)
}
Expand Down
3 changes: 1 addition & 2 deletions cedar-drt/src/lean_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -180,7 +179,7 @@ impl LeanDefinitionalEngine {
// coerce to PolicyId just to ensure it's valid
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment might be outdated now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, too quick with my merge - will try to remember to update next time I touch this code (this will likely be soon as I continue to muck with the FFI)

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 {
Expand Down
Loading