Skip to content

Commit 9439f20

Browse files
authored
test/suites/serverconfig.sh Special key user.microcloud is exposed to untrusted clients (#16519)
# Done - test/suites/serverconfig.sh Special key user.microcloud is exposed to untrusted clients. - Other server configuration is private. Relates to #16442 fixes [WD-26747](https://warthogs.atlassian.net/browse/WD-26747) [WD-26747]: https://warthogs.atlassian.net/browse/WD-26747?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2 parents b6de170 + 73b281e commit 9439f20

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/suites/serverconfig.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test_server_config() {
77
_server_config_storage
88
_server_config_auth_secret
99
_server_config_cluster_uuid
10+
_server_config_user_microcloud
1011

1112
kill_lxd "${LXD_SERVERCONFIG_DIR}"
1213
}
@@ -181,3 +182,23 @@ _server_config_storage() {
181182
# Cleanup
182183
lxc delete -f foo
183184
}
185+
186+
_server_config_user_microcloud() {
187+
# Set config key user.microcloud, which is readable by untrusted clients
188+
lxc config set user.microcloud true
189+
[ "$(lxc config get user.microcloud)" = "true" ]
190+
[ "$(curl "https://${LXD_ADDR}/1.0" --insecure | jq '.metadata.config["user.microcloud"]')" = '"true"' ]
191+
192+
# Set config key user.foo, which is not exposed to untrusted clients
193+
lxc config set user.foo bar
194+
[ "$(lxc config get user.foo)" = "bar" ]
195+
[ "$(curl "https://${LXD_ADDR}/1.0" --insecure | jq '.metadata.config["user.foo"]')" = 'null' ]
196+
197+
# Unset all config and check it worked
198+
lxc config unset user.microcloud
199+
lxc config unset user.foo
200+
[ "$(lxc config get user.microcloud)" = "" ]
201+
[ "$(lxc config get user.foo)" = "" ]
202+
[ "$(curl "https://${LXD_ADDR}/1.0" --insecure | jq '.metadata.config["user.microcloud"]')" = 'null' ]
203+
[ "$(curl "https://${LXD_ADDR}/1.0" --insecure | jq '.metadata.config["user.foo"]')" = 'null' ]
204+
}

0 commit comments

Comments
 (0)