mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
76c1907214db0e9cb968ac0ffbc8cafea06299a3
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0a3bc030f6 |
feat(cognito): implement identity provider configuration CRUD (#2858)
* feat(cognito): implement identity provider configuration CRUD CreateIdentityProvider, DescribeIdentityProvider, ListIdentityProviders, UpdateIdentityProvider and DeleteIdentityProvider were unsupported, so infrastructure tooling could not manage a user pool's federated providers. Stores provider configuration alongside the other user pool sub-resources and matches the response and update semantics measured against the live API: - IdpIdentifiers is echoed by create and update only when the request supplied the member, whatever the stored value; describe always returns it - AttributeMapping defaults to username -> sub when the member is absent at create, while an explicitly empty map is stored as given - members a request omits are preserved rather than cleared - a duplicate provider name raises DuplicateProviderException - ListIdentityProviders returns name/type/date summaries, never ProviderDetails Federated sign-in itself is out of scope: Floci has no /oauth2/authorize or /oauth2/idpresponse endpoint, so providers are stored configuration only. * test(cognito): match identity provider exceptions on the SDK error name `rejects.toThrow(/re/)` matches the error message, but the JS SDK maps the wire `__type` onto `error.name` and puts the AWS text in `message`, so the duplicate provider assertion never matched. Assert the name, and pin the enum text with an explicit message matcher. * fix(cognito): delete a pool's identity providers with the pool, and update a copy Two review findings, both reproduced first. DeleteUserPool left provider records behind. A pool recreated on a pinned id (`floci:override-id`) then inherited the dead pool's providers, ProviderDetails client_secret included. Pool deletion now removes them the way it already removes groups. UpdateIdentityProvider mutated the instance the store handed back, so two concurrent updates could interleave into a state matching neither request. It now writes a copy, which makes the losing update simply lose — what AWS does. * fix(cognito): serialise identity provider mutations UpdateIdentityProvider is a read-modify-write: it copies the stored provider, applies only the members the request supplied and writes the whole record back. Two overlapping updates copied the same base, so the later write restored the other's omitted members to their stale values and silently dropped an update. Live Cognito merges omitted members rather than clearing them, and applies that merge atomically, so both updates survive there. One lock now guards every mutating path, since create (check-then-put) and delete (check-then-act) carry the same race, matching the existing identityLinkLock idiom. The regression test runs two writers touching different optional members across 25 rounds; it fails on the first round with the lock reverted. * fix(cognito): guard the pool deletion provider cascade with the same lock DeleteUserPool clears a pool's identity providers outside identityProviderLock, so a create or update interleaving with the cascade could reinstate a provider for a pool that is going away. It now takes the same lock as the mutations it races, closing the last unguarded path in that set. * fix(cognito): recheck the pool under the lock when creating a provider CreateIdentityProvider validated the pool before taking identityProviderLock and never rechecked it, so a DeleteUserPool whose cascade ran in between left the create writing a provider for a pool that no longer exists. It now reasserts the pool inside the lock, immediately before the duplicate check and the write. UpdateIdentityProvider needs no equivalent: the cascade deletes the provider, so its own lookup throws ResourceNotFoundException. The outer validation stays where it is to keep error ordering unchanged for ordinary single-request calls. |
||
|
|
b8f1e22c74 |
feat(cognito): implement log delivery configuration (#2867)
* feat(cognito): implement log delivery configuration SetLogDeliveryConfiguration and GetLogDeliveryConfiguration were unsupported, so a config declaring `aws_cognito_log_delivery_configuration` could not be applied against Floci. The configuration is stored on the user pool and validated the way the live API validates it: - LogLevel accepts ERROR or INFO, EventSource accepts userNotification or userAuthEvents, both reported with AWS's 1-based member path - every entry must name a CloudWatch, Firehose or S3 destination - Set replaces the list rather than merging, so an empty list clears it - Get always returns LogConfigurations, as [] when nothing is configured Floci stores the configuration and delivers nothing: the destination is neither written to nor required to exist, and the pricing-tier gate AWS applies to userAuthEvents is not reproduced. Closes #2855 * fix(cognito): reject a null LogConfigurations instead of clearing the configuration SetLogDeliveryConfiguration treated an omitted, null or wrongly typed LogConfigurations as an empty replacement, so a malformed request returned 200 and erased the pool's stored configuration. AWS rejects all three. An omitted or null member fails validation, and a value of the wrong JSON type fails deserialization: omitted / null -> InvalidParameterException: 1 validation error detected: Value null at 'logConfigurations' failed to satisfy constraint: Member must not be null wrong type -> SerializationException: Expected list or null Also drops two em-dashes from the docs, per AGENTS.md. * fix(cognito): translate malformed LogConfigurations elements the way AWS does A scalar inside the array reached Jackson's convertValue directly, so an IllegalArgumentException escaped as a 500 InternalFailure instead of a client error, and a null element would have failed on the validation loop. AWS answers both without a 500: [1, 2] / ["a string"] -> SerializationException: Expected null [null] -> 200, the null element is dropped Elements are now checked before conversion: nulls are skipped and non-objects raise SerializationException. * fix(cognito): bound LogConfigurations and reject a repeated event source SetLogDeliveryConfiguration validated each element but never checked the list itself, so a request with three or more well-formed configurations, or two naming the same event source, was accepted and stored where AWS rejects it. Measured against Cognito in ap-southeast-1: 3 well-formed configs InvalidParameterException, length constraint on 'logConfigurations', max 2 2 duplicate sources InvalidParameterException, "appear more then once" 3 configs, one bad enum 2 validation errors, the length one reported first unknown pool, bad enum the validation error, not ResourceNotFoundException 0 configs 200 OK The shape checks now run before the pool lookup, matching that last row, and collect every violation into one message instead of throwing on the first. The duplicate and missing-destination complaints share one message with the missing-destination clause first, and each event source is named once however many configurations carry it, as measured. "more then once" is the service's own spelling, kept so the message matches. The length message embeds the request model's toString, which the emulator now reproduces for all three destination shapes and for an absent destination. |
||
|
|
1cccf43f7b |
feat(cognito): include all standard attributes in DescribeUserPool Schema (#642)
* feat(cognito): include all standard attributes in DescribeUserPool SchemaAttributes AWS Cognito always returns all 20 standard OIDC attributes (sub, name, email, phone_number, etc.) in SchemaAttributes when describing a user pool, even if none were explicitly configured. Floci was returning only what was passed in Schema during creation. Adds CognitoStandardAttributes with the full default set and a merge() helper that overlays explicit schema overrides and appends custom: attributes after the standard ones. * test(cognito): add compat tests for standard SchemaAttributes across all SDKs Adds DescribeUserPool SchemaAttributes coverage to all compatibility test suites (AWS CLI/bats, Go, Java, Node, Python, Rust), verifying that all 20 standard OIDC attributes are returned and that sub is required and immutable. |
||
|
|
eeefb729c4 |
test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo * fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler * fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest * test: add sdk tests for multipart S3 copy coverage * fix: cover and fix smithy cbor and multipart s3 copy regressions * test: migrate more test coverage to new folder * test: add missing ec2 expectation in healthcheck test * docs: update READMEs in `./compatibility-tests` |