You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "sureshanaparti (via GitHub)" <gi...@apache.org> on 2026/04/01 07:40:32 UTC
Re: [PR] Add null check for ApiKeyPair in getUserByApiKey [cloudstack]
sureshanaparti commented on code in PR #12938:
URL: https://github.com/apache/cloudstack/pull/12938#discussion_r3020367607
##########
server/src/main/java/com/cloud/user/AccountManagerImpl.java:
##########
@@ -3827,7 +3827,11 @@ public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEn
@Override
public UserAccount getUserByApiKey(String apiKey) {
+ if (keyPair == null) {
+ return null;
+ }
ApiKeyPairVO keyPair = apiKeyPairDao.findByApiKey(apiKey);
+
Review Comment:
can add arg validator - `validations = {ApiArgValidator.NotNullOrEmpty}` at the api param below to not allow null or empty value
https://github.com/apache/cloudstack/blob/4f93ba888c36d992c09af8d2486ea4ec75102f79/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java#L38
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org