fix(sts): reject session-token requests from temporary callers (#5582)

* fix(sts): reject session-token requests from temporary callers

* fix(sts): retain query callers with blank authorization headers
This commit is contained in:
David Phillips authored and GitHub committed 2026-10-13 13:06:21 -04:00
1 parent b8e628356c
commit 43eacd524c
5 files changed
+344 -2

No files matched your search

@@ -246,6 +246,10 @@ public class StsQueryHandler {
}
private Response handleGetSessionToken(MultivaluedMap<String, String> params) {
if (IamService.isTemporaryAccessKey(callerAccessKeyId())) {
return AwsQueryResponse.error("AccessDenied", "Cannot call GetSessionToken with session credentials",
AwsNamespaces.STS, 403);
}
Response durationValidation = validateDurationSeconds(params, 900, 129600);
if (durationValidation != null) {
return durationValidation;
@@ -523,8 +527,9 @@ public class StsQueryHandler {
/** The access key that signed this request, in the header or presigned in the query. */
private String callerAccessKeyId() {
String authorization = headers == null ? null : headers.getHeaderString("Authorization");
String auth = IamEnforcementFilter.requestAuthorization(
headers == null ? null : headers.getHeaderString("Authorization"),
authorization == null || authorization.isBlank() ? null : authorization,
uriInfo == null ? null : uriInfo.getQueryParameters());
return auth == null ? null : accountResolver.extractAccessKeyId(auth);
}