HDDS-16110. [STS] Update key in sts revocation table - #11030
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the patch! @fmorg-git I left a few comments. Otherwise, this looks good.
| return omClientResponse; | ||
| } | ||
|
|
||
| private static void validateRevokeRequestFields(OzoneManagerProtocolProtos.RevokeSTSTokenRequest revokeReq) |
There was a problem hiding this comment.
Since the value comes directly from the request, allowing | could create a revoke-key collision across users. Would it make sense to validate tempAccessKeyId against its generated format (ASIA plus 20 [0-9A-Z] characters) and bound both field lengths??
There was a problem hiding this comment.
good catch - updated
| throw new SecretManager.InvalidToken("Failed to decode STS token string: " + e); | ||
| } catch (IOException | RuntimeException e) { | ||
| throw new SecretManager.InvalidToken( | ||
| "Failed to decode STS token string: " + e + " for encodedToken: " + encodedToken); |
There was a problem hiding this comment.
Including the full client-provided token here could make failed requests unusually noisy. Perhaps the token length, a short prefix, or a hash would provide enough debugging context without writing the entire value to the response and logs. What do you think?
There was a problem hiding this comment.
updated (sorry I forgot why I left it out originally)
| // created the token) so the audit trail is not limited to the opaque tempAccessKeyId. | ||
| final String originalAccessKeyId = AuditUtils.getStsOriginalAccessKeyId(s3Auth.getSessionToken()); | ||
| if (originalAccessKeyId != null) { | ||
| auditMap.put("originalAccessKeyId", originalAccessKeyId); |
There was a problem hiding this comment.
nit: this uses the literal "originalAccessKeyId" while the OM side goes through OzoneConsts.S3_REVOKESTSTOKEN_ORIGINAL_ACCESS_KEY_ID. Could this share a constant so the two audit logs can't drift?
Please describe your PR in detail:
TestAuditUtils), it was noticed certain inputs could cause the token parsing to fail that were not already covered, so this PR addresses that as well.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16110
How was this patch tested?