fix(redshift): read ARNs with '!' in a secret name or ':' in an IAM path (#7112)

This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-31 14:03:19 -04:00
1 parent d2f0455cd9
commit bc237ae980
4 files changed
+25 -2

No files matched your search

@@ -144,6 +144,19 @@ class RedshiftDestinationValidatorTest {
assertTrue(messageOf(dest).contains("secretsManagerConfiguration.secretARN"));
}
@Test
void secretArnAcceptsEveryCharacterTheModelAllows() throws Exception {
RedshiftDestination dest = valid();
dest.setUsername(null);
dest.setPassword(null);
RedshiftDestination.SecretsManagerConfiguration secrets = new RedshiftDestination.SecretsManagerConfiguration();
secrets.setEnabled(true);
secrets.setSecretArn("arn:aws:secretsmanager:us-east-1:000000000000:secret:team/db!creds-AbCdEf");
dest.setSecretsManagerConfiguration(secrets);
assertDoesNotThrow(() -> RedshiftDestinationValidator.validateConfiguration(dest, SHAPE));
}
@Test
void invalidBackupModeAndDisablingBackupAreRejected() throws Exception {
RedshiftDestination dest = valid();
@@ -42,6 +42,15 @@ class RedshiftIamDbUserResolverTest {
assertEquals("IAM:alice", resolver.resolveDbUser("auth"));
}
@Test
void userPathContainingAColonStillYieldsTheUserName() {
when(accountResolver.extractAccessKeyId("auth")).thenReturn("AKIA123");
when(iamService.resolveCallerArn("AKIA123"))
.thenReturn(Optional.of("arn:aws:iam::000000000000:user/team:x/alice"));
assertEquals("IAM:alice", resolver.resolveDbUser("auth"));
}
@Test
void mapsAssumedRoleArnToIamrPrefix() {
when(accountResolver.extractAccessKeyId("auth")).thenReturn("ASIA123");