Stop a non-founder from granting the founder flag (channel takeover escalation)

This commit is contained in:
Jean Chevronnet 2026-07-19 13:10:44 +00:00
parent 18806c5fe7
commit e7f012726c
No known key found for this signature in database
2 changed files with 12 additions and 0 deletions

View file

@ -4881,6 +4881,11 @@
// Grant carol the 'a' flag; now she can.
cs(&mut e, "000AAAAAA", "FLAGS #room carol +a");
assert!(has(&cs(&mut e, "000AAAAAC", "FLAGS #room bob +i"), "now holds"), "carol with 'a' can change flags");
// ...but a non-founder delegate may NOT grant the founder flag (escalation).
assert!(has(&cs(&mut e, "000AAAAAC", "FLAGS #room bob +f"), "Only the founder"), "carol can't grant +f");
assert!(!e.db.channel("#room").unwrap().access.iter().any(|a| a.account.eq_ignore_ascii_case("bob") && a.level.contains('f')), "bob did not get founder");
// The founder still can.
assert!(has(&cs(&mut e, "000AAAAAA", "FLAGS #room bob +f"), "now holds"), "founder can grant +f");
// An invalid flag letter is rejected.
assert!(has(&cs(&mut e, "000AAAAAA", "FLAGS #room bob +z"), "isn't a valid flag"), "bad flag rejected");