这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tirumaraiselvan
Copy link
Contributor

@tirumaraiselvan tirumaraiselvan commented Jun 27, 2020

Description

Postgres by default has a PUBLIC keyword used for grants: https://www.postgresql.org/docs/current/sql-grant.html. PUBLIC has SELECT permission on many tables in pg_catalog and information_schema by default and hence all users have select access to these (unless specifically revoked?)

We can check table access for all users via:

SELECT grantee, table_catalog, table_schema, table_name, privilege_type
FROM   information_schema.table_privileges group by grantee, table_catalog, table_schema, table_name, privilege_type;

This means on AWS RDS (and others), we expect to not give any special privileges to pg_catalog or information_schema. I have tested on few major versions on AWS RDS and GCP as well and indeed this is the case.

close #1677, close #3783

Changelog

  • CHANGELOG.md is updated with user-facing content relevant to this PR. If no changelog is required, then add the no-changelog-required label.

Affected components

  • Docs

@tirumaraiselvan tirumaraiselvan requested a review from a team as a code owner June 27, 2020 17:44
@netlify
Copy link

netlify bot commented Jun 27, 2020

Deploy preview for hasura-docs ready!

Built with commit 5d59563

https://deploy-preview-5228--hasura-docs.netlify.app

Copy link
Contributor

@allpwrfulroot allpwrfulroot left a comment

Choose a reason for hiding this comment

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

Extra thanks for the GCP note at the end!

@tirumaraiselvan tirumaraiselvan requested a review from a team as a code owner June 29, 2020 07:06
@rikinsk rikinsk added the c/docs Related to docs label Jun 29, 2020
GRANT ALL ON ALL SEQUENCES IN SCHEMA <schema-name> TO hasurauser;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA <schema-name> TO hasurauser;
Note for managed databases (AWS RDS, GCP Cloud SQL, etc.)
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be a sub-section of the the permissions section.

Also having a heading with "Note for" seems odd. Maybe something like "Caveats for managed databases (..."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't call it a caveat. Just something extra to do or ignore.

-- GRANT USAGE ON SCHEMA <schema-name> TO hasurauser;
-- GRANT ALL ON ALL TABLES IN SCHEMA <schema-name> TO hasurauser;
-- GRANT ALL ON ALL SEQUENCES IN SCHEMA <schema-name> TO hasurauser;
GRANT USAGE ON SCHEMA <schema-name> TO hasurauser;
Copy link
Member

Choose a reason for hiding this comment

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

Copy-pasting the entire block as it is would cause errors, so shouldn't these lines be left commented?


.. admonition:: Google Cloud SQL

On Google Cloud SQL, running ``ALTER SCHEMA hdb_catalog OWNER TO hasurauser;`` may give you an error ``ERROR: must be member of role "hasurauser"``. You can fix this by running ``GRANT hasurauser to postgres;`` first, assuming "postgres" is the superuser that you are running the commands with.
Copy link
Member

@rikinsk rikinsk Jun 29, 2020

Choose a reason for hiding this comment

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

Can this be kept consistent with the above section. I dont see a need for this to be a note without the code-blocks just because this is specific for Google Cloud SQL. We can just say, "In Google Cloud SQL you might see the following error:" followed but the code-block style we have used above

@rikinsk rikinsk self-requested a review June 29, 2020 12:20
Copy link
Member

@rikinsk rikinsk left a comment

Choose a reason for hiding this comment

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

Added above

@tirumaraiselvan tirumaraiselvan requested a review from rikinsk June 29, 2020 12:55
@rikinsk rikinsk merged commit 4de8f91 into hasura:master Jun 29, 2020
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-5228.herokuapp.com is deleted

@tristantreb
Copy link

Sharing an edge case: Granting SELECT privilege on one table in public is sufficient to have the SELECT privilege on pg_catalog and information_schema, as explained by @tirumaraiselvan

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

Labels

c/docs Related to docs

Projects

None yet

6 participants