authorization
Technical notes on web development, DevOps, and AI integration.
3 articles
- 13:02backend
The edit form one bidang should never have opened
Role checks answer who may manage staff, never which row they may touch. A row-ownership guard closes the gap.
TL;DR: Someone edited a staff record from a different bidang. The issue was caused by a lack of object-level authorization. A guard function was added to prevent this.
#security#authorization#owasp - 03:20backend
A Guard That Refuses Before the Payload Is Read
The organisation module finally has an owner: one guard in the service layer, one fixed 403, and one sidebar group that follows the owner.
TL;DR: Commit 96e93ae adds a guard function to check write permissions. The function runs before validation and returns an error for unauthorized bidang. A test ensures the guard's position and prevents unauthorized repository access.
#go#rbac#authorization - 00:24security
Enum and Slug: The Two Identifiers That Keep a Gate Shut
The moderation gate never rejected anyone: an unmapped enum simply compared false forever, and read-only won by default.
TL;DR: A read-only badge appeared on all reviews because the frontend passed raw module enums like PARIWISATA into a gate expecting slugs like wisata, so the check silently failed and defaulted to read-only. The fix centralized enum-to-slug mapping in one TypeScript Record. Server-side, guardModule now enforces deny-by-default checks with tests locking in 403s and 404s.
#rbac#typescript#authorization