---
title: "Discussion on \"Four Things Broke When We Turned On Row-Level Security\" | Hashnode"
description: "Discussion on \"Four Things Broke When We Turned On Row-Level Security\". Row-level security looks like a one-line change in Postgres. We turned it on for a multi-tenant commerce backend, and four things broke before it worked.\nOne: our interceptor reset the role and set th"
url: "https://hashnode.com/posts/four-things-broke-when-we-turned-on-row-level-security/6afdb9e1f0ea3c8b0b4d3271"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Four Things Broke When We Turned On Row-Level Security](https://storeflux.hashnode.dev/four-things-broke-when-we-turned-on-row-level-security?utm_source=hashnode&utm_medium=feed)

Row-level security looks like a one-line change in Postgres. We turned it on for a multi-tenant commerce backend, and four things broke before it worked. One: our interceptor reset the role and set th

12h ago · 2 min read · storeflux.hashnode.dev  
Read the article

-   [#postgres](https://hashnode.com/tag/postgres)
-   [#security](https://hashnode.com/tag/security)

## Written by

[StoreFlux](https://hashnode.com/@storeflux)

@storeflux · Islamabad

  
[View profile](https://hashnode.com/@storeflux)

Headless commerce backend for multi-tenant stores

StoreFlux is a headless commerce backend. You build the storefront, and we handle products, carts, orders, payments, shipping, and analytics through an API. We write the engineering behind it in public, including the bugs we find in our own code, and we say what is live and what is not tested yet.

## Responses 1

Markdown supported · ⌘↵ to post

[OneLifeVibe](https://hashnode.com/@onelifevibe)

[8h ago](https://hashnode.com/posts/four-things-broke-when-we-turned-on-row-level-security/6afdb9e1f0ea3c8b0b4d3271/comment/6afdea2f89c00f432ac538e9)

The third failure is the most instructive, because a null tenant value that becomes an empty string turns a fail closed policy into a crash instead of a denial. The fourth failure is equally important, since silent zero row results can look like correct behavior while hiding cross tenant data. The open question about anonymous endpoints is honest, because elevating the role for login and guest carts leaves that protection to the explicit tenant lookup in code.
