go
Technical notes on web development, DevOps, and AI integration.
91 articles
- 00:28backend
Why "Popular Articles" Stay Stale — and How to Fix It with a 7-Day Rolling Score
Query sort=popular used total view_count so old articles always won. Fix: 7-day rolling score from entity_view_daily + deterministic tiebreak + random filler limit 9.
TL;DR: The "Popular Articles" section showed outdated items. A 7-day rolling score was implemented to fix this. Old articles no longer always rank highest.
#database#performance#mysql - 20:23frontend
Name the Entity Before You Take the Photo
Pulling photos from Google Maps is easy; standing behind them is not. Matching the page title to the entity caught three wrong photos in one backfill.
TL;DR: Images were missing from a culture grid. Entity data was healthy, but image supply was the issue. A solution was found by verifying images from Google Maps.
#google-maps#images#data-quality - 10:43frontend
The Validation Gate Before Third-Party Photos Enter a Grid
Name matching first, image checked after load, revert when in doubt: the validation gate that keeps third-party photos from poisoning a public grid.
TL;DR: Images were missing from a culture grid. Entity data was healthy, but image supply was the issue. A solution was found, but with limitations and a need for further verification.
#data-quality#api#frontend - 09:14backend
Three Layers of Validation for One Query Parameter
An enum filter guarded at the handler, the repository, and the SQL layer. Each layer protects a different class of caller.
TL;DR: Editor logic was embedded in a SQL query. The query was simplified to use a column directly. A three-layer validation system was added for security.
#golang#api#sql - 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 - 10:53backend
Guard Before the Payload: Requirements Are Global-Write Only
A cross-module document checklist could be rewritten by any account holding a service write permission. The guard now refuses before reading the payload.
TL;DR: Permission gate was too narrow. Added scope check to write path. Guard now runs before validation.
#go#rbac#api - 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 - 11:47backend
The Only Admin Module Without a Write Guard
An authorization audit found seven of eight admin modules guarded. The last one closed by reusing the pattern already in the codebase.
TL;DR: The KotaPortal service portal project had an admin module without a scope check. The fix reused a guard pattern from neighboring modules. The handler now passes middleware into the service with a two-function guard.
#go#security#rbac - 02:39testing
One Admin Account per Scope, Then RBAC Checks Prove Something
Manual permission checks stalled because no admin account matched the scope. A closed CLI creates one per scope and proves it with a real login.
TL;DR: Authorization testing needs the right privilege. Admin accounts are created per bidang. The create-bidang-users command has three guards.
#testing#security#go