]> begriffs open source - ai-pg/blob - full-docs/txt/perm-functions.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / perm-functions.txt
1
2 21.6. Function Security #
3
4    Functions, triggers and row-level security policies allow users to
5    insert code into the backend server that other users might execute
6    unintentionally. Hence, these mechanisms permit users to “Trojan horse”
7    others with relative ease. The strongest protection is tight control
8    over who can define objects. Where that is infeasible, write queries
9    referring only to objects having trusted owners. Remove from
10    search_path any schemas that permit untrusted users to create objects.
11
12    Functions run inside the backend server process with the operating
13    system permissions of the database server daemon. If the programming
14    language used for the function allows unchecked memory accesses, it is
15    possible to change the server's internal data structures. Hence, among
16    many other things, such functions can circumvent any system access
17    controls. Function languages that allow such access are considered
18    “untrusted”, and PostgreSQL allows only superusers to create functions
19    written in those languages.