SKY-D419 · Security in code
PostgreSQL login role bypasses row-level security
MediumCWE-266
One role declaration enables login together with BYPASSRLS. CREATE USER supplies LOGIN by default.
- Languages
- PostgreSQL
- Quality gate
- listed, not counted by the gate (full and diff scans). This PostgreSQL finding is report-only.
- Finding type
- review
Why it matters
An account with both attributes can log in and bypass row-level policies on relations it can access. Other object privileges still apply.
What Skylos flags
CREATE USER reporting BYPASSRLS;[tool.skylos.sql]dialect = "postgresql"What Skylos leaves alone
CREATE USER reporting NOBYPASSRLS;Why Skylos leaves it alone
Decide whether this account should be subject to the same row-level policies as ordinary application users.
How Skylos decides
- Skylos checks CREATE ROLE, CREATE USER and ALTER ROLE or USER.
- An ALTER must set both attributes in the same statement, because earlier settings are unknown.
How to fix it
Decide whether this account should be subject to the same row-level policies as ordinary application users.
Removed: CREATE USER reporting BYPASSRLS;Added: CREATE USER reporting NOBYPASSRLS;When it can be wrong
- A maintenance or backup account may intentionally bypass row-level security.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Review the statement in the context of its migration.