Skip to content

feat(gateway): add PostgreSQL privileges reference for Kong Gateway - #7070

Open
outsinre wants to merge 1 commit into
mainfrom
FTI-7203-minimal-postgresql-privilege
Open

feat(gateway): add PostgreSQL privileges reference for Kong Gateway#7070
outsinre wants to merge 1 commit into
mainfrom
FTI-7203-minimal-postgresql-privilege

Conversation

@outsinre

@outsinre outsinre commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Add PostgreSQL privileges reference for Kong Gateway

Document the minimal PostgreSQL role attributes and privileges Kong
Gateway needs for migrations, runtime, and admin CLI operations, since
no existing page covered least-privilege database setup. Cross-link it
from the datastore how-to and the sibling PostgreSQL reference pages.

https://konghq.atlassian.net/browse/FTI-7203

Preview Links

Checklist

  • Tested how-to docs. If not, note why here.
  • All pages contain metadata.
  • Any new docs link to existing docs.
  • All autogenerated instructions render correctly (API, decK, Konnect, Kong Manager).
  • Style guide (capitalized gateway entities, placeholder URLs) implemented correctly.
  • Every page has a description entry in frontmatter.
  • Add new pages to the product documentation index (if applicable).

Document the minimal PostgreSQL role attributes and privileges Kong
Gateway needs for migrations, runtime, and admin CLI operations, since
no existing page covered least-privilege database setup. Cross-link it
from the datastore how-to and the sibling PostgreSQL reference pages.
Copilot AI lite review requested due to automatic review settings September 1, 2026 15:26
@outsinre
outsinre requested a review from a team as a code owner September 1, 2026 15:26
@outsinre
outsinre requested a review from juliamrch September 1, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Gateway reference page documenting least-privilege PostgreSQL role attributes/privileges required by Kong Gateway, and cross-links it from the existing PostgreSQL reference pages and the datastore how-to.

Changes:

  • Added app/gateway/postgresql-privileges-reference.md describing migration, runtime, admin CLI, and read-only user privilege requirements.
  • Added cross-links to the new privileges reference from the PostgreSQL TLS and OAuth reference pages.
  • Added a “next steps” link from the datastore configuration how-to to the new privileges reference.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
app/gateway/postgresql-reference.md Adds a related resource link to the new PostgreSQL privileges reference page.
app/gateway/postgresql-privileges-reference.md Introduces the new least-privilege PostgreSQL roles/privileges reference content.
app/gateway/postgresql-oauth.md Adds a related resource link to the new PostgreSQL privileges reference page.
app/_how-tos/gateway/configure-datastore.md Adds a next-step link pointing readers to the new privileges hardening reference.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +253 to +256
GRANT SELECT ON ALL TABLES IN SCHEMA <pg_schema> TO <pg_ro_user>;

-- [DCL] Auto-grant SELECT on future tables created by the migration-time write user
ALTER DEFAULT PRIVILEGES FOR ROLE <pg_user> IN SCHEMA <pg_schema> GRANT SELECT ON TABLES TO <pg_ro_user>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! We have a comment above to cover it.

Comment on lines +142 to +146
DROP SCHEMA IF EXISTS <pg_schema> CASCADE;

-- kong migrations bootstrap/up/finish
CREATE SCHEMA IF NOT EXISTS <pg_schema> AUTHORIZATION CURRENT_USER;
GRANT ALL ON SCHEMA <pg_schema> TO CURRENT_USER;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pg_schema is a Kong config.

Leave this part to docs team.

@netlify

netlify Bot commented Sep 1, 2026

Copy link
Copy Markdown

Deploy Preview for kongdeveloper ready!

Name Link
🔨 Latest commit cef15b4
🔍 Latest deploy log https://app.netlify.com/projects/kongdeveloper/deploys/6a96eeaa6bab9b0008306622
😎 Deploy Preview https://deploy-preview-7070--kongdeveloper.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.


* **Migration session** — The `kong migrations` CLI connects to `pg_database` as `pg_user`. If the schema does not exist, it creates `pg_schema`, switches to it, and runs DDL. The gateway process is not running yet.
* **Runtime session** — The gateway process opens pooled connections to `pg_database` as `pg_user`. Each connection switches to `pg_schema`.
* **Admin CLI session** — A CLI command other than `kong migrations` can also open a database session. Examples are `kong workspace`, `kong config db_import`, and `kong config db_export`. This session is a one-off, unpooled connection, not part of the gateway's connection pool. The command connects to `pg_database` as `pg_user` and switches to `pg_schema`, the same as a runtime session. The command can run whether the gateway process is active or stopped. It can also run statements that the runtime session never runs, such as `TRUNCATE`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unpool means without connection pool.

Leave it to docs team for wording accuracy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants