Check if we don't have the roles already in clear when validating a state
This commit is contained in:
parent
ac17d28f08
commit
26495e973e
@ -157,12 +157,18 @@ impl ProcessState {
|
||||
return Err(anyhow::anyhow!("State is identical to the previous state"));
|
||||
}
|
||||
|
||||
let mut fields2plains = Map::new();
|
||||
let fields2commit = self.pcd_commitment.as_object().ok_or(anyhow::Error::msg("pcd_commitment is not an object"))?;
|
||||
self.encrypted_pcd
|
||||
.decrypt_all(self.commited_in, &fields2commit, &self.keys, &mut fields2plains)?;
|
||||
let roles2rules = match self.encrypted_pcd.extract_roles() {
|
||||
Ok(roles) => roles,
|
||||
Err(_) => {
|
||||
let mut fields2plains = Map::new();
|
||||
let fields2commit = self.pcd_commitment.as_object().ok_or(anyhow::Error::msg("pcd_commitment is not an object"))?;
|
||||
self.encrypted_pcd
|
||||
.decrypt_all(self.commited_in, &fields2commit, &self.keys, &mut fields2plains)?;
|
||||
|
||||
Value::Object(fields2plains).extract_roles()?
|
||||
}
|
||||
};
|
||||
|
||||
let roles2rules = Value::Object(fields2plains).extract_roles()?;
|
||||
|
||||
// Check if each modified field satisfies at least one applicable rule across all roles
|
||||
let all_fields_validated = modified_fields.iter().all(|field| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user