ChenSammi commented on code in PR #9445:
URL: https://github.com/apache/ozone/pull/9445#discussion_r2609718618
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/S3SecurityUtil.java:
##########
@@ -124,4 +137,32 @@ private static void
validateSTSTokenAwsSignature(STSTokenIdentifier stsTokenIden
throw new OMException(
"STS token validation failed for token: " +
omRequest.getS3Authentication().getSessionToken(), INVALID_TOKEN);
}
+
+ /**
+ * Returns true if the STS token's temporary access key ID is present in the
revoked STS token table.
+ */
+ private static boolean isRevokedStsTempAccessKeyId(STSTokenIdentifier
stsTokenIdentifier, OzoneManager ozoneManager) {
+ try {
+ final OMMetadataManager metadataManager =
ozoneManager.getMetadataManager();
+ if (metadataManager == null) {
+ return false;
+ }
+
+ final Table<String, String> revokedStsTokenTable =
metadataManager.getS3RevokedStsTokenTable();
+ if (revokedStsTokenTable == null) {
+ return false;
+ }
+
+ final String tempAccessKeyId = stsTokenIdentifier.getTempAccessKeyId();
+ if (tempAccessKeyId == null || tempAccessKeyId.isEmpty()) {
+ return false;
Review Comment:
Although the revoke hit chance is very low, but If metadataManager,
revokedStsTokenTable or tempAccessKeyId is null, we'd better throw exception to
fail the request, instead of silently ignore these cases and assuming that temp
access key ID is not revoked, for none of above cases are expected.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]