mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(cognito): delete a user pool's app clients, revocations and codes #3419 took users and resource servers out with the pool, closing the half of #2864 that was reported. Three more record types are the same defect and were left behind: app clients, revoked token records and outstanding verification codes. On AWS a pool id is never reused, so nothing can inherit an orphan. Here floci:override-id makes ids caller-chosen and therefore reusable, and a pool recreated on a pinned id picks up whatever the deleted pool left. Reproduced by pinning us-east-1_orphanprobe1, populating it, deleting the pool and recreating it on the same id. The client leak is the serious one: the deleted pool's client id kept resolving against the new pool, carrying a secret the new pool's caller never saw. clients: ["c1"] describe-user-pool-client --client-id c1a93e3fc698451d96ed406adb -> c1 Clients are keyed by client id alone, so they are found by their userPoolId field rather than a key prefix. Revoked tokens and verification codes have their keys collected before deleting so the backing key set is not modified while it is being iterated. confirmSignUpNamesDeletedUserPoolInResourceNotFoundMessage, added by #2936, built its orphaned client by deleting the client's pool, which this cascade now prevents. It is renamed and reaches the same defensive path by dropping the pool record alone, and a second case pins the new behaviour: a client id from a deleted pool is gone with it. Refs #2864 * fix(cognito): bound the delete cascade by pool ownership, not key prefix floci:override-id makes pool ids caller-chosen, and validateOverrideId permits a colon. Two live pools can therefore be named so that one id plus the key separator is a prefix of the other, and the revoked-token and verification-code cascades deleted by the matched key, so deleting the shorter pool erased the longer one's records. For revoked tokens that reinstated tokens the surviving pool had revoked. Both records carry their own userPoolId, so ownership is now settled by that field rather than by the key prefix. The other cascades reconstruct the key from the pool id being deleted and so never reached across a boundary; they are left alone. A jti can itself contain a colon (global revocations use global:{username}), so bounding the prefix by the separator would not have been sufficient either.