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

ccl/sqlproxyccl: validate cluster name before establishing connection #103479

Merged
merged 1 commit into from
May 18, 2023

Conversation

jaylim-crl
Copy link
Collaborator

@jaylim-crl jaylim-crl commented May 16, 2023

Previously, we were only validating cluster names when LookupTenantPods get called within the connector, which happens after the ACL check. The rationale behind that is that we didn't want a malicious actor who's iterating through all tenant IDs spinning up pods for them. The cluster name check ensures that the incoming connection knows something about the tenant.

Now that we have introduced LookupTenant within the ACL logic, it is possible for a malicious actor to iterate through all the tenant IDs, and figure out which tenant IDs are in use (since it returns "connection refused" if the tenant exists). To address that, we will start validating cluster names before running the ACL check (i.e. at the start of the proxy handler) before proceeding. This ensures that we will return a NotFound error if the tenant doesn't exist, or there's a cluster name mismatch. At the same time, the clusterName parameter has been removed from LookupTenantPods since that is no longer needed.

Release note: None

Epic: none

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jaylim-crl jaylim-crl force-pushed the jay/230516-check-cluster-name branch 2 times, most recently from f77e31a to 38fe485 Compare May 16, 2023 22:24
@jaylim-crl jaylim-crl marked this pull request as ready for review May 16, 2023 22:25
@jaylim-crl jaylim-crl requested review from a team as code owners May 16, 2023 22:25
@jaylim-crl jaylim-crl force-pushed the jay/230516-check-cluster-name branch from 38fe485 to 440ec2a Compare May 16, 2023 22:39
Copy link
Collaborator

@jeffswenson jeffswenson left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/ccl/sqlproxyccl/proxy_handler.go Outdated Show resolved Hide resolved
pkg/ccl/sqlproxyccl/proxy_handler.go Outdated Show resolved Hide resolved
Previously, we were only validating cluster names when LookupTenantPods get
called within the connector, which happens after the ACL check. The rationale
behind that is that we didn't want a malicious actor who's iterating through
all tenant IDs spinning up pods for them. The cluster name check ensures that
the incoming connection knows something about the tenant.

Now that we have introduced LookupTenant within the ACL logic, it is possible
for a malicious actor to iterate through all the tenant IDs, and figure out
which tenant IDs are in use (since it returns "connection refused" if the
tenant exists). To address that, we will start validating cluster names before
running the ACL check (i.e. at the start of the proxy handler) before
proceeding. This ensures that we will return a NotFound error if the tenant
doesn't exist, or there's a cluster name mismatch. At the same time, the
clusterName parameter has been removed from LookupTenantPods since that is
no longer needed.

Release note: None

Epic: none
@jaylim-crl jaylim-crl force-pushed the jay/230516-check-cluster-name branch from 440ec2a to d5b3b01 Compare May 17, 2023 17:36
@jaylim-crl
Copy link
Collaborator Author

TFTR!

@jaylim-crl
Copy link
Collaborator Author

bors r=JeffSwenson

@craig
Copy link
Contributor

craig bot commented May 18, 2023

Build succeeded:

@craig craig bot merged commit c8084f8 into cockroachdb:master May 18, 2023
@jaylim-crl jaylim-crl deleted the jay/230516-check-cluster-name branch May 18, 2023 15:23
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