-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
roachpb,sql: limit the syntax of tenant names #93269
Conversation
cc @adityamaru |
8c031f9
to
da2765f
Compare
da2765f
to
7d66012
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @knz, and @stevendanna)
pkg/roachpb/tenant.go
line 153 at r1 (raw file):
// to a database name in connection strings. However there cannot // be a hyphen at the end. var tenantNameRe = regexp.MustCompile(`^[a-z0-9]([a-z0-9---]{0,98}[a-z0-9])?$`)
What does the ---
do in [a-z0-9---]
? Is it different from just [a-z0-9-]
?
A standalone By writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a request for some more test cases.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @adityamaru, @knz, and @stevendanna)
pkg/sql/logictest/testdata/logic_test/tenant
line 16 at r1 (raw file):
CREATE TENANT "two" statement error invalid tenant name
Can you add test cases for length boundaries
0 -> invalid
1 -> valid
100 -> valid
101 -> valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @adityamaru, @knz, and @stevendanna)
pkg/sql/logictest/testdata/logic_test/tenant
line 16 at r1 (raw file):
Previously, ecwall (Evan Wall) wrote…
Can you add test cases for length boundaries
0 -> invalid
1 -> valid
100 -> valid
101 -> valid
- 101 -> invalid
This commit limits the lexicographical structure of tenant names to be that of DNS hostnames: start with a letter or digit, followed by a combination of letters, digits or hyphens. In particular periods and underscores are not allowed. There is a minimum length of 1 character and a maximum of 100, like in CC serverless. Release note: None
7d66012
to
d6c3d5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFYR!
bors r=ecwall
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @adityamaru, @ecwall, and @stevendanna)
pkg/sql/logictest/testdata/logic_test/tenant
line 16 at r1 (raw file):
Previously, ecwall (Evan Wall) wrote…
- 101 -> invalid
Done.
Build failed (retrying...): |
Build succeeded: |
Fixes #92613.
This commit limits the lexicographical structure of tenant names to be that of DNS hostnames: start with a letter, followed by a combination of letters, digits or hyphens. In particular periods and underscores are not allowed.
Release note: None