Search before asking
What happened
The access token service does not consistently enforce that a non-admin user can only create or update access tokens for the current login user.
In the current API service implementation, createToken allows a request-supplied userId when the access-token operation permission check succeeds, and the access-token permission check is permissive for ordinary users. updateToken checks ownership of the existing token, but then accepts the request-supplied userId and can move the token to another user.
This appears to regress the ownership boundary previously fixed by #11031 / #11032: access tokens should only be usable by their creator unless the operator is an administrator.
What you expected to happen
For non-admin users:
- creating an access token with
userId different from the current login user should be rejected;
- updating an existing own access token to a different
userId should be rejected;
- access token operation permissions should not bypass this ownership rule.
Administrators should still be able to manage tokens for other users if that remains the intended behavior.
How to reproduce
Add focused service tests around AccessTokenServiceImpl:
- Use a non-admin login user.
- Try to create an access token for a different
userId.
- Try to update the login user's existing token while passing a different
userId.
- Both operations should fail with no-operation permission, but the current implementation allows these paths when the access-token operation check returns true.
Anything else
The relevant code path is AccessTokenServiceImpl#createToken, AccessTokenServiceImpl#updateToken, and ResourcePermissionCheckServiceImpl.AccessTokenResourcePermissionCheck.
Version
dev
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
The access token service does not consistently enforce that a non-admin user can only create or update access tokens for the current login user.
In the current API service implementation,
createTokenallows a request-supplieduserIdwhen the access-token operation permission check succeeds, and the access-token permission check is permissive for ordinary users.updateTokenchecks ownership of the existing token, but then accepts the request-supplieduserIdand can move the token to another user.This appears to regress the ownership boundary previously fixed by #11031 / #11032: access tokens should only be usable by their creator unless the operator is an administrator.
What you expected to happen
For non-admin users:
userIddifferent from the current login user should be rejected;userIdshould be rejected;Administrators should still be able to manage tokens for other users if that remains the intended behavior.
How to reproduce
Add focused service tests around
AccessTokenServiceImpl:userId.userId.Anything else
The relevant code path is
AccessTokenServiceImpl#createToken,AccessTokenServiceImpl#updateToken, andResourcePermissionCheckServiceImpl.AccessTokenResourcePermissionCheck.Version
dev
Are you willing to submit PR?
Code of Conduct