Skip to content

Commit 6cce026

Browse files
authored
Service Accounts - Ensure valid random service token name (#73098) (#73203)
The random token name is a base64 UUID. It can sometimes vilolate the validation rules. The base64 UUID is now prefixed with a string token_ to ensure the name is always valid.
1 parent 3fc0897 commit 6cce026

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/service/RestCreateServiceAccountTokenAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public String getName() {
4848
protected RestChannelConsumer innerPrepareRequest(RestRequest request, NodeClient client) throws IOException {
4949
String tokenName = request.param("name");
5050
if (Strings.isNullOrEmpty(tokenName)) {
51-
tokenName = UUIDs.base64UUID();
51+
tokenName = "token_" + UUIDs.base64UUID();
5252
}
5353
final CreateServiceAccountTokenRequest createServiceAccountTokenRequest = new CreateServiceAccountTokenRequest(
5454
request.param("namespace"), request.param("service"), tokenName);

0 commit comments

Comments
 (0)