Skip to content

release-19.2: backupccl,importccl: fix privilege checks for BACKUP/RESTORE and IMPORT#44456

Merged
craig[bot] merged 3 commits intocockroachdb:release-19.2from
pbardea:backport19.2-44250
Jan 28, 2020
Merged

release-19.2: backupccl,importccl: fix privilege checks for BACKUP/RESTORE and IMPORT#44456
craig[bot] merged 3 commits intocockroachdb:release-19.2from
pbardea:backport19.2-44250

Conversation

@pbardea
Copy link
Copy Markdown
Contributor

@pbardea pbardea commented Jan 28, 2020

Backport 2/2 commits from #44250.

/cc @cockroachdb/release


This changes the privilege checks in IMPORT, IMPORT INTO and RESTORE to
run during the planning of the job, in the SQL plan hook execution,
rather than during the execution of the job. This is done because
privilege checks are implemented on planner, and close over the
planner's txn in some branches/cases, so invoking them later, on a
txn-less planner in a resumed jobs execution, can cause problems.

Before this, the planStateHook's txn was assumed to be set and caused a
panic on checking RBAC privileges. Additionally, permission checks in these
operations did not properly give access to all admin users.

Fixes #44252.

Release note (bug fix): Allow all admin users to use BACKUP/RESTORE and
IMPORT.

Add failing tests for a non-root admin user trying to IMPORT{,INTO},
BACKUP and RESTORE. These types of users should be allowed to do these
operations but we have found issues with permissions not letting them as
well as panics due to incorrect usage of the planner in IMPORT INTO.

Release note: None
This changes the privilege checks in IMPORT, IMPORT INTO and RESTORE to
run during the *planning* of the job, in the SQL plan hook execution,
rather than during the execution of the job. This is done because
privilege checks are implemented on planner, and close over the
planner's txn in some branches/cases, so invoking them later, on a
txn-less planner in a resumed jobs execution, can cause problems.

Release note (bug fix): Allow all admin users to use BACKUP/RESTORE and
IMPORT.
@pbardea pbardea requested a review from dt January 28, 2020 19:19
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Include the role package in the backup test so that the tests have
access to the appropriate binary allowing to test BACKUP/RESTORE
interaction with RBAC.

Release note: None
@pbardea
Copy link
Copy Markdown
Contributor Author

pbardea commented Jan 28, 2020

bors r+

craig bot pushed a commit that referenced this pull request Jan 28, 2020
44456: release-19.2: backupccl,importccl: fix privilege checks for BACKUP/RESTORE and IMPORT r=pbardea a=pbardea

Backport 2/2 commits from #44250.

/cc @cockroachdb/release

---

This changes the privilege checks in IMPORT, IMPORT INTO and RESTORE to
run during the *planning* of the job, in the SQL plan hook execution,
rather than during the execution of the job. This is done because
privilege checks are implemented on planner, and close over the
planner's txn in some branches/cases, so invoking them later, on a
txn-less planner in a resumed jobs execution, can cause problems.

Before this, the planStateHook's txn was assumed to be set and caused a
panic on checking RBAC privileges. Additionally, permission checks in these
operations did not properly give access to all admin users.

Fixes #44252.

Release note (bug fix): Allow all admin users to use BACKUP/RESTORE and
IMPORT.


Co-authored-by: Paul Bardea <pbardea@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 28, 2020

Build succeeded

@craig craig bot merged commit f7831c2 into cockroachdb:release-19.2 Jan 28, 2020
@pbardea pbardea deleted the backport19.2-44250 branch April 27, 2020 00:52
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