Sandate Consultores
A client portal handling real financial paperwork — case files, appointments, identity documents. I took it over and spent the work where it mattered: locking the data down at the database level, then building on top.
- Client
- Financial consultancy, Mexico City
- Year
- 2026
- Role
- Sole developer — security work, feature development and deployment.
- rounds of hardening shipped
- 5
- smaller video library
- 87%
- signed URL lifetime
- 48h
Playable demo
Why row level security is the whole game here
With no server in between, one setting decides whether a stranger reads everything or nothing. Flip it and run the same query both ways. Rows are fabricated — the query and the error are not.
Same anonymous API key, same query. The only difference is row level security. With no server in between, this one setting is the whole perimeter.
select id, nombre, correo, rol from profiles;| id | nombre | correo | rol |
|---|---|---|---|
| e3a1… | Persona Ejemplo Uno | ejemplo1@example.com | cliente |
| 7b92… | Persona Ejemplo Dos | ejemplo2@example.com | cliente |
| c418… | Persona Ejemplo Tres | ejemplo3@example.com | admin |
| f5d7… | Persona Ejemplo Cuatro | ejemplo4@example.com | asesor |
(4 rows) — and every other client in the table
update profiles set rol = 'admin' where id = auth.uid();UPDATE 1 — you are now an administrator
The problem
This is a pure client-side app talking straight to a hosted database with a public API key. That architecture is fast to build and perfectly sound — but it moves the entire security burden onto the database policies, because there is no server in between to enforce anything. With identity documents and case files of real people in those tables, that is where the work belongs.
The decisions
The database decides who sees what
Row-level security on every table, policies written per role, and the privilege checks moved into database functions that run with elevated rights so a client cannot edit their own role field. Then verified from the outside as an anonymous user, which is the only test that counts: no reads, no escalation.
An advisor sees their clients. Not all clients.
A dashboard that filters by advisor in the UI is not the same thing as one that enforces it. The policies scope case files, documents and appointments to assigned clients at the database level — the UI filter is a convenience, never the control.
CVs stopped being public URLs
Applicants' CVs live in a staff-only bucket, and sharing one goes through a function that signs a 48-hour URL server-side — and only for paths that look like a generated identifier, so it cannot be turned into a file browser.
The result
Five rounds of hardening shipped to production in the same week, plus client notifications with realtime updates, automated WhatsApp alerts for new applications, and a video library cut from 604 MB to 76 MB without touching audio or length. Live on its own domain.
In production
