Skip to content
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: user with GRANT privilege can grant privileges they don't have #45211

Closed
solongordon opened this issue Feb 19, 2020 · 5 comments · Fixed by #45697
Closed

sql: user with GRANT privilege can grant privileges they don't have #45211

solongordon opened this issue Feb 19, 2020 · 5 comments · Fixed by #45697
Assignees
Labels
A-security A-sql-privileges SQL privilege handling and permission checks. C-question A question rather than an issue. No code/spec/doc change needed.

Comments

@solongordon
Copy link
Contributor

Currently, if a user has the GRANT privilege on an object, they can grant any other privilege on that object, even if they don't have that privilege. @knz feels that users should only be allowed to grant privileges they already have.

Note that Postgres does not have the GRANT privilege. Instead, when a user is granted a privilege, they are then allowed to grant that privilege to other users if WITH GRANT OPTION was specified. We do not currently support this level of granularity.

Intuitively it makes sense to me that a user would not be able to grant privileges they don't have. I'm somewhat worried about breaking backward compatibility though.

@awoods187 would you like to weigh in on whether we should make this change, and if so whether we should prioritize it for 20.1?

@solongordon solongordon added C-question A question rather than an issue. No code/spec/doc change needed. A-sql-privileges SQL privilege handling and permission checks. labels Feb 19, 2020
@solongordon solongordon self-assigned this Feb 19, 2020
@knz
Copy link
Contributor

knz commented Feb 19, 2020

@aaron-crl can you have a look at this:

  1. can you provide guidance about what is reasonable behavior (it looks to me like the original behavior was an oversight, maybe you have an opinion about best practices)

  2. you could probably add the label A-sql-privileges to your filter for security-related issues

@aaron-crl
Copy link

Re: 1. The pg behavior referenced #45201 (comment) is a good pattern though we might emit an INFO or WARN that "not all permissions were assigned," in the event of an assignment failure. Outside of exceptional processes, users should not be able to assign privileges they do not possess.

Re: 2. Thanks! Will do.

I'm somewhat worried about breaking backward compatibility though.

  • Do we have data on how GRANT is historically used by customers.
  • Will this break any of our existing tests?
  • Will this break any of our internal systems?

I think we should fix this regardless, we'll have to make sure we communicate it effectively and making sure that we support fixes for customers that might be using it in unsafe ways.

@knz knz added the A-security label Feb 20, 2020
@jordanlewis
Copy link
Member

@awoods187 @nstewart any opinions on this? If there are no opinions, this is likely not going to be fixed in 20.1.

@knz
Copy link
Contributor

knz commented Mar 2, 2020

IMHO PM here is likely consumer of opinions (produced from Aaron or our security-minded staff), more than producer of opinions.

If we have every participant in this conversation sitting waiting for opinions from others, obviously nothing will happen.

In this case I'm in favor of the change. This does strengthen the security story.

@nstewart
Copy link
Contributor

nstewart commented Mar 2, 2020

I am generally in favor of the occasional breaking change (with the appropriate warnings in release notes, of course) in the service of a) improving security and b) moving closer to pg compatibility. I'll defer to @aaron-crl and @knz re opinions on if this improves our security story

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-security A-sql-privileges SQL privilege handling and permission checks. C-question A question rather than an issue. No code/spec/doc change needed.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants