From 7bd7b2002bd018e25d024322c983e856237a50d9 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 31 Jul 2008 16:27:16 +0000 Subject: Require superuser privilege to create base types (but not composites, enums, or domains). This was already effectively required because you had to own the I/O functions, and the I/O functions pretty much have to be written in C since we don't let PL functions take or return cstring. But given the possible security consequences of a malicious type definition, it seems prudent to enforce superuser requirement directly. Per recent discussion. --- doc/src/sgml/ref/create_type.sgml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 665bc805af8..a5d07a21206 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -99,7 +99,13 @@ CREATE TYPE name The third form of CREATE TYPE creates a new base type - (scalar type). The parameters can appear in any order, not only that + (scalar type). To create a new base type, you must be a superuser. + (This restriction is made because an erroneous type definition could + confuse or even crash the server.) + + + + The parameters can appear in any order, not only that illustrated above, and most are optional. You must register two or more functions (using CREATE FUNCTION) before defining the type. The support functions @@ -580,8 +586,8 @@ CREATE TYPE name Because there are no restrictions on use of a data type once it's been created, creating a base type is tantamount to granting public execute - permission on the functions mentioned in the type definition. (The creator - of the type is therefore required to own these functions.) This is usually + permission on the functions mentioned in the type definition. + This is usually not an issue for the sorts of functions that are useful in a type definition. But you might want to think twice before designing a type in a way that would require secret information to be used -- cgit v1.2.3