fix: four HIGH correctness/security fixes from the UI audit (LC-349..352) #367
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-349-352-audit-high-correctness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Batch of the four HIGH correctness/security findings from the whole-app UI audit. One commit per ticket; each ships a regression test.
just testandjust test-saasboth green.LC-349 - scheduled-message body not length-capped
post_scheduled/patch_scheduledvalidated only emptiness. The body renders through synchronousmarkdown::renderon every/scheduledview and at delivery, so an uncapped body was the LC-153 hazard the live path already guards. Now enforcescheck_message_length. Test: over-cap body -> 400, no row.LC-350 - poll closes_in overflow panic
Unbounded
closes_inmadeUtc::now() + Duration::minutes(m)overflow-panic (500). Clamped to one year server-side +maxon the input. Test:closes_in=9999999999999999-> 200 (clamped), poll created.LC-351 - enclave Owner could be demoted
post_member_rolehad no owner guard; a forged POST could demote the Owner -> ownerless, un-transferable, un-deletable enclave. Now rejects targeting the Owner (mirrorspost_kick). Test: demote owner -> 400.LC-352 - no admin-count floor
post_role/post_ban/post_delete_usercould remove the last admin and lock everyone out of/admin. Addeddb::auth::other_active_admin_exists+guard_not_last_adminrefusing demote/ban/delete of the last active admin (role=admin, not banned). Tests: demote/ban sole admin -> 400; demote allowed once a second admin exists. (Admin routes are standalone-gated, so the test file is#![cfg(feature = "standalone")].)Closes LC-349, LC-350, LC-351, LC-352.