Auth result is never evaluated
Scan rule · RSC-SEC-065
- Security
- Severity: High
- CWE-862
- OWASP A01-2021
Reports functions that look up the identity but neither check the result nor bind it to the write — the call has no effect.
Why this matters
`await supabase.auth.getUser()` protects nothing. The call returns a value; only what you do with that value is the access check. Without the `if (!user) throw`, the function runs for anonymous callers exactly as it does for signed-in ones.
This is precisely what code generators produce reliably: the "load the user" pattern visibly belongs to the style of secure server functions, but the consequence is not a pattern, it is a decision — and the model does not make it. A review that searches for `getUser` finds the call and ticks the box.
Check it yourself: find every `getUser`, `getSession` or `auth()` call and read the next five lines. If there is no bail-out and the user value does not appear in the written data either, the check is decoration.
Scan tier
- Source code from source maps
- Repo access (deep scan)
How to fix it
Check the result and bail out when the user is missing, or bind the user id into the written data.