H: pin the token mode check for every group/world bit
Cover 0620, 0602, 0610 and 0601 in the loader and assert that startup validation and the per-request load give the same reason for each.
This commit is contained in:
1 parent
70af820838
commit
a09c64de9a
2 files changed
+54
No files matched your search
@@ -242,6 +242,19 @@ mod tests {
|
||||
assert!(!logs.contains("SHOULD_NOT_LEAK"), "{logs}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn group_or_world_write_and_execute_bits_are_rejected_too() {
|
||||
// Any group or world access lets another user read the token (r, x on
|
||||
// a readable file) or swap it (w). Each mode below sets a different
|
||||
// bit, so a mask that misses one bit still passes the others.
|
||||
let dir = TempDir::new("peer-secret");
|
||||
for mode in [0o620, 0o602, 0o610, 0o601] {
|
||||
let path = dir.write(&format!("token-{mode:o}"), b"pending\n", mode);
|
||||
let err = token_err(load_token_at(&peer(path), None).unwrap_err());
|
||||
assert_eq!(err, "group or world accessible", "{mode:o}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_symlink_cannot_borrow_the_credentials_directory_exemption() {
|
||||
let dir = TempDir::new("peer-secret");
|
||||
|
||||
Reference in new issue
Block a user