Skip to content

Commit

Permalink
bug fix in reading audits with chain
Browse files Browse the repository at this point in the history
  • Loading branch information
lzoghbi committed Jul 31, 2024
1 parent e7e52e2 commit 1a8febc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/audit_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@ impl AuditChain {
match AuditFile::read_audit_file(audit_file_path.clone())? {
Some(audit_file) => {
if audit_file.version != expected_version {
// Update version in chain manifest, so we don't loop infinitely
self.crate_policies
.get_mut(crate_id)
.context("Couldn't find the crate in the chain manifest")?
.1 = audit_file.version;

// The audit file has been updated in a different audit, so we need to
// recalculate the policies for its parents
// recalculate the policies for its parents and save the changes
let potentially_removed = audit_file.safe_pub_fns();
self.remove_cross_crate_effects(potentially_removed, crate_id)?;
self.clone().save_to_file()?;

// re-read the audit file so changes have taken effect
// NOTE: This assumes there aren't concurrent audits modifying policies
Expand Down

0 comments on commit 1a8febc

Please sign in to comment.