diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index ed034a6b1d..ee7ebb8ec5 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3224,26 +3224,26 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC; CREATEROLE user can issue "GRANT $dbowner TO $me" and then use the database owner attack. --> - Constrain ordinary users to user-private schemas. To implement this, - first issue REVOKE CREATE ON SCHEMA public FROM - PUBLIC. Then, for every user needing to create non-temporary - objects, create a schema with the same name as that user. Recall that - the default search path starts with $user, which - resolves to the user name. Therefore, if each user has a separate - schema, they access their own schemas by default. After adopting this - pattern in a database where untrusted users had already logged in, - consider auditing the public schema for objects named like objects in - schema pg_catalog. This pattern is a secure schema - usage pattern unless an untrusted user is the database owner or holds - the CREATEROLE privilege, in which case no secure + Constrain ordinary users to user-private schemas. For every user + needing to create non-temporary objects, create a schema with the same + name as that user. Recall that the default search path starts with + $user, which resolves to the user name. Therefore, + if each user has a separate schema, they access their own schemas by + default. This pattern is a secure schema usage pattern unless an + untrusted user is the database owner or holds the + CREATEROLE privilege, in which case no secure schema usage pattern exists. If the database originated in an upgrade from PostgreSQL 14 or earlier, - the REVOKE is essential. Otherwise, the default - configuration follows this pattern; ordinary users can create only - temporary objects until a privileged user furnishes a schema. + it is necessary to execute REVOKE CREATE ON SCHEMA public + FROM PUBLIC in order to implement this pattern, + because those versions granted the CREATE privilege + on the public schema to PUBLIC. + After this REVOKE, consider auditing the public + schema for objects named like objects in + schema pg_catalog.