Skip to content

Commit 7f725b0

Browse files
committed
sql,security: add validation for PROVISIONSRC role option
Release note (enterprise change): Added a new PROVISIONSRC role option. This role option should be prefixed with the HBA auth method for provisioning, i.e. `ldap` followed by the IDP uri, for example `ldap:ldap.example.com`. This is intended to be used only internally for user provisioning and is supposed to be view-only when checking set role options for a user.
1 parent 64da47e commit 7f725b0

File tree

21 files changed

+243
-9
lines changed

21 files changed

+243
-9
lines changed

pkg/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,7 @@ GO_TARGETS = [
17171717
"//pkg/security/password:password",
17181718
"//pkg/security/password:password_test",
17191719
"//pkg/security/pprompt:pprompt",
1720+
"//pkg/security/provisioning:provisioning",
17201721
"//pkg/security/securityassets:securityassets",
17211722
"//pkg/security/securitytest:securitytest",
17221723
"//pkg/security/sessionrevival:sessionrevival",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# LogicTest: !local-mixed-24.3 !local-mixed-25.1 !local-mixed-25.2
2+
# Tests for parsing/validation of the PROVISIONSRC role option.
3+
4+
statement error role "root" cannot have a PROVISIONSRC
5+
ALTER ROLE root PROVISIONSRC 'ldap:ldap.example.com'
6+
7+
statement error pq: PROVISIONSRC "ldap.example.com" was not prefixed with any valid auth methods \["ldap"\]
8+
CREATE ROLE role_with_provisioning PROVISIONSRC 'ldap.example.com'
9+
10+
statement error pq: conflicting role options
11+
CREATE ROLE role_with_provisioning WITH PROVISIONSRC 'ldap:ldap.bar.com' NOSQLLOGIN
12+
13+
statement ok
14+
CREATE ROLE role_with_provisioning PROVISIONSRC 'ldap:ldap.bar.com'
15+
16+
query T
17+
SELECT value FROM system.role_options
18+
WHERE username = 'role_with_provisioning'
19+
AND option = 'PROVISIONSRC'
20+
----
21+
ldap:ldap.bar.com
22+
23+
statement ok
24+
ALTER ROLE role_with_provisioning PROVISIONSRC 'ldap:ldap.example.com'
25+
26+
query T
27+
SELECT value FROM system.role_options
28+
WHERE username = 'role_with_provisioning'
29+
AND option = 'PROVISIONSRC'
30+
----
31+
ldap:ldap.example.com
32+
33+
statement error pq: provided IDP "\[\]!@#%#\^\$&\*" in PROVISIONSRC is non parseable: parse "\[\]!@#%#\^\$&\*": invalid URL escape "%#\^"
34+
ALTER ROLE role_with_provisioning PROVISIONSRC 'ldap:[]!@#%#^$&*'
35+
36+
statement ok
37+
ALTER ROLE role_with_provisioning PROVISIONSRC 'ldap:foo.bar'
38+
39+
query T
40+
SELECT value FROM system.role_options
41+
WHERE username = 'role_with_provisioning'
42+
AND option = 'PROVISIONSRC'
43+
----
44+
ldap:foo.bar
45+

pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/logictestccl/tests/fakedist-disk/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ go_test(
1212
"//build/toolchains:is_heavy": {"test.Pool": "heavy"},
1313
"//conditions:default": {"test.Pool": "large"},
1414
}),
15-
shard_count = 35,
15+
shard_count = 36,
1616
tags = ["cpu:2"],
1717
deps = [
1818
"//pkg/base",

pkg/ccl/logictestccl/tests/fakedist-disk/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/logictestccl/tests/fakedist-vec-off/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ go_test(
1212
"//build/toolchains:is_heavy": {"test.Pool": "heavy"},
1313
"//conditions:default": {"test.Pool": "large"},
1414
}),
15-
shard_count = 35,
15+
shard_count = 36,
1616
tags = ["cpu:2"],
1717
deps = [
1818
"//pkg/base",

pkg/ccl/logictestccl/tests/fakedist-vec-off/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/logictestccl/tests/fakedist/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ go_test(
1212
"//build/toolchains:is_heavy": {"test.Pool": "heavy"},
1313
"//conditions:default": {"test.Pool": "large"},
1414
}),
15-
shard_count = 36,
15+
shard_count = 37,
1616
tags = ["cpu:2"],
1717
deps = [
1818
"//pkg/base",

pkg/ccl/logictestccl/tests/fakedist/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/logictestccl/tests/local-legacy-schema-changer/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ go_test(
99
"//pkg/ccl/logictestccl:testdata", # keep
1010
],
1111
exec_properties = {"test.Pool": "large"},
12-
shard_count = 33,
12+
shard_count = 34,
1313
tags = ["cpu:1"],
1414
deps = [
1515
"//pkg/base",

0 commit comments

Comments
 (0)