SKY-D418 · Security in code
PostgreSQL schema creation privilege granted to PUBLIC
A GRANT gives every role permission to create objects in one or more schemas. An ALTER DEFAULT PRIVILEGES grant can apply the same permission to future schemas.
- 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
Other roles may resolve names through a schema where anyone can create objects. The effective exposure depends on schema usage and the search paths in use.
What Skylos flags
GRANT CREATE ON SCHEMA app TO PUBLIC;[tool.skylos.sql]dialect = "postgresql"What Skylos leaves alone
GRANT CREATE ON SCHEMA app TO app_owners;Why Skylos leaves it alone
Grant schema creation to the roles that manage its objects and review existing grants separately.
How Skylos decides
- Skylos checks explicit CREATE and ALL grants on schemas to the PUBLIC grantee.
- Grants to a named role, USAGE alone and revocations are outside this review.
How to fix it
Grant schema creation to the roles that manage its objects and review existing grants separately.
Removed: GRANT CREATE ON SCHEMA app TO PUBLIC;Added: GRANT CREATE ON SCHEMA app TO app_owners;When it can be wrong
- A shared workspace schema may intentionally permit every role to create objects.
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.