Skip to content

Conversation

@fmorg-git
Copy link
Contributor

Please describe your PR in detail:

  • Connect S3 Gateway STS Endpoint to Backend OzoneManager Processing
  • Add configuration flag check in OzoneManager so STS assume role call is disallowed if configuration flag is not true. Also ensure non-native authorizer is being used as well.
  • A future PR will move duplicate constants and STS validation methods from the endpoint and backend OzoneManager to a shared location.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14150

How was this patch tested?

unit tests and smoke testing

@fmorg-git fmorg-git changed the base branch from master to HDDS-13323-sts January 21, 2026 04:35
@ChenSammi ChenSammi added the sts Changes for Ozone's S3 Security Token Service label Jan 21, 2026
}

@Test
public void testAssumeRoleRejectedWhenStsEnabledAndNativeAuthorizerNotUsed() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testAssumeRoleRejectedWhenStsEnabledAndNativeAuthorizerNotUsed ->

testAssumeRoleAllowedWhenStsEnabledAndNativeAuthorizerNotUsed

if (queryParams == null) {
return null;
}
final String stsQueryParam = queryParams.getFirst("X-Amz-Security-Token");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since "X-Amz-Security-Token" is case insensitive, it's better to loop the queryParams, and use the compareToIgnoreCase to compare the parameter name.

Random random = new Random();
for (int i = 0; i < length; i++) {
sb.append(chars.charAt(random.nextInt(chars.length())));
final String requestId = UUID.randomUUID().toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we return the requestId from OM, and add the requestId in assumeRole audit log?

.build();
}

final AssumeRoleResponseInfo responseInfo = getClient()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better we catch the exception from assumeRole() and generateAssumeRoleResponse(), wrap it as OS3Exception to return.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like audit log is not supported in S3AssumeRoleRequest currently.

final String accountId = parts[4];
final String resource = parts[5]; // role/<name>

if (accountId == null || accountId.isEmpty() || resource == null || !resource.startsWith("role/") ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leverage Strings.isNullOrEmpty() for string null and empty check. Strings.isNullOrEmpty is wildly used in Ozone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sts Changes for Ozone's S3 Security Token Service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants