Clarify the importance of NOINHERIT to properly create a role on the DOCS

オープン
#110 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
postgresql

調査の方向性

まず、issue にリンクされている PostgreSQL GRANT ドキュメントを確認し、このリポジトリ内の対応するロール作成のガイダンスを見つけてください。NOINHERIT の動作、ロールの永続性、および分離された ALTER ROLE の例を明確にしてください。完了の基準は、ドキュメントが認可リスクを正確に説明し、後から実行する CREATE ROLE が既存のロールを変更するかのように示唆しないことです。

索引モデルが issue の本文から書いたものです。

説明

enhancement help wanted important very_important

When a ROLE is created in PG, it may inherit privileges from other roles. It specially inherits all privileges from the PUBLIC role.

From the DOCs:
"Any particular role will have the sum of privileges granted directly to it, privileges granted to any role it is presently a member of, and privileges granted to PUBLIC.".

If your application is implementing a whitelist logic (most of the cases), this may represent a leak of authorization. So all roles must be created using the NOINHERIT clause, but there is another gotcha: creating a role and them altering it to NOINHERIT is a safer option than creating a role with NOINHERIT.

-- OK if there is no graphile_visitor already in your system
CREATE ROLE graphile_visitor NOINHERIT;

-- A better option, specially during development if you use dropdb to "reset" your application
CREATE ROLE graphile_visitor;
ALTER ROLE graphile_visitor NOINHERIT;

When a ROLE is created, it's not stored into the database itself, but inside a private catalog called pg_user. If graphile_visitor by accident was crate without the NOINHERIT, dropping the database won't erase it, so adding the NOINHERIT to its creation clause afterward will have no effect at all.

-- this is a mistake
CREATE ROLE graphile_visitor;

-- this isn't a bug fix
CREATE ROLE graphile_visitor NOINHERIT;

This happens because, when it runs the second query, PG will identify that a role with the same name already exists so it will skip the CREATE ROLE. Keeping creation and alteration separated will ensure the intended behavior.

主要言語
SCSS
スター
27
フォーク
124
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphile/graphile.github.io のほかの issue

graphile/graphile.github.io の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。