Authorization Enforced Only in Browser Code (Open Row-Level Policies)
Illustrative example. ACME Financial is an invented company and every detail below is made up. The layout is the one our reports use.
Impact
The policies allowed every row to be read, so the data of every customer was available to anyone holding the portal’s public key, which is delivered to each visitor’s browser. No account or password was required. The four tables affected hold account holders’ names, account numbers, balances, transactions, statements and saved payees.
The same policy was repeated in four migrations, which indicates a pattern in how tables are added rather than a single oversight. A table added in the same way would carry the same flaw. Within an attack chain, this finding supports large-scale collection of customer data with no prior access. Strafe assesses the likelihood as high and the impact as critical.
Technical details
Strafe reviewed the customer portal’s repository at the commit ACME Financial supplied. The accounts screen loads its data with a query that filters on the signed-in customer’s identifier. The filter is applied in the browser:
// src/features/accounts/useAccounts.ts
const { data, error } = await db
.from("accounts")
.select("holder, account_number, available_balance")
.eq("customer_id", session.user.id); 
The migration that creates the table enables row-level security and then adds a policy that allows any caller to read every row, including a caller with no session:
-- db/migrations/0007_accounts.sql alter table accounts enable row level security; create policy "accounts are readable" on accounts for select to anon, authenticated using (true);

The same policy text appeared in the migrations for three further tables: transactions, statements and payees. In each case the matching screen filtered by customer in the browser, as the accounts screen did.
To confirm the finding, Strafe sent one request to the staging interface with the public key from the bundle and no customer session. The response contained rows belonging to more than one customer:
GET /rest/v1/accounts?select=holder,account_number&limit=2 HTTP/2
Host: api-staging.acme-financial.example
apikey: [public key from the client bundle]
HTTP/2 200 OK
Content-Type: application/json
[{"holder":"Customer A (test account)","account_number":"0000100481"},
{"holder":"Customer B (test account)","account_number":"0000100482"}] 
The request was limited to two rows from the staging database, which held test accounts only.
Remediation
- Replace each open policy with one that compares the row’s customer to the caller’s identity, and remove the anon role from it. For the accounts table:
using (customer_id = auth.uid()), granted toauthenticatedonly. - Apply the same change to transactions, statements and payees, then review every table for a policy whose condition is
true. - Add a test to the build pipeline that queries each table with the public key and no session, and as one customer for another customer’s rows. The build fails if either query returns a row.
- Keep the filter in the browser for display only. It is not an access control.
Rotating or hiding the public key would not correct the flaw. The key is public by design; the policies are the control.
## C1 - Authorization enforced only in browser code **Where:** db/migrations/0007, 0009, 0011, 0012 (policies on accounts, transactions, statements, payees) **Severity:** Critical (CVSS 7.5) · Likelihood High · Impact Critical ### What "fixed" means - A query with the public key and no session returns no rows from any of the four tables. - A signed-in customer receives only rows whose customer_id is their own, whatever filter the request carries. - The comparison is in the database policy, not in client code. ### What does not count - A filter in the browser or in a client-side helper. - Rotating, shortening or obscuring the public key. ### Where else this pattern may exist Every table created by a migration, and the storage bucket that holds statement files. Search the migrations for "using (true)".
After the fix
ACME Financial replaced the four policies. Strafe reviewed the new migration and repeated the request. The interface returned an empty list to a caller with no session, and a signed-in test customer received only their own rows.

References
- OWASP Top 10, A01:2021 Broken Access Control
- CWE-602: Client-Side Enforcement of Server-Side Security
- PostgreSQL documentation, Row Security Policies