mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(cognito): refuse DeleteUserPool while deletion protection is active (#3961)
DeletionProtection was stored and round-tripped but never read on the delete path, so a protected pool was deleted like any other and a CloudFormation DeleteStack owning one succeeded. AWS refuses with InvalidParameterException until UpdateUserPool switches the flag to INACTIVE, and the stack reports DELETE_FAILED with that reason. The check reads the pool store directly: describeUserPool would turn a delete of a missing id into ResourceNotFoundException (a separate divergence) and generate signing keys as a side effect. Closes #3948
This commit is contained in:
1 parent
7d9f499f2d
commit
1e8485830c
5 files changed
+174
-1
No files matched your search
@@ -578,6 +578,15 @@ public class CognitoService implements ResourceProvider {
|
||||
}
|
||||
|
||||
public void deleteUserPool(String id) {
|
||||
// Deletion protection is the pool's own guard against this call: with it ACTIVE, AWS
|
||||
// refuses until an UpdateUserPool switches it to INACTIVE (developer guide, "User pool
|
||||
// deletion protection"), and a CloudFormation delete of the pool reports DELETE_FAILED.
|
||||
String deletionProtection = poolStore.get(id).map(UserPool::getDeletionProtection).orElse(null);
|
||||
if ("ACTIVE".equalsIgnoreCase(deletionProtection)) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"The user pool cannot be deleted because deletion protection is activated. "
|
||||
+ "Deletion protection must be inactivated first.", 400);
|
||||
}
|
||||
// AWS refuses to delete a pool that still has a hosted UI / custom domain; the
|
||||
// DeleteUserPool API reference documents this exact InvalidParameterException.
|
||||
boolean hasDomain = domainStore.scan(k -> true).stream()
|
||||
|
||||
Reference in new issue
Block a user