fix(core): pass the presigned credential of a Query POST to its handler (#6073)

* fix(core): pass the presigned credential of a Query POST to its handler

* test(core): sign the presigned Query POST test like a real client
This commit is contained in:
Aymen JAMAAOUI authored and GitHub committed 2026-10-20 10:10:20 -04:00
1 parent b8d87df054
commit 32b64e5e41
2 files changed
+23

No files matched your search

@@ -137,8 +137,13 @@ public class AwsQueryController {
@Produces(MediaType.APPLICATION_XML)
public Response dispatch(
@HeaderParam("Authorization") String authorization,
@Context UriInfo uriInfo,
MultivaluedMap<String, String> formParams) {
return dispatch(IamEnforcementFilter.requestAuthorization(authorization, uriInfo.getQueryParameters()),
formParams);
}
private Response dispatch(String authorization, MultivaluedMap<String, String> formParams) {
String action = AwsQueryServiceResolver.action(formParams);
if (action == null) {
return xmlErrorResponse("MissingAction",
@@ -89,6 +89,24 @@ class RedshiftGetClusterCredentialsIamEnforcementIntegrationTest {
assertClusterNotFound(credentials(accessKeyId, cluster).formParam("AutoCreate", "true"));
}
@Test
void getClusterCredentials_presignedWithoutJoinGroup_isDenied() {
String cluster = uniqueName("gcc-presigned");
String user = uniqueName("gcc-presigned");
String accessKeyId = createUser(user);
userPolicy(user, allow("redshift:GetClusterCredentials", "*"));
assertDenied(given()
.queryParam("X-Amz-Algorithm", "AWS4-HMAC-SHA256")
.queryParam("X-Amz-Credential", accessKeyId + "/20261020/us-east-1/redshift/aws4_request")
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "GetClusterCredentials")
.formParam("Version", "2012-12-01")
.formParam("ClusterIdentifier", cluster)
.formParam("DbUser", "analyst")
.formParam("DbGroups.DbGroup.1", "analysts"));
}
@Test
void getClusterCredentials_withoutOptions_needsOnlyGetClusterCredentials() {
String cluster = uniqueName("gcc-plain");