-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Fleet] Use UUID to Ensure Unique Service Token for Fleet Server #193596
base: main
Are you sure you want to change the base?
[Fleet] Use UUID to Ensure Unique Service Token for Fleet Server #193596
Conversation
💚 CLA has been signed |
Pinging @elastic/fleet (Team:Fleet) |
@@ -133,7 +134,7 @@ export const generateServiceTokenHandler: RequestHandler< | |||
token?: GenerateServiceTokenResponse; | |||
}>({ | |||
method: 'POST', | |||
path: `_security/service/elastic/${serviceAccount}/credential/token/token-${Date.now()}`, | |||
path: `_security/service/elastic/${serviceAccount}/credential/token/token-${uuidv4()}`, |
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.
thanks for the contribution. @swapanmandi it seems elasticsearch is already generating a uuid if the name is not passed, so I think we can use that behaviour and directly call /credential/token
without a name
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.
it seems elasticsearch is already generating a uuid if the name is not passed, so I think we can use that behaviour and directly call /credential/token
without a name
fix #193537
Description:
This PR fixes the issue of potential conflicts when generating service tokens for the Fleet server by using the uuid library to ensure unique token names. Previously, there was a risk of token name collisions due to timestamp-based token names, which could cause conflicts during token creation.
Key changes:
Implemented uuidv4() to generate unique service token names.
Updated service token creation logic to use the unique identifier in the token path.uses a timestamp for the token name, which is not guaranteed to be unique.