@@ -156,6 +156,7 @@ pub fn is_authorized_partial_json_str(json: &str) -> Result<String, serde_json::
156156#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
157157#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
158158#[ serde( rename_all = "camelCase" ) ]
159+ #[ serde( deny_unknown_fields) ]
159160pub struct Response {
160161 /// Authorization decision
161162 decision : Decision ,
@@ -169,6 +170,7 @@ pub struct Response {
169170#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
170171#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
171172#[ serde( rename_all = "camelCase" ) ]
173+ #[ serde( deny_unknown_fields) ]
172174pub struct Diagnostics {
173175 /// Ids of the policies that contributed to the decision.
174176 /// If no policies applied to the request, this set will be empty.
@@ -239,6 +241,7 @@ impl Diagnostics {
239241#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
240242#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
241243#[ serde( rename_all = "camelCase" ) ]
244+ #[ serde( deny_unknown_fields) ]
242245pub struct AuthorizationError {
243246 /// Id of the policy where the error (or warning) occurred
244247 #[ cfg_attr( feature = "wasm" , tsify( type = "string" ) ) ]
@@ -291,6 +294,7 @@ impl From<cedar_policy_core::authorizer::AuthorizationError> for AuthorizationEr
291294#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
292295#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
293296#[ serde( rename_all = "camelCase" ) ]
297+ #[ serde( deny_unknown_fields) ]
294298pub struct ResidualResponse {
295299 decision : Option < Decision > ,
296300 satisfied : HashSet < PolicyId > ,
@@ -458,6 +462,7 @@ pub enum PartialAuthorizationAnswer {
458462#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
459463#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
460464#[ serde( rename_all = "camelCase" ) ]
465+ #[ serde( deny_unknown_fields) ]
461466pub struct AuthorizationCall {
462467 /// The principal taking action
463468 principal : EntityUid ,
@@ -492,6 +497,7 @@ pub struct AuthorizationCall {
492497#[ cfg_attr( feature = "wasm" , derive( tsify:: Tsify ) ) ]
493498#[ cfg_attr( feature = "wasm" , tsify( into_wasm_abi, from_wasm_abi) ) ]
494499#[ serde( rename_all = "camelCase" ) ]
500+ #[ serde( deny_unknown_fields) ]
495501pub struct PartialAuthorizationCall {
496502 /// The principal taking action. If this field is empty, then the principal is unknown.
497503 principal : Option < EntityUid > ,
@@ -594,7 +600,7 @@ impl AuthorizationCall {
594600 } ,
595601 _ => {
596602 // At least one of the `errs.push(e)` statements above must have been reached
597- return build_error ( errs, warnings) ;
603+ build_error ( errs, warnings)
598604 }
599605 }
600606 }
@@ -680,7 +686,7 @@ impl PartialAuthorizationCall {
680686 } ,
681687 _ => {
682688 // At least one of the `errs.push(e)` statements above must have been reached
683- return build_error ( errs, warnings) ;
689+ build_error ( errs, warnings)
684690 }
685691 }
686692 }
@@ -1642,8 +1648,7 @@ mod partial_test {
16421648 "ID1" : "permit(principal == User::\" alice\" , action, resource);"
16431649 }
16441650 } ,
1645- "entities" : [ ] ,
1646- "partial_evaluation" : true
1651+ "entities" : [ ]
16471652 } ) ;
16481653
16491654 assert_is_authorized_json_partial ( call) ;
@@ -1666,8 +1671,7 @@ mod partial_test {
16661671 "ID1" : "permit(principal == User::\" alice\" , action, resource);"
16671672 }
16681673 } ,
1669- "entities" : [ ] ,
1670- "partial_evaluation" : true
1674+ "entities" : [ ]
16711675 } ) ;
16721676
16731677 assert_is_not_authorized_json_partial ( call) ;
@@ -1690,8 +1694,7 @@ mod partial_test {
16901694 "ID1" : "permit(principal == User::\" alice\" , action, resource);"
16911695 }
16921696 } ,
1693- "entities" : [ ] ,
1694- "partial_evaluation" : true
1697+ "entities" : [ ]
16951698 } ) ;
16961699
16971700 assert_is_residual ( call, & HashSet :: from ( [ "ID1" ] ) ) ;
@@ -1714,8 +1717,7 @@ mod partial_test {
17141717 "ID1" : "permit(principal, action, resource) when { principal == User::\" alice\" };"
17151718 }
17161719 } ,
1717- "entities" : [ ] ,
1718- "partial_evaluation" : true
1720+ "entities" : [ ]
17191721 } ) ;
17201722
17211723 assert_is_residual ( call, & HashSet :: from ( [ "ID1" ] ) ) ;
@@ -1739,8 +1741,7 @@ mod partial_test {
17391741 "ID2" : "forbid(principal, action, resource) unless { resource == Photo::\" door\" };"
17401742 }
17411743 } ,
1742- "entities" : [ ] ,
1743- "partial_evaluation" : true
1744+ "entities" : [ ]
17441745 } ) ;
17451746
17461747 assert_is_residual ( call, & HashSet :: from ( [ "ID1" ] ) ) ;
0 commit comments