The database held millions of contracts, but only the right eyes could see each row. Ramp built their Contracts system around strict Row-Level Security (RLS) to keep that rule absolute.
Row-Level Security in Ramp Contracts enforces visibility rules at the database layer. Each query passes through filters that check the identity and permissions of the requester before returning results. This prevents accidental leaks in application code, because the security logic lives inside the database, not scattered across services.
At Ramp, Contracts is more than a table of agreements. It stores sensitive financial terms, internal notes, and counterparty data. Without RLS, the application layer would need to manage scope carefully in every API call. With RLS, the database rejects any request for rows outside the user’s authorized set, even if a bug bypasses app-level checks.
Implementing RLS starts with defining policies at the table level. In Postgres, these policies reference session variables or JWT claims to determine access. Ramp Contracts ties each row to an owning organization and maps user accounts to their organizations. A request from User A will never return rows owned by Org B, because the policy filters them out before the query result is built.