You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "damccorm (via GitHub)" <gi...@apache.org> on 2026/10/12 18:22:06 UTC
[PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
damccorm opened a new pull request, #40534:
URL: https://github.com/apache/beam/pull/40534
Enforces strict read-only permissions for the `kubeproxyuser_ro` PostgreSQL role used by the Beam Metrics Grafana datasource:
- Revokes `CREATE` on schema `public` from `PUBLIC` and `kubeproxyuser_ro`, and grants only `USAGE` on schema `public`.
- Revokes all write/DDL table privileges (`INSERT`, `UPDATE`, `DELETE`, `TRUNCATE`, `REFERENCES`, `TRIGGER`) on tables in schema `public` from `PUBLIC` and `kubeproxyuser_ro`, granting only `SELECT` to `kubeproxyuser_ro`.
- Sets `default_transaction_read_only = on` on `kubeproxyuser_ro` in `postgres/init.sql` and during metrics database initialization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm merged PR #40534:
URL: https://github.com/apache/beam/pull/40534
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40534:
URL: https://github.com/apache/beam/pull/40534#issuecomment-6130947325
Assigning reviewers:
R: @jrmccluskey added as fallback since no labels match configuration
Note: If you would like to opt out of this review, comment `assign to next reviewer`.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on PR #40534:
URL: https://github.com/apache/beam/pull/40534#issuecomment-6130936771
R: @Amar3tto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40534:
URL: https://github.com/apache/beam/pull/40534#issuecomment-6130961603
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "Amar3tto (via GitHub)" <gi...@apache.org>.
Amar3tto commented on code in PR #40534:
URL: https://github.com/apache/beam/pull/40534#discussion_r4258613194
##########
.test-infra/metrics/sync/github/sync.py:
##########
@@ -139,6 +139,42 @@ def initDbTablesIfNeeded():
if not bool(cursor.rowcount):
raise Exception(f"Failed to create table {GH_SYNC_METADATA_TABLE_NAME}")
+ cursor.execute("""
+ DO $$
+ BEGIN
+ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
+ IF EXISTS (
+ SELECT FROM pg_catalog.pg_roles WHERE rolname = 'kubeproxyuser_ro')
+ THEN
+ REVOKE ALL ON SCHEMA public FROM kubeproxyuser_ro;
+ GRANT USAGE ON SCHEMA public TO kubeproxyuser_ro;
+ REVOKE ALL ON ALL TABLES IN SCHEMA public FROM PUBLIC, kubeproxyuser_ro;
+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO kubeproxyuser_ro;
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public
+ REVOKE ALL ON TABLES FROM PUBLIC, kubeproxyuser_ro;
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public
+ GRANT SELECT ON TABLES TO kubeproxyuser_ro;
+ BEGIN
+ REVOKE cloudsqlsuperuser FROM kubeproxyuser_ro;
+ EXCEPTION WHEN OTHERS THEN
+ NULL;
+ END;
+ BEGIN
+ ALTER ROLE kubeproxyuser_ro
+ NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION;
+ EXCEPTION WHEN OTHERS THEN
Review Comment:
Could we avoid silently swallowing exceptions here? If the role update fails, initialization will still succeed, potentially leaving the read-only role with elevated privileges. Unexpected permission errors should be surfaced rather than ignored.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enforce read-only PostgreSQL permissions for kubeproxyuser_ro [beam]
Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on code in PR #40534:
URL: https://github.com/apache/beam/pull/40534#discussion_r4259168918
##########
.test-infra/metrics/sync/github/sync.py:
##########
@@ -139,6 +139,42 @@ def initDbTablesIfNeeded():
if not bool(cursor.rowcount):
raise Exception(f"Failed to create table {GH_SYNC_METADATA_TABLE_NAME}")
+ cursor.execute("""
+ DO $$
+ BEGIN
+ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
+ IF EXISTS (
+ SELECT FROM pg_catalog.pg_roles WHERE rolname = 'kubeproxyuser_ro')
+ THEN
+ REVOKE ALL ON SCHEMA public FROM kubeproxyuser_ro;
+ GRANT USAGE ON SCHEMA public TO kubeproxyuser_ro;
+ REVOKE ALL ON ALL TABLES IN SCHEMA public FROM PUBLIC, kubeproxyuser_ro;
+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO kubeproxyuser_ro;
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public
+ REVOKE ALL ON TABLES FROM PUBLIC, kubeproxyuser_ro;
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public
+ GRANT SELECT ON TABLES TO kubeproxyuser_ro;
+ BEGIN
+ REVOKE cloudsqlsuperuser FROM kubeproxyuser_ro;
+ EXCEPTION WHEN OTHERS THEN
+ NULL;
+ END;
+ BEGIN
+ ALTER ROLE kubeproxyuser_ro
+ NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION;
+ EXCEPTION WHEN OTHERS THEN
Review Comment:
Sure, done. This was to make sure that the role exists, but we can just check for existence instead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org