Skip to content

kv: reject admin KV requests from tenant SQL processes#52592

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/adminAuth
Aug 11, 2020
Merged

kv: reject admin KV requests from tenant SQL processes#52592
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/adminAuth

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Aug 10, 2020

Fixes #52360.

This commit adds a new restriction to the tenantAuth policy that it accepts no "Admin" KV requests. This prevents tenants from splitting ranges, merging range, rebalancing ranges, or issuing any other KV requests with the isAdmin flag that could dictate KV-level distribution decisions.

This further mitigates the impact that a compromised tenant SQL process could have on the rest of the cluster.

@nvb nvb requested a review from tbg August 10, 2020 19:30
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1, 12 of 12 files at r2, 8 of 8 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten)


pkg/ccl/logictestccl/testdata/logic_test/tenant_unsupported, line 84 at r3 (raw file):

# Cannot perform operations that issue Admin requests.
#
# TODO DURING REVIEW: we could wrap these up in nicer errors. It's unclear

There's some utility to making this tell users to contact us, as they should not be able to hit these. We want to avoid users hitting this. Maybe use errorutil.UnsupportedWithMultiTenancy?


pkg/rpc/auth_tenant.go, line 120 at r3 (raw file):

func (a tenantAuth) authBatch(tenID roachpb.TenantID, args *roachpb.BatchRequest) error {
	// Admin batch requests are not permitted.
	if args.IsAdmin() {

Is there a way to keep this function allowlist-style? I.e. "request only has flags X" as opposed to "does not have Z". Actually, don't we want to lock this down to specific request types? You can only Get, CPut, Scan, etc and everything else is out. Our flag stuff is a mess, I wouldn't want to rely on it too much for authz.


pkg/sql/logictest/testdata/logic_test/select_index_span_ranges, line 1 at r3 (raw file):

# LogicTest: !3node-tenant

Issue no?

@tbg tbg added the A-multitenancy Related to multi-tenancy label Aug 11, 2020
Fixes cockroachdb#52360.

This commit adds a new restriction to the tenantAuth policy that it
accepts no "Admin" KV requests. This prevents tenants from splitting
ranges, merging range, rebalancing ranges, or issuing any other KV
requests with the `isAdmin` flag that could dictate KV-level
distribution decisions.

This further mitigates the impact that a compromised tenant SQL process
could have on the rest of the cluster.
@nvb nvb force-pushed the nvanbenschoten/adminAuth branch from 730a44e to 3018397 Compare August 11, 2020 20:41
Copy link
Copy Markdown
Contributor Author

@nvb nvb left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg)


pkg/ccl/logictestccl/testdata/logic_test/tenant_unsupported, line 84 at r3 (raw file):

Previously, tbg (Tobias Grieger) wrote…

There's some utility to making this tell users to contact us, as they should not be able to hit these. We want to avoid users hitting this. Maybe use errorutil.UnsupportedWithMultiTenancy?

Done.


pkg/rpc/auth_tenant.go, line 120 at r3 (raw file):

Previously, tbg (Tobias Grieger) wrote…

Is there a way to keep this function allowlist-style? I.e. "request only has flags X" as opposed to "does not have Z". Actually, don't we want to lock this down to specific request types? You can only Get, CPut, Scan, etc and everything else is out. Our flag stuff is a mess, I wouldn't want to rely on it too much for authz.

Done.


pkg/sql/logictest/testdata/logic_test/select_index_span_ranges, line 1 at r3 (raw file):

Previously, tbg (Tobias Grieger) wrote…

Issue no?

Unless we allow manual splits, we're never going to be able to run this file. It's only a single test but performs 6 manual splits. So there's no issue to reference.

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 11, 2020

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 11, 2020

Build succeeded:

@craig craig bot merged commit 2b85581 into cockroachdb:master Aug 11, 2020
@nvb nvb deleted the nvanbenschoten/adminAuth branch August 14, 2020 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-multitenancy Related to multi-tenancy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kv: lock down manual splits (and maybe all admin KV requests) on sql tenants

3 participants