Skip to content

sql: fix SHOW ALL ZONE CONFIGURATION displaying unprivileged entries#42080

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:otan-fix_show_all
Nov 5, 2019
Merged

sql: fix SHOW ALL ZONE CONFIGURATION displaying unprivileged entries#42080
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:otan-fix_show_all

Conversation

@otan
Copy link
Copy Markdown
Contributor

@otan otan commented Oct 31, 2019

Fully resolves #40917.

  • Made crdb_internal.zones not display entries which the executing
    user does not have access to.
  • Add a delegate for ShowZoneConfig, which triggers on SHOW ALL
    ZONE CONFIGURATIONS, to use crdb_internal.zones table and run it as
    the executing user so rows are hidden if the user does not have
    permission.

Release note (bug fix): Previously, SHOW ALL ZONE CONFIGURATION ZONES and crdb_internal.zones shows results for resources the user does not have access to. This will instead filter out those entries from displaying.

@otan otan requested a review from solongordon October 31, 2019 21:36
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@otan otan requested a review from a team October 31, 2019 21:36
@otan otan force-pushed the otan-fix_show_all branch 5 times, most recently from a05f036 to ba5a12d Compare November 4, 2019 20:48
Copy link
Copy Markdown
Contributor

@solongordon solongordon left a comment

Choose a reason for hiding this comment

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

Nice, :lgtm: pending a couple comment fixes.

Reviewed 1 of 5 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan and @solongordon)


pkg/sql/crdb_internal.go, line 2183 at r1 (raw file):

					continue
				}
			}

Kind of too bad this logic is mostly duplicated with previous PR, but I guess we're looking up descriptors by ID in one case and by name in the other, so it would be awkward to dedup.


pkg/sql/delegate/show_zone_config.go, line 1 at r1 (raw file):

// Copyright 2017 The Cockroach Authors.

I don't think it really matters, but... 2019.


pkg/sql/delegate/show_zone_config.go, line 15 at r1 (raw file):

import "github.com/cockroachdb/cockroach/pkg/sql/sem/tree"

// ShowZoneConfig only delegates if it selecting ALL users.

All configurations, not users.

* Made `crdb_internal.zones` not display entries which the executing
user does not have access to.
* Add a delegate for ShowZoneConfig, which triggers on SHOW ALL
ZONE CONFIGURATIONS, to use crdb_internal.zones table and run it as
the executing user so rows are hidden if the user does not have
permission.

Release note (bug fix): Previously, SHOW ALL ZONE CONFIGURATION ZONES
and crdb_internal.zones shows results for resources the user does not
have access to. This will instead filter out those entries from
displaying.
Copy link
Copy Markdown
Contributor Author

@otan otan left a comment

Choose a reason for hiding this comment

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

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


pkg/sql/delegate/show_zone_config.go, line 1 at r1 (raw file):

Previously, solongordon (Solon) wrote…

I don't think it really matters, but... 2019.

haha, is there a way of auto-generating these? i've been copy pasting.
Done.


pkg/sql/delegate/show_zone_config.go, line 15 at r1 (raw file):

Previously, solongordon (Solon) wrote…

All configurations, not users.

Done.

@otan otan force-pushed the otan-fix_show_all branch from ba5a12d to d07c378 Compare November 5, 2019 21:29
@otan
Copy link
Copy Markdown
Contributor Author

otan commented Nov 5, 2019

bors r+

craig bot pushed a commit that referenced this pull request Nov 5, 2019
42080: sql: fix SHOW ALL ZONE CONFIGURATION displaying unprivileged entries r=otan a=otan

Fully resolves #40917.

* Made `crdb_internal.zones` not display entries which the executing
    user does not have access to.
* Add a delegate for ShowZoneConfig, which triggers on SHOW ALL
    ZONE CONFIGURATIONS, to use crdb_internal.zones table and run it as
    the executing user so rows are hidden if the user does not have
    permission.

Release note (bug fix): Previously, SHOW ALL ZONE CONFIGURATION ZONES and crdb_internal.zones shows results for resources the user does not have access to. This will instead filter out those entries from displaying.

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 5, 2019

Build succeeded

@craig craig bot merged commit d07c378 into cockroachdb:master Nov 5, 2019
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.

sql: SHOW ZONE CONFIGURATION output includes unpermissioned resources

3 participants