ChenSammi commented on code in PR #9445:
URL: https://github.com/apache/ozone/pull/9445#discussion_r2609754822
##########
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;
+ }
+
+ return revokedStsTokenTable.getIfExist(tempAccessKeyId) != null;
+ } catch (Exception e) {
+ // Any DB or codec problem is treated as best-effort failure.
Review Comment:
Whether the revocation check is a best-effort, or strictly enforced, it's an
important behavior of revocation, we should highlight it clearly in the design
doc. Current doc doesn't have this info.
--
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]