bernardodemarco commented on code in PR #13828:
URL: https://github.com/apache/cloudstack/pull/13828#discussion_r3832330811
##########
server/src/main/java/com/cloud/api/ApiServer.java:
##########
@@ -1156,7 +1156,7 @@ public boolean verifyRequest(final Map<String, Object[]>
requestParameters, fina
CallContext.register(user, account);
List<ApiKeyPairPermission> keyPairPermissions =
keyPairManager.findAllPermissionsByKeyPairId(keyPair.getId(),
account.getRoleId());
- if (commandAvailable(remoteAddress, commandName, user,
keyPairPermissions.toArray(new ApiKeyPairPermission[0]))) {
+ if (commandAvailable(remoteAddress, commandName, user, keyPair,
keyPairPermissions.toArray(new ApiKeyPairPermission[0]))) {
logger.info("API accessed through API Key Pair. API Key:
[{}].", keyPair.getApiKey());
Review Comment:
Hello, @weizhouapache
> I think this should be moved from line 1156 to line 1160, right ?
I'm not sure this would cause any real effect. Currently, if a key pair does
not have access to a certain command, `CallContext` is registered, but, at the
next step, `verifyRequest` returns `false`, which causes the API to be aborted
with an error message.
> it looks like this additional check will increase the latency of request.
have you tested it ?
I did not test the performance of the workflow; my focus was targeted more
to accuracy. But, IMHO, the workflows involving API key pairs
authentication/authorization have vast room for improvement regarding
performance... We can address them incrementally in the future.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]