fmorg-git commented on code in PR #11095:
URL: https://github.com/apache/ozone/pull/11095#discussion_r3848949988
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/STSSecurityUtil.java:
##########
@@ -157,7 +157,7 @@ private static Token<STSTokenIdentifier>
decodeTokenFromString(String encodedTok
try {
token.decodeFromUrlString(encodedToken);
return token;
- } catch (IOException e) {
+ } catch (IOException | RuntimeException e) {
Review Comment:
so actually, this is very subtle and required. The catching of this
`RuntimeException` is what I was referring to for this fix in the PR
description `As a side effect of testing this change, it was noticed certain
inputs could cause the token parsing to fail that were not already covered, so
this PR addresses that as well`.
Here is explanation:
`Token.decodeFromUrlString()` only declares `IOException`, but Hadoop’s
deserialization can throw unchecked exceptions for malformed tokens — e.g.
`NegativeArraySizeException` when a decoded length is negative.
We want all decode failures mapped to SecretManager.InvalidToken →
OMException(INVALID_TOKEN), so that’s why RuntimeException is caught here.
`testConstructValidateAndDecryptSTSTokenRuntimeDecodeFailure` in unit tests and
the `not-a-valid-token` case in `Tampered STS Token Service, Policy, or
Signature Must Fail `smoke test cover this.
--
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]