ChenSammi commented on code in PR #9445:
URL: https://github.com/apache/ozone/pull/9445#discussion_r2618254660
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/S3SecurityUtil.java:
##########
@@ -124,4 +138,39 @@ 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)
+ throws OMException {
+ try {
+ final OMMetadataManager metadataManager =
ozoneManager.getMetadataManager();
+ if (metadataManager == null) {
+ final String msg = "Could not determine STS revocation:
metadataManager is null";
+ LOG.warn(msg);
+ throw new OMException(msg, INTERNAL_ERROR);
+ }
+
+ final Table<String, String> revokedStsTokenTable =
metadataManager.getS3RevokedStsTokenTable();
+ if (revokedStsTokenTable == null) {
+ final String msg = "Could not determine STS revocation:
revokedStsTokenTable is null";
+ LOG.warn(msg);
+ throw new OMException(msg, INTERNAL_ERROR);
+ }
+
+ final String tempAccessKeyId = stsTokenIdentifier.getTempAccessKeyId();
+ if (tempAccessKeyId == null || tempAccessKeyId.isEmpty()) {
+ final String msg = "Could not determine STS revocation:
tempAccessKeyId in STSTokenIdentifier is null/empty";
+ LOG.warn(msg);
+ throw new OMException(msg, INTERNAL_ERROR);
Review Comment:
If tempAccessKeyId is null or empty, it's an invalid tempAccessKeyId,
INTERNAL_ERROR is not a proper error code. Do we have a stsTokenIdentifier
check in OM side? It's better to move this check to there.
--
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]