Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 5e64bec
Author: John Kastner <jkastner@amazon.com>
Date:   Thu Mar 6 18:56:34 2025 +0000

    Extend typechecker inversion lemma for type annotation

    Signed-off-by: John Kastner <jkastner@amazon.com>

commit a33231a
Author: shaobo-he-aws <130499339+shaobo-he-aws@users.noreply.github.com>
Date:   Thu Mar 6 07:22:38 2025 -0800

    TPE Lean model (#548)

    Signed-off-by: Shaobo He <shaobohe@amazon.com>

commit 582a8cb
Author: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
Date:   Wed Mar 5 11:48:14 2025 -0500

    Cases for `datetime` types in `extExprToValue` (#568)

    Signed-off-by: Adrian Palacios <accorell@amazon.com>

commit ee3715f
Author: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
Date:   Tue Mar 4 16:05:17 2025 -0500

    Add types and methods from `datetime` extension to parsers (#565)

    Signed-off-by: Adrian Palacios <accorell@amazon.com>

commit 183be85
Author: Craig Disselkoen <cdiss@amazon.com>
Date:   Tue Mar 4 13:01:15 2025 -0800

    [lean] remove JSON deserializer for internal JSON format (#567)

    Signed-off-by: Craig Disselkoen <cdiss@amazon.com>

commit 71e13dc
Author: Craig Disselkoen <cdiss@amazon.com>
Date:   Tue Mar 4 12:20:55 2025 -0800

    remove partial-auth and partial-eval DRT targets (#566)

    Signed-off-by: Craig Disselkoen <cdiss@amazon.com>

commit 434f09f
Author: Craig Disselkoen <cdiss@amazon.com>
Date:   Tue Mar 4 06:04:25 2025 -0800

    use Protobuf for additional DRT targets (#562)

    Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
  • Loading branch information
john-h-kastner-aws committed Mar 6, 2025
1 parent 05784b1 commit b492c16
Show file tree
Hide file tree
Showing 41 changed files with 1,549 additions and 1,351 deletions.
12 changes: 0 additions & 12 deletions cedar-drt/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ path = "fuzz_targets/abac-type-directed.rs"
test = false
doc = false

[[bin]]
name = "partial-eval"
path = "fuzz_targets/partial-eval.rs"
test = false
doc = false

[[bin]]
name = "partial-auth"
path = "fuzz_targets/partial-auth.rs"
test = false
doc = false

[[bin]]
name = "roundtrip"
path = "fuzz_targets/roundtrip.rs"
Expand Down
128 changes: 0 additions & 128 deletions cedar-drt/fuzz/fuzz_targets/partial-auth.rs

This file was deleted.

133 changes: 0 additions & 133 deletions cedar-drt/fuzz/fuzz_targets/partial-eval.rs

This file was deleted.

18 changes: 8 additions & 10 deletions cedar-drt/fuzz/fuzz_targets/protobuf-roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

use libfuzzer_sys::arbitrary::{self, MaxRecursionReached};
use prost::Message;
use serde::Serialize;

use crate::arbitrary::Arbitrary;
use crate::arbitrary::Unstructured;
use cedar_drt::{AuthorizationRequestMsg, OwnedAuthorizationRequestMsg};
use cedar_drt::{AuthorizationRequest, OwnedAuthorizationRequest};
use cedar_drt_inner::{fuzz_target, schemas::Equiv};
use cedar_policy::proto;
use cedar_policy_core::{
Expand All @@ -34,9 +33,8 @@ use cedar_policy_generators::{
settings::ABACSettings,
};

#[derive(Debug, Clone, Serialize)]
#[derive(Debug, Clone)]
struct FuzzTargetInput {
#[serde(skip)]
request: ABACRequest,
policy: ABACPolicy,
entities: Entities,
Expand Down Expand Up @@ -97,27 +95,27 @@ fuzz_target!(|input: FuzzTargetInput| {
let s_policy: ast::StaticPolicy = input.policy.into();
let mut policies: ast::PolicySet = ast::PolicySet::new();
policies.add(s_policy.into()).expect("Failed to add policy");
roundtrip_authz_request_msg(AuthorizationRequestMsg {
roundtrip_authz_request_msg(AuthorizationRequest {
request: &input.request.into(),
policies: &policies,
entities: &input.entities,
});
roundtrip_schema(input.schema);
});

fn roundtrip_authz_request_msg(auth_request: AuthorizationRequestMsg) {
fn roundtrip_authz_request_msg(auth_request: AuthorizationRequest) {
// AST -> Protobuf
let auth_request_proto = cedar_drt::proto::AuthorizationRequestMsg::from(&auth_request);
let auth_request_proto = cedar_drt::proto::AuthorizationRequest::from(&auth_request);

// Protobuf -> Bytes
let buf = auth_request_proto.encode_to_vec();

// Bytes -> Protobuf
let roundtripped_proto = cedar_drt::proto::AuthorizationRequestMsg::decode(&buf[..])
.expect("Failed to deserialize AuthorizationRequestMsg from proto");
let roundtripped_proto = cedar_drt::proto::AuthorizationRequest::decode(&buf[..])
.expect("Failed to deserialize AuthorizationRequest from proto");

// Protobuf -> AST
let roundtripped = OwnedAuthorizationRequestMsg::from(roundtripped_proto);
let roundtripped = OwnedAuthorizationRequest::from(roundtripped_proto);

// Checking request equality (ignores loc field)
assert_eq!(
Expand Down
3 changes: 1 addition & 2 deletions cedar-drt/fuzz/fuzz_targets/wildcard-matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ use cedar_drt_inner::fuzz_target;
use cedar_policy_core::ast::{Pattern, PatternElem};
use libfuzzer_sys::arbitrary::{self, Arbitrary, Result, Unstructured};
use regex::{escape, Regex};
use serde::Serialize;

/// Input expected by this fuzz target:
/// A pattern and a string that matches it
#[derive(Debug, Clone, Serialize)]
#[derive(Debug, Clone)]
struct FuzzTargetInput {
/// generated pattern
pub pattern: Vec<PatternElem>,
Expand Down
Loading

0 comments on commit b492c16

Please sign in to comment.