Skip to content

Commit 9959d22

Browse files
author
Abhiprd
committed
fix: made the auto-verify BLAKE3 provenance on every FAT32 read more stronger. previous version just read that and didn't made provenance.
Previously read_file() returned data without verification.This was a severe bug. I finally made every read to recompute BLAKE3 hash and compare against stored hash in directory entry. Tampered files return None and print kernel-level block message. This makes the per-read provenance stronger for VFS and FAT32 filesystems.
1 parent 509523c commit 9959d22

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/fat32.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,16 @@ impl Fat32 {
164164
let data_sector = self.cluster_to_sector(cluster);
165165
let mut buf = [0u8; SECTOR_SIZE];
166166
self.disk.read_sector(data_sector, &mut buf);
167-
return Some(buf[..size].to_vec());
167+
let data = buf[..size].to_vec();
168+
// Auto-verify provenance on every read
169+
let current_hash = blake3::hash(&data);
170+
let stored: [u8; 8] = entry[12..20].try_into().ok()?;
171+
let computed: [u8; 8] = current_hash.as_bytes()[..8].try_into().ok()?;
172+
if stored != computed {
173+
println!("[AXIOM KERNEL] READ BLOCKED: \"{}\" FAT32 provenance violation", filename);
174+
return None;
175+
}
176+
return Some(data);
168177
}
169178
}
170179
None

0 commit comments

Comments
 (0)