Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into shaobo/update-for-1210
Browse files Browse the repository at this point in the history
  • Loading branch information
shaobo-he-aws committed Oct 1, 2024
2 parents 39db69c + 8ade154 commit 7b8b0b4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cedar-drt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ publish = false
env_logger = "0.10"
log = "0.4"
libfuzzer-sys = "0.4"
cedar-policy = { path = "../cedar/cedar-policy", version = "4.*" }
cedar-policy-core = { path = "../cedar/cedar-policy-core", version = "4.*", features = ["arbitrary"] }
cedar-policy-validator = { path = "../cedar/cedar-policy-validator", version = "4.*", features = ["arbitrary"] }
cedar-policy = { path = "../cedar/cedar-policy", version = "4.*", features = ["entity-tags"] }
cedar-policy-core = { path = "../cedar/cedar-policy-core", version = "4.*", features = ["arbitrary", "entity-tags"] }
cedar-policy-validator = { path = "../cedar/cedar-policy-validator", version = "4.*", features = ["arbitrary", "entity-tags"] }
cedar-policy-formatter = { path = "../cedar/cedar-policy-formatter", version = "4.*" }
cedar-testing = { path = "../cedar/cedar-testing", version = "4.*" }
lean-sys = { version = "0.0.7", features = ["small_allocator"], default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions cedar-policy-generators/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ publish = false

[dependencies]
arbitrary = "1.3"
cedar-policy-core = { path = "../cedar/cedar-policy-core", version = "4.*", features = ["arbitrary"] }
cedar-policy-validator = { path = "../cedar/cedar-policy-validator", version = "4.*", features = ["arbitrary"] }
cedar-policy-core = { path = "../cedar/cedar-policy-core", version = "4.*", features = ["arbitrary", "entity-tags"] }
cedar-policy-validator = { path = "../cedar/cedar-policy-validator", version = "4.*", features = ["arbitrary", "entity-tags"] }
clap = { version = "4.3.16", features = ["derive"] }
highway = "0.8.1"
serde = { version = "1.0", features = ["derive"] }
Expand Down
24 changes: 23 additions & 1 deletion cedar-policy-generators/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,16 @@ impl<'a> ExprGenerator<'a> {
self.generate_expr(max_depth - 1, u)?,
attr_name,
))
})
},
4 => {
let tag_name = uniform!(u,
self.generate_expr(max_depth - 1, u)?,
ast::Expr::val(self.schema.arbitrary_attr(u)?.0.clone())
);
let e = self.generate_expr(max_depth - 1, u)?;
Ok(ast::Expr::has_tag(e, tag_name))
}
)
})
}
}
Expand Down Expand Up @@ -583,6 +592,19 @@ impl<'a> ExprGenerator<'a> {
)?,
self.constant_pool.arbitrary_string_constant(u)?,
)),
// hasTag expression on an entity, for an arbitrary tag name
1 => Ok(ast::Expr::has_tag(
self.generate_expr_for_type(
&Type::entity(),
max_depth - 1,
u,
)?,
self.generate_expr_for_type(
&Type::string(),
max_depth - 1,
u,
)?,
)),
// has expression on a record
2 => Ok(ast::Expr::has_attr(
self.generate_expr_for_type(
Expand Down
1 change: 1 addition & 0 deletions cedar-policy-generators/src/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ impl<'a, 'u> HierarchyGenerator<'a, 'u> {
uid.clone(),
attrs.into_iter(),
parents.into_iter().collect(),
[],
&self.extensions,
)
.map_err(|e| Error::EntitiesError(e.to_string()))?;
Expand Down

0 comments on commit 7b8b0b4

Please sign in to comment.