Skip to content

Commit

Permalink
Fix entity manifest fuzz target (#520)
Browse files Browse the repository at this point in the history
Signed-off-by: John Kastner <[email protected]>
  • Loading branch information
john-h-kastner-aws authored Jan 16, 2025
1 parent b5a6952 commit 403f256
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cedar-drt/fuzz/fuzz_targets/entity-slicing-drt-type-directed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use cedar_policy_generators::{
schema::Schema,
settings::ABACSettings,
};
use cedar_policy_validator::entity_manifest::compute_entity_manifest;
use cedar_policy_validator::entity_manifest::{compute_entity_manifest, EntityManifestError};
use cedar_policy_validator::{ValidationMode, Validator, ValidatorSchema};
use libfuzzer_sys::arbitrary::{self, Arbitrary, Unstructured};
use log::debug;
Expand Down Expand Up @@ -129,8 +129,13 @@ fuzz_target!(|input: FuzzTargetInput| {
policyset.add_static(policy.clone()).unwrap();
if passes_validation(&validator, &policyset) {
// policy successfully validated, do entity slicing
let manifest = compute_entity_manifest(&schema, &policyset)
.expect("failed to produce entity manifest");
let manifest = match compute_entity_manifest(&schema, &policyset) {
Ok(manifest) => manifest,
Err(EntityManifestError::UnsupportedCedarFeature(_)) => {
return;
}
Err(e) => panic!("failed to produce an entity manifest: {e}"),
};

let authorizer = Authorizer::new();
debug!("Policies: {policyset}");
Expand Down

0 comments on commit 403f256

Please sign in to comment.