mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 16:11:48 -05:00
fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string (#4431)
* fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string CreateUser read passwords only from AuthenticationMode, so a user created with the top-level Passwords member (aws elasticache create-user --passwords) was stored as no-password-required. ModifyUser ignored AuthenticationMode.Type, NoPasswordRequired, AccessString and AppendAccessString, so a user's auth mode and permissions could not be changed without deleting it. Both actions now resolve authentication from AuthenticationMode or from the top-level Passwords and NoPasswordRequired members, and reject contradictory combinations with InvalidParameterCombination. * test(elasticache): use explicit response types in the user auth compat test * ci: re-run checks after a Docker Hub image pull rate limit The previous run's shard 3 failed on 'toomanyrequests: Data limit exceeded' while pulling images for three ECS and core Docker integration tests. Nothing in this branch touches those paths.
This commit is contained in:
1 parent
e51119679c
commit
4001556a31
5 files changed
+311
-19
No files matched your search
@@ -12,6 +12,7 @@ import software.amazon.awssdk.services.elasticache.ElastiCacheClient;
|
||||
import software.amazon.awssdk.services.elasticache.model.AuthenticationMode;
|
||||
import software.amazon.awssdk.services.elasticache.model.CreateReplicationGroupRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.CreateUserRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.CreateUserResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.DeleteReplicationGroupRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DeleteUserRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.DescribeReplicationGroupsRequest;
|
||||
@@ -20,6 +21,7 @@ import software.amazon.awssdk.services.elasticache.model.Endpoint;
|
||||
import software.amazon.awssdk.services.elasticache.model.InputAuthenticationType;
|
||||
import software.amazon.awssdk.services.elasticache.model.ModifyReplicationGroupRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.ModifyUserRequest;
|
||||
import software.amazon.awssdk.services.elasticache.model.ModifyUserResponse;
|
||||
import software.amazon.awssdk.services.elasticache.model.ReplicationGroup;
|
||||
import software.amazon.awssdk.services.elasticache.model.ElastiCacheException;
|
||||
|
||||
@@ -299,6 +301,38 @@ class ElastiCacheTest {
|
||||
|
||||
@Test
|
||||
@Order(12)
|
||||
void topLevelPasswordsAndAccessStringChangesRoundTrip() {
|
||||
String passwordUserId = TestFixtures.uniqueName("ec-pw-user");
|
||||
CreateUserResponse created = elasticache.createUser(CreateUserRequest.builder()
|
||||
.userId(passwordUserId)
|
||||
.userName(TestFixtures.uniqueName("ec-pw-name"))
|
||||
.engine("redis")
|
||||
.accessString("on ~app:* -@all +@read")
|
||||
.passwords("top-level-password-1")
|
||||
.build());
|
||||
assertThat(created.authentication().typeAsString()).isEqualTo("password");
|
||||
assertThat(created.authentication().passwordCount()).isEqualTo(1);
|
||||
|
||||
try {
|
||||
ModifyUserResponse appended = elasticache.modifyUser(ModifyUserRequest.builder()
|
||||
.userId(passwordUserId)
|
||||
.appendAccessString("+@write")
|
||||
.build());
|
||||
assertThat(appended.accessString()).isEqualTo("on ~app:* -@all +@read +@write");
|
||||
|
||||
ModifyUserResponse opened = elasticache.modifyUser(ModifyUserRequest.builder()
|
||||
.userId(passwordUserId)
|
||||
.noPasswordRequired(true)
|
||||
.build());
|
||||
assertThat(opened.authentication().typeAsString()).isEqualTo("no-password-required");
|
||||
assertThat(opened.authentication().passwordCount()).isZero();
|
||||
} finally {
|
||||
elasticache.deleteUser(DeleteUserRequest.builder().userId(passwordUserId).build());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(13)
|
||||
void deleteReplicationGroupReleasesPortForReuse() {
|
||||
requireGroup();
|
||||
|
||||
|
||||
Reference in new issue
Block a user