Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add null check for ApiKeyPair in getUserByApiKey
The function getUserByApiKey was not checking for null pointers. I think this is safe from the perspective of security, but this is a smell. And it can be easily addressed with the same solution used in line 3160.
  • Loading branch information
daviftorres authored Mar 31, 2026
commit a8499255affb8a36745c1c19aec917b88fd465e2
3 changes: 3 additions & 0 deletions server/src/main/java/com/cloud/user/AccountManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3828,6 +3828,9 @@ public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEn
@Override
public UserAccount getUserByApiKey(String apiKey) {
ApiKeyPairVO keyPair = apiKeyPairDao.findByApiKey(apiKey);
if (keyPair == null) {
return null;
}
Comment thread
daviftorres marked this conversation as resolved.
return userAccountDao.findById(keyPair.getUserId());
}

Expand Down
Loading