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

backupccl: drop admin only check for CREATE SCHEDULE #87188

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

adityamaru
Copy link
Contributor

In #86495 we introduced a BACKUP privilege that governs
what targets a user is able to backup. CREATE SCHEDULE FOR BACKUP
under the hood is responsible for running backup statements
at fixed intervals and so it makes sense for the same privilege
checks that apply to the backup statement that will be run to
also apply to CREATE SCHEDULE. We get this for free because
CREATE SCHEDULE runs a dry-run backup when the schedule is being
created, that has all the relevant privilege checks. So similar to
the new backup privilege model:

Cluster backups - require admin or system privilege BACKUP

DB backups - require datbase privilege BACKUP

Table backups - require table privilege BACKUP

Note, in 22.2 since we are continuining to support the old
privilege model the following privilege will also permit a user to
CREATE SCHEDULE albeit with a deprecation notice warning users
that this model will be unsupported in a future release:

Cluster backups - require admin

DB backups - users must have CONNECT on the database,
SELECT on every table in the db, and USAGE on every schema, and
type in the db

Table backups - users must have SELECT on the table, and
USAGE on every schema, and type referenced by the table

Release note (sql change): CREATE SCHEDULE is no longer an
admin only operation. Users should grant the appropriate BACKUP
privileges on the targets they wish to back up as part of the schedule.

Cluster backups - require admin or system privilege BACKUP

DB backups - require datbase privilege BACKUP

Table backups - require table privilege BACKUP

Release justification: high impact change for fine grained permission control

In cockroachdb#86495 we introduced a `BACKUP` privilege that governs
what targets a user is able to backup. `CREATE SCHEDULE FOR BACKUP`
under the hood is responsible for running backup statements
at fixed intervals and so it makes sense for the same privilege
checks that apply to the backup statement that will be run to
also apply to `CREATE SCHEDULE`. We get this for free because
`CREATE SCHEDULE` runs a dry-run backup when the schedule is being
created, that has all the relevant privilege checks. So similar to
the new backup privilege model:

Cluster backups - require admin or system privilege BACKUP

DB backups - require datbase privilege BACKUP

Table backups - require table privilege BACKUP

Note, in 22.2 since we are continuining to support the old
privilege model the following privilege will also permit a user to
`CREATE SCHEDULE`  albeit with a deprecation notice warning users
that this model will be unsupported in a future release:

Cluster backups - require admin

DB backups - users must have CONNECT on the database,
SELECT on every table in the db, and USAGE on every schema, and
type in the db

Table backups - users must have SELECT on the table, and
USAGE on every schema, and type referenced by the table

Release note (sql change): CREATE SCHEDULE is no longer an
admin only operation. Users should grant the appropriate BACKUP
privileges on the targets they wish to back up as part of the schedule.

Cluster backups - require admin or system privilege BACKUP

DB backups - require datbase privilege BACKUP

Table backups - require table privilege BACKUP

Release justification: high impact change for fine grained permission control
@adityamaru adityamaru requested review from dt, stevendanna and a team August 31, 2022 15:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@adityamaru
Copy link
Contributor Author

TFTR!

bors r=benbardin

@craig craig bot merged commit 92102da into cockroachdb:master Sep 1, 2022
@craig
Copy link
Contributor

craig bot commented Sep 1, 2022

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants