mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(sts): issue GetSessionToken without IAM permissions (#6051)
AWS's GetSessionToken reference says no permissions are required for the call and that policies cannot control authentication operations. IAM enforcement evaluated it like any other action, so an explicit deny, or simply no allow, answered AccessDenied where AWS mints credentials. Exempt sts:GetSessionToken alongside sts:GetCallerIdentity. The request still needs valid, active, unexpired credentials, and the handler still refuses temporary callers. Other STS actions stay policy-decided. Fixes #6041
This commit is contained in:
2 files changed
+39
-2
No files matched your search
@@ -67,6 +67,8 @@ import java.util.regex.Pattern;
|
||||
* <li>The action cannot be resolved (unknown mapping → permissive)</li>
|
||||
* <li>The action is {@code sts:GetCallerIdentity}, which AWS allows without permissions. The
|
||||
* key itself is still checked.</li>
|
||||
* <li>The action is {@code sts:GetSessionToken}, which AWS also allows without permissions:
|
||||
* policies cannot control authentication operations. The key itself is still checked.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Authenticated temporary callers of {@code sts:GetFederationToken} are refused here with
|
||||
@@ -383,6 +385,11 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
|
||||
if ("sts:GetCallerIdentity".equals(action)) {
|
||||
return; // AWS returns caller identity even when an identity policy explicitly denies it
|
||||
}
|
||||
if ("sts:GetSessionToken".equals(action)) {
|
||||
// AWS: "No permissions are required for users to perform this operation... You cannot
|
||||
// use policies to control authentication operations." An explicit deny does not stop it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ("sts:GetFederationToken".equals(action) && IamService.isTemporaryAccessKey(akid)) {
|
||||
ctx.abortWith(queryXmlAccessDenied(IamService.FEDERATION_TOKEN_SESSION_MESSAGE));
|
||||
|
||||
Reference in new issue
Block a user