feat(gateway): add PostgreSQL privileges reference for Kong Gateway - #7070
feat(gateway): add PostgreSQL privileges reference for Kong Gateway#7070outsinre wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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.mddescribing 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.
| 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>; |
There was a problem hiding this comment.
No! We have a comment above to cover it.
| 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; |
There was a problem hiding this comment.
pg_schema is a Kong config.
Leave this part to docs team.
✅ Deploy Preview for kongdeveloper ready!
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`. |
There was a problem hiding this comment.
unpool means without connection pool.
Leave it to docs team for wording accuracy.
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
descriptionentry in frontmatter.