バージョンごとのドキュメント一覧

22.6. 関数のセキュリティ #

<title>Function Security</title>

Functions, triggers and row-level security policies allow users to insert code into the backend server that other users might execute unintentionally. Hence, these mechanisms permit users to <quote>Trojan horse</quote> others with relative ease. The strongest protection is tight control over who can define objects. Where that is infeasible, write queries referring only to objects having trusted owners. Remove from <varname>search_path</varname> any schemas that permit untrusted users to create objects. 関数やトリガや行単位セキュリティポリシーによって、ユーザは他のユーザが意識しないで実行できるようなコードを、バックエンドサーバに挿入することができます。 したがって、これらの機能によってユーザは比較的簡単に他のユーザにとってトロイの木馬となるものを実行することができます。 最も強力な保護は、誰がオブジェクトを定義できるかを厳格に管理することです。 それが実行不可能な場合は、信頼できる所有者を持つオブジェクトのみを参照する問い合わせを記述します。 search_pathから、信頼できないユーザがオブジェクトを作成できるスキーマを削除します。

Functions run inside the backend server process with the operating system permissions of the database server daemon. If the programming language used for the function allows unchecked memory accesses, it is possible to change the server's internal data structures. Hence, among many other things, such functions can circumvent any system access controls. Function languages that allow such access are considered <quote>untrusted</quote>, and <productname>PostgreSQL</productname> allows only superusers to create functions written in those languages. 関数は、データベースサーバデーモンのオペレーティングシステム権限で、バックエンドサーバプロセスの中で実行されます。 プログラミング言語で関数に未検査のメモリアクセスを許可している場合、サーバの内部データ構造を変更することが可能です。 したがって、その他の多数のことの中でも、そのような関数はどのようなシステムアクセスコントロールも回避することができます。 このようなアクセスを許可する関数言語は信頼されないものとみなされ、PostgreSQLはこれらの言語による関数の作成をスーパーユーザのみに限定して許可しています。