Skip to content
ANGEL FLORES
All work

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.
The shape of the system.Three layers and one way down: there is no server in between, so the row policy decides who reaches what.
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.

psql · role = anon

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;
idnombrecorreorol
e3a1…Persona Ejemplo Unoejemplo1@example.comcliente
7b92…Persona Ejemplo Dosejemplo2@example.comcliente
c418…Persona Ejemplo Tresejemplo3@example.comadmin
f5d7…Persona Ejemplo Cuatroejemplo4@example.comasesor

(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

Fabricated data demonstrating the pattern. The query and the error are what Postgres actually returns.

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

Sandate Consultores: home page of the live site
Next caseCIPROMEX

Have a product to build?

I am looking for remote roles and freelance projects. WhatsApp is the fastest way to reach me.