AvailableChallenges is declared on InitiateAuthResponse and
AdminInitiateAuthResponse only, but the SELECT_CHALLENGE path copied it
onto the RespondToAuthChallenge and AdminRespondToAuthChallenge
responses as well. Keep it on the InitiateAuth responses and drop it
from the challenge responses issued when answering SELECT_CHALLENGE.
Closes#4003
performReset stops every managed container first, then walks the
Resettable list and adds each service to `prepared` right before calling
its beforeReset(). When one beforeReset() threw, the loop stopped and
every later service was never added, so the finally block skipped their
afterReset(). Their teardown had already run, though: the SageMaker
training runner and endpoint manager had shut their worker pools down
and EcsService had stopped its reconciler, and those are only restored
in afterReset() (#3937). After such a reset every CreateTrainingJob,
CreateEndpoint and UpdateEndpoint returned 500 with
RejectedExecutionException and ECS services were never reconciled again
until the process restarted.
The finally block now runs afterReset() over the full service list in
reverse order, dropping the `prepared` list. afterReset() already had to
tolerate a reset that failed before clear(); tolerating one that failed
before beforeReset() is the same contract, and the Resettable Javadoc
now says so. A controller test registers a Resettable whose
beforeReset() throws between two others and asserts that the error is
rethrown, the wipe and clear() are skipped, and afterReset() still runs
on all three, including the one whose beforeReset() never ran.
Closes#3952Closes#3796
Extracts the six AWS::ApiGatewayV2::* types (Api, Authorizer, Deployment, Integration, Route, Stage) and the OpenAPI body subsystem out of the CloudFormationResourceProvisioner monolith into a dedicated ApiGatewayV2CfnProvisioner, continuing the per-service provisioner migration.
Behavior is preserved for the attributes the monolith already set (Ref and each Fn::GetAtt). Moving AWS::ApiGatewayV2::Api into the registry subjects it to the schema-coverage gate, which surfaced the readOnly ExecuteApiArn attribute the monolith never published; it is now set to arn:<partition>:execute-api:<region>:<account>:<apiId>, the prefix a Lambda permission builds its SourceArn from.
The monolith's failed-update tracking now delegates to the registry owner through a new mergeFailedUpdateResourceTracking hook, so the provisioner carries its body-materialized route, integration, and authorizer tracking forward itself.
* feat(docker): add cpu limits and readonly rootfs to container specs
ECS expresses CPU as units where 1024 units is one vCPU, and a task
definition can ask for a container's own filesystem to be read only.
Neither reached the Docker host config.
ContainerSpec gains nanoCpus, cpuShares and readonlyRootfs, the builder
gains withCpuUnits, withCpuShares and withReadonlyRootfs, and
ContainerLifecycleManager maps them onto withNanoCPUs, withCpuShares and
withReadonlyRootfs. Existing convenience constructors keep their old
shapes and default the three new components, so no current caller
changes behaviour.
Docker refuses a NanoCpus above the host's CPU count, while ECS accepts a
task cpu of up to 196608 units, so a 16 vCPU task asked for verbatim
would fail to start on a smaller machine. The quota is held to the
daemon's reported NCPU, read once and left alone when the daemon does not
report one.
ContainerLifecycleManagerCpuLimitTest builds a spec through the builder,
captures the HostConfig on create and pins the unit conversion, the
zero/negative guards, the cpuShares passthrough, readonlyRootfs and both
sides of the clamp.
* refactor(ecs): take request objects and split out the response writer
ECS's launch operations were reached through positional argument lists
that had grown past what a signature can carry: registerTaskDefinition
took ten parameters, createService thirteen, and the handler had started
setting members on the returned object afterwards because there was
nowhere in the signature to put them. EcsJsonHandler had grown the same
way, with request parsing and response rendering, roughly half the file
each, interleaved.
CreateClusterRequest, RegisterTaskDefinitionRequest, RunTaskRequest,
CreateServiceRequest, UpdateServiceRequest, CreateTaskSetRequest and
ListTasksRequest carry what their operation was already given. Each
positional overload stays, building the request and delegating, so the
CloudFormation, EventBridge, Scheduler and Step Functions call sites are
untouched. RegisterTaskDefinition's volumes and runtimePlatform move
into the request, which removes the post-hoc mutate-and-persist the
handler needed to get them onto the stored definition.
EcsResponseWriter takes the node builders out of the handler verbatim.
The handler keeps a taskNode delegate, which is what the Step Functions
ecs:runTask integration renders through, and a constructor that builds
its own writer for the tests that assemble it without CDI.
No behaviour changes: every response is byte-for-byte what it was, and
the existing ECS, CodeDeploy, EventBridge and Step Functions suites pass
unchanged apart from the handler unit tests, which stub the request-object
overload instead of the positional one.
Adds CloudFormationServiceRestoreIntegrationTest, covering the path where an
operation rejected by the bounded executor must leave both the stack and its
change set with their prior state restored.
The test installs a QuarkusMock over CloudFormationResourceProvisioner whose
default answer blocks whenever an argument starts with the "restore-it-" stack
prefix and delegates everything else to ClientProxy.unwrap(provisioner). It
matches provision by method name rather than stubbing one overload, so it
survives main adding a new one, and on failure it reports how many operations
reached the provisioner along with call counts grouped by method.
Effective diff is this one new test file. The bounded operation executor this
branch was stacked on landed separately in #3761.
Move AWS::IAM::ManagedPolicy, the last IAM type in the monolith, into a new IamManagedPolicyCfnProvisioner over IamService. Ref and Fn::GetAtt PolicyArn return the policy ARN. On UpdateStack with an unchanged name PolicyDocument is applied as a new default version in place, pruning the oldest versions under IAM's five-version cap and detaching roles no longer listed, and a mid-update failure restores the version and attachment state this pass changed. Delete detaches the roles before DeletePolicy, tolerating an already-gone attachment.
Stacked on #3971 (inline Policy); merge that first. The move resolves PolicyArn and DefaultVersionId as Fn::GetAtt keys and records the five other read-only attributes (AttachmentCount, CreateDate, UpdateDate, IsAttachable, PermissionsBoundaryUsageCount) as gaps, since leaving LEGACY_SWITCH subjects the type to CfnSchemaCoverageTest. The small managed-policy delete helpers are duplicated with IamPolicyCfnProvisioner's legacy path for now, to be collapsed into a shared helper once both land.
* feat(glue): Data Catalog connections
Add CreateConnection, GetConnection, GetConnections, UpdateConnection,
DeleteConnection, BatchDeleteConnection and TestConnection. A connection
precedes every job and crawler in a Glue stack and Terraform reads it on
each plan, so without it a stack with an aws_glue_connection could not
get past its first plan.
Behaviour follows the Glue API reference: HidePassword omits PASSWORD
and ENCRYPTED_PASSWORD, UpdateConnection redefines the connection rather
than merging into it, ConnectionInput is validated against the documented
limits and enumerations, credentials are accepted and never returned,
and TestConnection accepts a well-formed request with an empty body
without opening a socket.
Closes#3938
* feat(glue): cap BatchDeleteConnection at 25 names and document HidePassword's scope
The API reference caps ConnectionNameList at 25 entries; a longer list
is now InvalidInputException. HidePassword's coverage of the Kafka
credential keys is not documented by AWS, so the docs page states that
Floci removes PASSWORD and ENCRYPTED_PASSWORD only.
Connect http:// hostname targets to the address that was checked instead of resolving the name a second time, and apply the link-local and metadata check to the WebSocket HTTP and HTTP_PROXY integrations. The pinned socket path now returns an empty body for HEAD, 204, 304 and 1xx responses.
Every ConflictException, ResourceNotFoundException, and ServiceQuotaExceededException
the service threw carried a message only, but the wire model declares
resourceId/resourceType on all three, and the AWS SDK exposes them as typed
accessors. Populate them consistently using the resource's locally-unique name
(domain name, repository name, package version, or asset name) as resourceId.
Populating resourceId this way exposed a real crash: Map.of() rejects null
values, so any request missing a required identifier (domain, repository,
package, packageVersion, asset) turned what used to be a wrong-status
ResourceNotFoundException into a raw NullPointerException / HTTP 500. Fixed
by validating required identifiers up front (returning ValidationException,
matching AWS) and by making the extendedData-building helper itself
null-safe against a missing resourceId, so no single overlooked call site
can reintroduce a 500.
Since login profiles became real state, DeleteUser returns DeleteConflict while one exists, so deleting a stack whose AWS::IAM::User was given a password out of band ended in DELETE_FAILED. The provisioner now deletes the login profile before the user, tolerating a user that has none. The resource-type table notes that the template LoginProfile and PermissionsBoundary properties are ignored.
Implements InitiateAuth/AdminInitiateAuth AuthFlow=USER_AUTH (#3926):
USERNAME plus optional PREFERRED_CHALLENGE, offering PASSWORD,
PASSWORD_SRP, EMAIL_OTP and SMS_OTP depending on what the user has
(password hash, SRP verifier, verified email, verified phone). With
no PREFERRED_CHALLENGE, the response carries AvailableChallenges and
ChallengeName=SELECT_CHALLENGE; with one, it goes straight to that
challenge. RespondToAuthChallenge handles SELECT_CHALLENGE (ANSWER
names the chosen factor, and may already carry that factor's own
answer to complete in one round trip), PASSWORD, PASSWORD_SRP, and
EMAIL_OTP/SMS_OTP.
PASSWORD and PASSWORD_SRP reuse authenticateWithPassword and
handleUserSrpAuth unchanged rather than reimplementing verification:
a USER_AUTH client responding with PASSWORD/SRP_A needs exactly the
same checks those flows already perform, so PASSWORD_SRP hands off to
the existing PASSWORD_VERIFIER challenge with zero new SRP logic.
EMAIL_OTP/SMS_OTP reuse the existing VerificationCodeService/
CognitoMessageDispatcher pair already used for SignUp/ForgotPassword
codes, adding EMAIL_OTP/SMS_OTP as new VerificationCode.Purpose
values distinct from SMS_MFA so a sign-in code can't be replayed
against another purpose's consume() call.
Also gates USER_AUTH on the pool's tier: AWS requires Essentials or
higher, and UserPool.userPoolTier already models this (defaulting to
ESSENTIALS), so a LITE-tier pool is rejected. SMS_OTP uses
SmsAuthenticationMessage, the template AWS documents for "SMS OTP and
MFA authentication" (CreateUserPool docs), not the signup/
verification template.
Security and correctness fixes found in review:
- handleUserAuth now validates SECRET_HASH before looking up the user
or issuing a challenge, closing a hole where a caller with no
secret could trigger a real OTP send and read the masked
destination without proving it holds the client secret.
- issueSignInOtp now maps VerificationCodeException through
mapVerificationCodeException (so a rate-limited retry surfaces as
LimitExceededException, not a generic CodeDeliveryFailureException
that hid the real cause), and invalidates the just-issued code
before reporting a real dispatch failure, so the rate limiter
doesn't lock out a retry for a code the user never received,
matching signUp's existing rollback pattern.
Deliberately not implemented, tracked as follow-ups:
- WEB_AUTHN (passkeys): a much bigger piece per the issue's own
scoping note, no credential storage/ceremony exists in floci yet.
- The Session from ConfirmSignUp accepted as a first-factor shortcut:
needs ConfirmSignUp to start minting a redeemable session, a
separate mechanism from the challenge flow this PR adds.
- Pool-level sign-in policy (AllowedFirstAuthFactors): floci does not
model per-pool factor restrictions at all today; availability here
is purely per-user (does the user have this factor configured).
- Session is not looked up on RespondToAuthChallenge: each handler
independently reverifies its own factor from the request body, the
same shape the existing NEW_PASSWORD_REQUIRED handler already uses,
so there is no bypass, just an opaque correlation token rather than
server-held state.
Verified against botocore's cognito-idp service-2.json (AuthFlowType,
ChallengeNameType, AvailableChallengeListType, the AuthParameters
documentation for USER_AUTH) and the real InitiateAuth/CreateUserPool
API reference pages, including InitiateAuth's worked examples and
CreateUserPool's SmsAuthenticationMessage description.
* fix(eks): populate clusterSecurityGroupId on cluster responses
Real AWS EKS automatically provisions a cluster security group and
returns its identifier in resourcesVpcConfig.clusterSecurityGroupId
on CreateCluster and DescribeCluster responses.
- Create a security group in Ec2Service with the pattern
eks-cluster-sg-<cluster-name>-<suffix> using 8 hex characters.
- Set standard AWS description and tags (Name, kubernetes.io/cluster/<cluster-name>,
and aws:eks:cluster-name).
- Set clusterSecurityGroupId to empty string when cluster has no VPC.
- Delete the cluster security group on DeleteCluster, tolerating
InvalidGroup.NotFound for idempotency.
- Backfill cluster security groups for pre-existing clusters on startup.
* fix(eks): address cluster security group review feedback
* fix(eks): add self-referencing egress rule and cleanup on SG setup failure
* feat(redshift): support S3 COPY FORMAT AS JSON 'auto' and MANIFEST
* fix(redshift): resolve column discovery via pg_catalog and guard against empty columns
* feat(redshift): track zero-ETL backfill progress and syncing status
* feat(redshift): backfill existing DynamoDB items into zero-ETL landing table
* test(redshift): prove zero-ETL backfill and syncing-to-active status
* fix(redshift): reject JSON 'auto' COPY without columns over Extended Query clearly
Catalog-based column discovery only runs over the Simple Query protocol, so
a column-less COPY ... FORMAT AS JSON 'auto' sent over Extended Query failed
with an obscure error. Name the cause and remedy in the error, document the
limitation, and run the discovery tests over Simple Query.
* docs(redshift): document zero-ETL DynamoDB backfill and syncing status
* fix(redshift): address review feedback on COPY JSON, manifest and zero-ETL backfill
* fix(redshift): pass user column list as written and clarify syncing status in docs
* fix(redshift): wrap long condition in identifier unquoting
* fix(redshift): keep user columns as written in runCopyFrom and verify backfill account scope
* test(redshift): use assertNotNull for last evaluated key assertion
DeleteVpc already removes the default security group, its rules, the main
route table and the default network ACL, but their tags stayed in
DescribeTags. Delete them with the resources.
* fix(kms): reject Sign and Verify on keys that are not SIGN_VERIFY
* fix(kms): validate SigningAlgorithm and key spec
* refactor(kms): keep only comments the code cannot show
* fix(kms): check the DIGEST length for every signing algorithm
* fix(kms): refuse disabled and pending deletion keys
* fix(kms): answer a failed Verify with KMSInvalidSignatureException
* fix(kms): fix MAC key usage and invalid MAC errors
* fix(kms): validate MacAlgorithm
* fix(kms): use the key spec error for an unsupported MAC algorithm
* fix(kms): only treat a malformed signature as invalid in Verify
* fix(kms): answer a key pending import with its ARN and state
* fix(kms): name the key ARN when it is pending deletion
* fix(kms): refuse a key pending deletion in key management operations
* fix(kms): check the key state in GetPublicKey
* test(kms): drop the real AWS notes from test comments
* fix(kms): send no message when GetPublicKey gets a symmetric key
* fix(kms): check the key state before changing key rotation
* fix(kms): send no message when the key spec does not rotate
* fix(kms): accept DisableKeyRotation on a key spec that does not rotate
* fix(kms): name the key ARN and origin when the origin is not valid
* fix(kms): ask for new key material when rotating an EXTERNAL key on demand
* fix(kms): validate RotationPeriodInDays
* fix(kms): use the AWS wording for IncorrectKeyException
* fix(kms): send no message with InvalidCiphertextException
* fix(kms): list EncryptionAlgorithm values in the AWS order
* fix(kms): validate the data key KeySpec and NumberOfBytes
* fix(kms): require either KeySpec or NumberOfBytes for a data key
* fix(kms): make an AES_128 data key 16 bytes long
* fix(kms): use the AWS error for a data key under an asymmetric key
* fix(kms): name GenerateDataKeyWithoutPlaintext in its key usage error
* fix(kms): report the GenerateRandom bound that NumberOfBytes breaks
* fix(kms): say NumberOfBytes is required in GenerateRandom
* fix(kms): list the MessageType values in its validation error
* fix(kms): answer NotFoundException with status 400
* fix(kms): use the AWS wording when a key does not exist
* fix(kms): use the AWS wording when an alias does not exist
* fix(kms): reject a key or alias ARN from another region
* fix(kms): validate a missing, empty or non-ASCII KeyId
* fix(kms): validate blob members before looking up the key
* fix(kms): reject an alias in operations that need a key
* test(compat): stop scheduling a KMS key for deletion twice
Move AWS::IAM::Policy out of the CloudFormationResourceProvisioner monolith into a new IamPolicyCfnProvisioner over IamService. AWS::IAM::Policy is an inline policy embedded in the named roles, users and groups, so Ref is the policy name with no ARN, the name is stable across updates unless the template changes it, and a failed update rolls back the partially applied puts and records anything it could not undo for the next provision to drain. A physical id that is a managed policy ARN is the pre-inline upgrade path, migrated and deleted here as before.
The shared PolicyDocument resolver is hoisted onto ProvisionContext so the managed-policy provisioner can reuse it when it moves. Leaving LEGACY_SWITCH subjects the type to CfnSchemaCoverageTest: its only readOnly attribute, Id, is recorded as a gap row because Floci uses the policy name for Ref where AWS returns an opaque identifier it does not model. ManagedPolicy stays in the monolith for the following PR, so its delete and the legacy-managed helpers are duplicated between the two until then.
ECS expresses CPU as units where 1024 units is one vCPU, and a task
definition can ask for a container's own filesystem to be read only.
Neither reached the Docker host config.
ContainerSpec gains nanoCpus, cpuShares and readonlyRootfs, the builder
gains withCpuUnits, withCpuShares and withReadonlyRootfs, and
ContainerLifecycleManager maps them onto withNanoCPUs, withCpuShares and
withReadonlyRootfs. Existing convenience constructors keep their old
shapes and default the three new components, so no current caller
changes behaviour.
Docker refuses a NanoCpus above the host's CPU count, while ECS accepts a
task cpu of up to 196608 units, so a 16 vCPU task asked for verbatim
would fail to start on a smaller machine. The quota is held to the
daemon's reported NCPU, read once and left alone when the daemon does not
report one.
ContainerLifecycleManagerCpuLimitTest builds a spec through the builder,
captures the HostConfig on create and pins the unit conversion, the
zero/negative guards, the cpuShares passthrough, readonlyRootfs and both
sides of the clamp.
* refactor(elasticache): move library usages to imports
* refactor(elasticache): move library usages to imports and eliminate var declarations
* refactor(elasticache): extract entity variable in query handler test
Follow-up to #3913 addressing pgermosen's review of the IAM leaf provisioners.
AWS::IAM::AccessKey: UserName and Serial are both createOnly, so an update that changes neither reuses the existing key (a user is capped at two keys, so recreating on every update failed with LimitExceeded and orphaned the earlier keys), and a change to either rotates the key by replacement, creating a new one and deleting the displaced one after the update commits through ReplacementCleanup, matching how AWS rotates a key by incrementing Serial. A missing UserName is rejected. Delete recovers the owning user from the key id (findUserNameByAccessKeyId), so both the stack-delete and the replacement-cleanup paths delete by physical id alone.
AWS::IAM::InstanceProfile: Roles is a no-interruption update, so the declared roles are reconciled in place (undeclared roles removed, then declared roles added) instead of only ever added, which had made a role swap fail with LimitExceeded. A missing Roles is rejected (AWS requires it), and a Path change on an existing profile is rejected as an unsupported replacement rather than silently ignored, since Path is createOnly and a same-named profile cannot be replaced in place. Roles are detached before delete because IAM refuses to delete a profile that still holds one.
Known edge: ReplacementCleanup.rollback restores only non-internal attributes, so after a rolled-back key rotation the stored Serial can lag by one; the next update re-evaluates. Full InstanceProfile name-plus-path replacement and AccessKey Status handling remain follow-ups.
* fix(cloudformation): provision Cognito user pool groups
Create and reconcile user pool groups, and namespace custom schema attributes while preserving standard attributes.
* fix(cloudformation): keep a generated Cognito group name across updates
GroupName is optional, and provision generated a fresh stand-in on every call. Because
provision is also the update path, the second UpdateStack derived a different name, took
the create branch and left the group the stack already owned orphaned behind it.
Use ProvisionContext.stablePhysicalName so the prior physical id is reused when the
template does not name the group, and reusesPriorEntity for the create-or-update choice,
which is the pairing that keeps a stable name from turning an update into a duplicate
create.
DeleteUser now returns DeleteConflict while the user still has inline policies or access keys, matching AWS. UpdateUser rename moves the user's access keys and group membership to the new name, so a renamed user keeps them and a user recreated under the old name does not inherit them.
Resolve the integration target before connecting and reject link-local and cloud instance-metadata addresses on both the HttpClient path and the Host-override socket path. Loopback and private ranges stay reachable so local backends keep working.
DeleteVpc now refuses while the VPC still has a subnet, a security group,
route table or network ACL other than the defaults, or an attached
internet gateway, as AWS does. Creating a subnet, group, route table or
network ACL, or attaching an internet gateway, re-checks the VPC under the
region topology lock, so a concurrent DeleteVpc can no longer leave one
pointing at a VPC that is gone. AttachInternetGateway now rejects a VPC
that does not exist.
The default arm of InitiateAuth and AdminInitiateAuth looked the user up by name and issued signed tokens for any AuthFlow value it did not recognize, with no credential check. Reject those values with InvalidParameterException. ADMIN_NO_SRP_AUTH is a valid AdminInitiateAuth flow that previously only worked through that arm, so it now goes through password authentication.
CreateDomain and CreateRepository accepted an unlimited number of domains and
repositories, but AWS caps an account at 10 domains per Region and a domain at
1,000 repositories, returning ServiceQuotaExceededException once reached.