-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: prevent arbitrary writes to system.comments #45712
Conversation
Note that postgres allows users to bypass privileges to view comments from any object, this is also allowed by crdb and remains unchanged here. |
f686b07
to
09ffbe8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @RichardJCai)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to add - current changes look good to me, should be okay once the failing logic tests are updated.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis)
Previously, the GRANT, UPDATE, DELETE and INSERT privileges were granted to `public`, i.e. everyone, on `system.comments`. This was unintended - only users with permissions on an object should be able to modify that object's comments. This patch fixes it. Release note (security update): Any user could previously modify any database/table/view/index comment via direct SQL updates to `system.comments`. This was unintended and a form of privilege escalation, and is now prevented. The privileges required for the COMMENT statement and `pg_description`, `col_description()`, `obj_description()` and `shobj_description()` are operating as in PostgreSQL and unaffected by this change: all users can *view* any comments on any object (bypassing other privileges), but modifying comments require write privilege on the target object.
Thanks! bors r=RichardJCai |
Build failed (retrying...) |
Build succeeded |
Fixes #45707.
Previously, the GRANT, UPDATE, DELETE and INSERT privileges
were granted to
public
, i.e. everyone, onsystem.comments
.This was unintended - only users with permissions on an object
should be able to modify that object's comments.
This patch fixes it.
Release note (security update): Any user could previously modify any
database/table/view/index comment via direct SQL updates to
system.comments
. This was unintended and a form of privilegeescalation, and is now prevented. The privileges required for the
COMMENT statement and
pg_description
,col_description()
,obj_description()
andshobj_description()
are operating asin PostgreSQL and unaffected by this change: all users can view any
comments on any object (bypassing other privileges), but modifying
comments require write privilege on the target object.