* fix(s3): keep versioned buckets until history is purged
Reject DeleteBucket while any account-scoped object metadata remains under the bucket prefix. Cover hidden versions and markers through service, HTTP, and persistent storage tests, and purge them in CLI and Java compatibility cleanup.
* test(s3): purge versioned enforcement fixtures
Delete every listed object version and marker before removing fixture buckets, repeating the first page so deletions do not invalidate continuation markers. Cover null versions, mixed history, and a page boundary inside one key with a direct bucket absence assertion; register the formerly exempt versioned fixture for cleanup.
* test(s3): assert fixture purge removes a null version
Seed an untouched object before enabling versioning and assert that ListObjectVersions reports its literal null version ID. This makes the direct purge guardrail exercise the null-version branch as intended.
* test(s3): encode versioned fixture keys during purge
* test(s3): share SDK bucket cleanup helper
* test(ec2): keep subnet range test secondary block in 10.0.0.0/8
* test(ec2): add same-range secondary blocks in subnet containment tests
* fix(ec2): enforce VPC IPv4 CIDR block association restrictions
* refactor(ec2): add Cidr4.rfc1918Range for the containing private range
* fix(ec2): classify VPC CIDR ranges by containment, not overlap
* test(ec2): drop the /0 primary case now that CreateVpc refuses it
* fix(route53resolver): require at least two IP addresses for CreateResolverEndpoint
A resolver endpoint's IpAddresses member is modeled min 2 / max 20, but the
emulator only rejected an empty list. A request carrying a single address (or
more than twenty) returned HTTP 200 and created the endpoint, which real AWS
refuses. Validate the count on CreateResolverEndpoint and raise the service's
existing InvalidParameterException, creating no endpoint on rejection.
Fixes#4774
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* refactor(route53resolver): fold the two endpoint body builders into one
The request member is modeled min 2 / max 20, so phrase the code and test
comments from the shape rather than the older min 1 note. Replace
createEndpointBody and endpointBody with a single builder taking the
member name, the creator request id and the address count.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Rekognition never looked at the image, so a WebP, a cut-off file, an
oversized Bytes payload or an S3Object that was never uploaded all got
the stub's success response. RekognitionImageValidator now checks every
image as Rekognition does, before the stub or mock response: base64
(SerializationException), Bytes length (ValidationException, every
violation in one error), the S3 object's existence and region
(InvalidS3ObjectException), JPEG/PNG structure
(InvalidImageFormatException) and the 10,000 pixel side limit
(ImageTooLargeException or InvalidImageFormatException, per operation).
Each rule was measured against Rekognition in us-east-2.
The cross-device redirect_uri was matched against the commercial
<region>.signin.aws.amazon.com only, so a login that resolved another
partition's Sign-In host was refused with invalid_request.
regen_partitions.py now reads botocore's signin endpoint ruleset and
vendors one signinHost per partition into aws/partitions.json. The
redirect is accepted on the Sign-In host of a region in the deployment's
partition, and another partition's host is refused. The device
authorization client ids keep their literals: the Sign-In model spells
them the same way in every partition.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(opensearch): serve the legacy Elasticsearch Service 2015-01-01 API
`aws es` and Terraform's aws_elasticsearch_domain call the 2015-01-01
API, which Floci did not route, so every call got
UnknownOperationException.
ElasticsearchController serves the domain lifecycle, ListDomainNames and
the tag operations on that path by delegating to OpenSearchController,
renaming only the members the legacy model spells differently:
ElasticsearchVersion (bare "7.10", stored as "Elasticsearch_7.10") and
ElasticsearchClusterConfig. A legacy create without a version gets
Elasticsearch 7.10 rather than the OpenSearch default.
* fix(opensearch): reject blank legacy ElasticsearchVersion, report legacy instance types
ElasticsearchVersionString's pattern matches no blank or non-string value, so
CreateElasticsearchDomain now returns ValidationException instead of storing
an empty engine version. ESPartitionInstanceType lists only *.elasticsearch
types, so the legacy responses rewrite the store's *.search spelling (including
the m5.large.search default). The legacy test methods get distinct @Order
values.
* fix(opensearch): store legacy .elasticsearch instance types as .search, accept OS_X.Y
The legacy API now respells ElasticsearchClusterConfig.InstanceType from
*.elasticsearch to *.search on create and update, so the 2021 API reports
t3.small.search and the legacy API maps it back. ElasticsearchVersion's
OS_X.Y form is stored as OpenSearch_X.Y instead of Elasticsearch_OS_X.Y.
Replaces the jakarta.ws.rs wildcard import with explicit imports.
* fix(ec2): remove the volume helper container on shutdown
The privileged helper that manages loop devices for EBS volumes was
started on the first volume operation and never stopped or removed, so
it kept running after Floci exited and stayed in the container list.
Ec2VolumeBlockDeviceManager now implements ContainerTeardown. On
shutdown and on a state reset it looks the helper up by name, detaches
the loop devices behind the backing files and removes the container. It
never creates a helper only to remove it, and it also collects one left
behind by an earlier process. Backing files stay in storage and the next
volume operation recreates the helper.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(ec2): leave no volume helper after a reset and report failed loop detaches
A state reset removed the helper in the container teardown and then
started it again to delete the backing files, so the reset ended with a
running helper. clear() now removes the helper once the files are gone.
The script that releases loop devices before the helper is removed
discarded every losetup failure, so the warning that follows could only
fire when the exec itself failed. It now records each loop device that
would not detach and exits non-zero, while still trying every device and
still removing the helper.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Without a usable credential scope, a Query request's service came from the action
name alone, first match wins. Wherever two services define the same name, the later
one was unreachable on that path: an unsigned ElastiCache CreateUser created an IAM
user, SQS AddPermission was answered by SNS, and RDS, ElastiCache and CloudWatch
ListTagsForResource all reached SNS. The parity test pinned 18 such names as claimed
by another service.
Every Query client sends its service's API version as the Version form field, and
those are distinct per service in botocore's models, so Version now chooses among the
services that serve the name, the way isElbClassicRequest already splits the two ELB
APIs. SES and Elastic Beanstalk publish the same version and share no action name, so
the action settles which one a request is for. A Version naming a service that does
not serve the name, or no Version at all, leaves the existing order to decide, so a
request that omits the field routes exactly as before.
IamEnforcementFilter resolves through the same AwsQueryServiceResolver and reads
Version from the form body the way it reads the action, first occurrence, as the
controller's getFirst does. A request is therefore authorized under the namespace of
the service that runs it, which the new enforcement tests hold in both directions.
The if-chain becomes one ordered table of services, each with the API versions its
clients declare and the names it serves, which both paths read, so the order and the
versions cannot drift apart. SQS gets a set for the first time and is tried last, so
by name alone it still takes only what nothing else defines, and its Version wins back
the two names SNS shares.
The parity test now routes each handler's actions with that service's own Version,
and states the versions itself rather than reading them back from the controller. It
also routes them without a Version, where a name two services share may go to either,
but has to reach one whose handler dispatches it. 16 of the 18 claimed entries leave
the gap file. The other 2 are SQS AddPermission and RemovePermission, which without a
Version still reach SNS, whose handler does not implement them. The file is down to
173: those 2 and 171 names missing from their own service's set.
Refs #5032
ChangePassword was the last IAM operation held back for a reason that turned
out not to hold. It was tracked as blocked on disambiguating a shared Query
action name by Version, because Cognito publishes the name too. In fact IAM
sits second in inferServiceFromAction's chain and Cognito ninth, and Cognito's
form path answers UnsupportedOperation to every request, so adding the name to
IAM_ACTIONS routes it to IAM and costs Cognito nothing. A request carrying a
credential scope never reaches that chain at all.
The operation takes no UserName. The API reference says it changes the password
of the IAM user who is calling, and the CLI reference adds that it "can be
called by IAM users only. If this command is called using AWS account (root)
credentials, the command returns an InvalidUserType error", so a signing key
with no stored user behind it, which is Floci's stand-in for that caller,
answers InvalidUserType rather than reporting the key as missing. The resource
the request is evaluated against needed nothing new: ResourceArnBuilder already
resolves the signing user for an action whose UserName is absent, and the
vendored action map already authorizes ChangePassword against a user.
OldPassword is checked against the stored login profile before the new password
is held to the account password policy, so a caller who cannot prove the
current password learns nothing about what that policy requires. A mismatch is
the one refusal the reference leaves unnamed: every error it publishes for this
operation describes something else, so this answers InvalidParameterValue, the
common error type AWS publishes for a parameter value a service cannot accept.
A successful change clears PasswordResetRequired, which is what lets a user
whose password an administrator reset restore their own console access
programmatically, and it moves the password_last_changed the credential report
reads.
The passwordType shape check is now shared and names the member that failed,
because this operation has two password members and a caller told that
'password' failed would have to guess which. An absent member and an empty one
stay different answers.
Two things the login profile needed before a self-service change could be
trusted. The comparison and the write are one step under a new
loginProfileLock, which every login-profile writer takes: read apart from the
write, two requests presenting the same valid old password both pass the
comparison and both are told they set the password, while only the later write
survives, and a guard one writer skipped would leave a racing UpdateLoginProfile
free to overwrite a password a ChangePassword had just promised. And
PasswordReusePrevention is now enforced, on UpdateLoginProfile as well, the two
sharing one bounded history per profile: the reference defines the value as "the
number of previous passwords that IAM users are prevented from reusing" and
makes no window mean no prevention. The password the profile holds is refused
alongside the superseded ones, which the reference leaves open; read the other
way the smallest window the policy accepts would allow setting a password to the
value it already has, and would not refuse the change away and straight back
that the setting is for.
Twelve unit tests, one concurrency test and six integration tests, with each
guard probed by reverting it alone: dropping the old-password comparison, the
reset-flag clear, the policy check or the check order is caught by the test
written for it, and dropping the routing entry leaves the unsigned request
answered by Cognito, which is what the routing parity test says too. Dropping
the lock leaves five of twenty-four racing requests all told they succeeded with
one password stored, neutering the reuse check leaves both refusals silent, and
widening the window by one lets it reach a password that has left it. 1668
tests across all 98 IAM and query-routing classes pass at this commit.
docs/services/iam.md documents the operation, the judgements, and the one thing
Floci still does not model. AllowUsersToChangePassword is accepted and reported
but grants nothing:
the user guide says the option gives all users in the account access to
iam:ChangePassword for only their user and to iam:GetAccountPasswordPolicy,
applied at the account level rather than by attaching a policy, while Floci
authorizes both from identity policies alone, so under enforcement a caller
needs a policy naming their own user however the flag is set. The matrix row
moves 166 to 167.
Was hardcoded to 0L unconditionally. Generic-format bytes are summed live from
the still-existing PublishPackageVersion records (packageVersions), the same
lazily-computed-not-cached pattern repositoryCount already uses. Scoped per
still-live repository rather than one scan over the whole domain, matching
every other read path's own per-repository prefix.
Maven, npm, and pypi have no such record to sum: their publishes go straight to
their own sidecar (Reposilite/Verdaccio/pypiserver) and never create one. Each
proxy now reports its own successfully-written byte count directly through a new
recordContainerBackedAssetBytes, keyed exactly like packageOriginConfigs
(region/domain/repository/format/namespace/package, no version), only once it has
already decided, in its own terms, that a real write just happened:
- Maven: ReposiliteSidecarClient.deployArtifact now returns a DeployOutcome
(status plus whether it actually wrote new content), so the idempotent-match
short-circuit and a genuine redeployment:false conflict both correctly add
nothing. CodeArtifactMavenController parses the GAV path into namespace/package
name, including a group/artifact-level maven-metadata.xml upload, which it
attributes correctly once the metadata filename itself (not the segment count)
tells it apart from a real versioned asset.
- npm: NpmPublishEnvelopeScanner's attachment digest loop now also counts the
real decoded byte count alongside its SHA-512, so a multi-attachment publish is
sized by its actual tarball bytes, not the base64-and-JSON envelope. Recorded
only after Verdaccio's own response confirms a 200/201, off the event loop
(vertx.executeBlocking, on principle, even though the call itself is cheap); the
confirmed-republish short-circuit and a native Verdaccio rejection both add
nothing. A native npm unpublish (Verdaccio's unpublish:$all, bypassing this
service entirely) is detected separately and cleaned up the same way DeletePackage
would have.
- pypi: recorded after a real forwarded upload succeeds, under pypiserver's own
PEP 503 normalized name so an upload and a later delete spelled differently
still address the same count; the byte-identical idempotent short-circuit and the
different-content 409 both add nothing.
DeleteRepository and DeletePackage both clean up every format's own records
(packageVersions and its asset content included) by the same name-based
prefix/key, so a repository or package recreated under the same name never
inherits a predecessor's bytes. A per-package deletion fence, bumped only by an
actual delete (DeletePackage, or a native npm unpublish), replaces a sidecar
existence re-check for the race between an in-flight publish's own accounting and
a concurrent delete: comparing a snapshot taken before the real write against the
fence's current value catches "deleted" and "deleted and republished under the
same name" alike, with no network round trip needed to do it, so nothing here
holds the service-wide lock across a sidecar call. containerBackedAssetBytes
itself is kept in memory only, like the fence, not through StorageFactory: the
sidecar content it counts does not survive a Floci restart either, so neither
does the count.
Verified against real Reposilite, Verdaccio, and pypiserver containers (not just
mocks): each Docker-gated integration suite asserts assetSizeBytes increases by
exactly the real published/uploaded byte count, stays unchanged across an
idempotent retry, and drops back down after a real delete, native unpublish
included.
Known limitations documented: a maven-metadata.xml for a versioned snapshot is
attributed to its version string rather than its real artifact name (still counted
correctly in the domain total, just under a misnamed bucket nothing else looks up
by name); unpublishing a single version of a multi-version npm package is not
detected (this accounting is per-package, not per-version, so there is no
narrower count to subtract from regardless).
Addresses hectorvent's review on the PR: rebased to pick up #5102's
Digests.sha256Hex (the tests were merging clean but failing to compile against
current main), stopped containerBackedAssetBytes from surviving a restart the
content it counts does not, and closed the native-npm-unpublish gap in the
fence's own soundness argument.
SendEmail, SendRawEmail and SendTemplatedEmail (v1) and SendEmail (v2)
accepted any Source or FromEmailAddress, so a send from an address that
was never verified succeeded and landed in /_aws/ses. The SendEmail API
Reference says "The message must be sent from a verified email address
or domain", and AWS rejects anything else with MessageRejected.
The send path now checks every address the developer guide names for
this error ("This error could apply to the "From", "Source", "Sender",
or "Return-Path" address"): the Source or FromEmailAddress, the
ReturnPath or FeedbackForwardingEmailAddress and, on a raw message,
every mailbox of its From header, its Sender and its Return-Path
header. A v2 raw send reads the From header only in place of a missing
FromEmailAddress and accepts any From header when one is given
(probe-confirmed), so the header is checked only then. An address
counts as verified when the address itself, its domain or a parent
domain is a verified identity ("if you create and verify an identity
for example.com, you don't need to create separate identities for
a.example.com, a.b.example.com, user@example.com, user@a.example.com").
The error matches AWS: one MessageRejected, "Email address is not
verified. The following identities failed the check in region
US-EAST-1: <address>, <address>", and nothing is captured or relayed.
The check runs after the request's own validation, so the existing
error order is unchanged.
A delegate sender names the owner's identity with SourceArn, FromArn
and ReturnPathArn, their X-SES-SOURCE-ARN, X-SES-FROM-ARN and
X-SES-RETURN-PATH-ARN headers, or v2 FromEmailAddressIdentityArn and
FeedbackForwardingEmailAddressIdentityArn. These are now read (a
parameter wins over its header, and only the first instance of a header
counts), and an address covered by another account's identity ARN is
not checked against the caller's identities. Floci does not evaluate
sending-authorization policies, so it lets such a send through, as it
did before. On a raw send the source ARN also covers the From and
return-path addresses that have no ARN of their own, as SendRawEmail
describes.
Cognito's verification codes and invitations go through SES too, from
Cognito's own no-reply@verificationemail.com or a pool's
EmailConfiguration sender that Cognito has already found verified. They
now use a separate entry point, sendServiceEmail, that skips the check.
Tests and compatibility tests that sent from an unverified address now
verify it first; where a test sent from an address under a domain
identity, the domain is verified by publishing its DKIM records, since
Floci keeps a domain Pending until they exist. SesDomainIdentityTestHelper
does that, and the two copies of the same setup in the configuration-set
tests and the one in SesV2IntegrationTest now use it.
Closes#5141
The AWS CLI builds the cross-device redirect from the Sign-In endpoint
it resolved, so with --endpoint-url it sends Floci's own address plus
/v1/sessions/confirmation. Floci accepted only an https AWS sign-in host
there and served no confirmation page, so the authorize request was
refused and the remote login could not finish.
A cross-device redirect is now also accepted on the scheme, host and
port the authorize request arrived on, and GET /v1/sessions/confirmation
shows the verification code in the form the CLI decodes. Any other
origin is still refused.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
With floci.partitions.allow-unknown-regions on, a request signed for a
region no partition publishes is served in the deployment's partition,
and its ARNs are minted there. DescribeRegions picked its partition
with forRegionOrCommercial instead, so on a China deployment such a
request listed the commercial regions, and disagreed with the Step
Functions aws-sdk:ec2:describeRegions integration.
The handler now asks RegionResolver for the partition the request is
scoped to. A published region still lists its own partition.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The certificate check on ModifyListener runs twice: once outside IAM's
certificate lock, where it keeps the error precedence AWS has, and once under
the lock, where it is atomic with the write. The second one sat behind the port,
protocol and SSL policy setters, so a DeleteServerCertificate landing between
the two answered CertificateNotFound on a listener that had already moved to its
new port. The comment above the first check says no refusal leaves the listener
changed, which only held for the check it sits on.
Every setter now runs inside the guard, behind the re-check, so a refusal either
lands before anything is written or does not land at all. The guard is still
taken for the certificates the request records, which are the only ones a delete
can race: one the listener already holds is a reference DeleteServerCertificate
finds, and it refuses to delete it. The re-check covers the effective list,
which is what a protocol flip putting the stored certificates into service
needs, so that path is checked under the lock too rather than once on the way
in.
The restartDataPlane local is gone, because a lambda cannot assign a local and
portChanges already says the same thing at the one place it was read.
Two unit tests, both of which fail without the change: a refused modify leaves
the port, protocol, policy and certificates alone and does not restart the data
plane, and a protocol flip refused the same way leaves the protocol alone. The
resolver they wire finds the certificate once and not again, which is what a
delete landing between the two checks looks like from inside the call.
docs/services/elb.md records the guarantee next to the lock it comes from.
Follow-up to the review note on #5474.
* fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists
* fix(elasticache): tolerate UserNotFound on CFN user delete and fix SDK test assertions
The CloudFormation user delete still tolerated the old UserNotFoundFault
code, so deleting a stack whose user was already gone would report
DELETE_FAILED. The SDK compatibility test also asserted
UserAlreadyExistsException on the duplicate replication group test
instead of the duplicate user test.
* feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory
The AgentCore control plane is emulated but had no CloudFormation provisioner,
so the three types fell through to the generic stub that exposes only Arn and
a template using Fn::GetAtt [Memory, MemoryArn] in an IAM policy failed the
stack. BedrockAgentCoreCfnProvisioner maps every template property the
services can store onto CreateAgentRuntime / CreateAgentRuntimeEndpoint /
CreateMemory, publishes Ref as the registry schema's primaryIdentifier and
Fn::GetAtt for every read-only property, updates in place when the
create-only properties are unchanged and replaces otherwise, and deletes on
stack teardown. Properties the emulated services have no model for are logged
once at warn and listed in the docs.
* fix(cloudformation): make AgentCore updates rollback-aware and authoritative
Reachable through CfnProvisionerFixture (two-service inference arm). In-place
updates snapshot the prior runtime, endpoint and memory configuration and tags,
restore them on rollback, and delete a created entity when a later step of the
same provision fails. The template is authoritative: UpdateAgentRuntime replaces
the full configuration as AWS's PUT does (omitted authorizer, protocol and
environment are cleared on the SDK path too), and the partial-update Memory and
Endpoint calls get a replace-omitted overload for the provisioner. Nested
AWS::NoValue members are omitted rather than stored blank, and the control
service validates networkMode and serverProtocol with the API's
ValidationException wording.
* fix(cloudformation): accept AGUI runtimes and share the guarded provision helper
The protocol check left out AGUI, which the AgentCore API and the Runtime
schema allow, so an AG-UI runtime was refused through the API and in a stack.
Ec2NetworkCfnProvisioner and BedrockAgentCoreCfnProvisioner carried the same
guarded helper; it now lives on CfnRollback, taking the provisioner's
in-place undo as a callback, and both use it.
* fix(elbv2): honor SubnetMappings in CreateLoadBalancer and SetSubnets
CreateLoadBalancer and SetSubnets only read Subnets.member.N, so a
network load balancer created with SubnetMappings (the form the AWS Load
Balancer Controller always sends) had no availability zones and an empty
VpcId. The mappings' SubnetId values are now used as the subnet list, and
passing both Subnets and SubnetMappings is rejected with the AWS
ValidationError message.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(elbv2): require every subnet mapping to carry a SubnetId
A mapping member with only AllocationId was silently dropped, so Subnets
plus an allocation-only mapping slipped past the mutual-exclusion check
and a later mapping member with a SubnetId was ignored. Detect mapping
presence from the request keys and reject a member without SubnetId with
the AWS ValidationError text.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(mq): route DescribeSharedResources
GET /v1/brokers/{broker-id}/shared-resources was unrouted and fell through
to S3 (NoSuchBucket). Return an empty sharedResources list for an existing
broker, NotFoundException for an unknown one.
* docs(mq): say why DescribeSharedResources is always empty
Floci does have resource shares (RAM); what keeps the list empty is
that a share reaches a broker only through UpdateBroker's
resourceShareArns, and Floci has no UpdateBroker.
* feat(redshift-data): add async execution and statement status events
* fix(redshift-data): address review findings on async Data API
- Mark a statement FAILED when its worker dies unexpectedly instead of leaving it active
- Let unexpected publisher errors propagate; the delivery pool logs them at error level
- Run CREATE/DROP INDEX CONCURRENTLY, REINDEX CONCURRENTLY, ALTER SYSTEM and tablespace DDL outside a transaction
- Drop WaitTimeSeconds from Scheduler targets so the shared dispatcher thread never blocks
- Share result rows and column metadata between snapshots; ListStatements no longer copies results
- Replace the global monitor with a ReentrantReadWriteLock for status writes and reset
* fix(redshift-data): reject CancelStatement on terminal statements
- Throw ValidationException ("Could not cancel a query that is already in <STATE> state.") instead of returning Status false, as AWS does
- Use WaitTimeSeconds instead of 30 s polling in the Serverless compatibility test and the Spectrum integration test
* fix(redshift-data): match AWS CancelStatement message and tidy test signature
- Append "with ID: <id>" to the terminal-state ValidationException message
- Drop the unused throws InterruptedException from workgroupLifecycleUsesAwsSdk
AdminCreateUser without TemporaryPassword created a CONFIRMED user with no
password and sent nothing. It now follows the AdminCreateUser reference:
- Without TemporaryPassword a password meeting the pool's policy is
generated and the user starts in FORCE_CHANGE_PASSWORD. A pool offering
EMAIL_OTP or SMS_OTP (above Lite) creates a CONFIRMED user without one,
which needs an email or phone_number for an offered factor and every
attribute the schema marks as required.
- Without MessageAction the invitation goes to each of
DesiredDeliveryMediums (default SMS) the user can be reached on, through
the dispatcher's SES/SNS path and the pool's EmailConfiguration sender.
The text comes from the CustomMessage_AdminCreateUser trigger, the pool's
InviteMessageTemplate, or AWS's default. A message without {####} is not
delivered to a user with a password.
- SUPPRESS sends nothing. RESEND sets a new temporary password, the
requested one or a generated one, and sends the invitation again.
- The invitation is sent before anything is stored, so a failed delivery
(CodeDeliveryFailureException) creates no user, keeps a resent user's
previous password and leaves a ForceAliasCreation alias in place.
- MessageAction and DesiredDeliveryMediums outside their enums are refused
with InvalidParameterException.
- AWS::Cognito::UserPoolUser passes DesiredDeliveryMediums, ValidationData
and ClientMetadata through.
Closes#5144
DescribeAvailabilityZones now answers unknown ZoneNames with the same
message AllocateHosts uses, 'Invalid availability zone: [<name>]',
matching real AWS responses quoted in eksctl-io/eksctl#8174, instead of
'The zone name ... is not valid for this region.'
The integration test now asserts the exact message. ZoneId behavior is
unchanged.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(cloudformation): expand a SAM function's EventInvokeConfig
SAM's EventInvokeConfig was dropped, so a function declaring retries, a maximum
event age or invoke destinations deployed with Lambda's defaults and no
destination at all. It now expands as AWS's SAM translator expands it: an
AWS::Lambda::EventInvokeConfig on $LATEST or the AutoPublishAlias alias, the
inline role policy for each destination, the SQS queue or SNS topic SAM creates
for a destination given only its Type, and SAM's conditions and error messages.
The function's Condition, DeletionPolicy and UpdateReplacePolicy now reach every
resource generated for it, as SAM passes them through. A condition naming another
with anything but a string is rejected as CloudFormation rejects it, which also
fails the template SAM produces for a conditional function with a conditional
destination, as on AWS.
* fix(cloudformation): resolve SSM parameters for the SAM transform and omit NoValue destinations
CloudFormation resolves an AWS::SSM::Parameter::Value<String> parameter before it
runs the SAM transform, so a destination Type taken from one is the stored value.
The transform now gets the given parameter values over each Default, with
SSM-typed parameters read from Parameter Store, wherever it runs.
A Destination of AWS::NoValue passes through SAM unchanged and leaves its side
without an ARN, which CloudFormation's validation rejects. The event invoke config
provisioner resolved it to an empty string and stored that; it now omits
AWS::NoValue, so the destination fails as the schema requires.
* refactor: share SHA-1 as Digests.sha1
The SAM transform's generated condition names, EC2 key pair fingerprints and
the SAML assertion name qualifier each made their own one-shot SHA-1 digest.
They now share Digests.sha1 beside sha256. Also moves samTransformParameters
above resolveSsmParameters' Javadoc, which it had been inserted beneath.
* fix(bedrock-runtime): cancel abandoned calls and omit error-body logs
Closes#5522. Tie upstream transport lifetime to the Bedrock caller, clean up interrupted streaming bodies, and retain HTTP-error status diagnostics without backend response content.
* fix(bedrock-runtime): bound stalled upstream error-body reads
Enforce a one-second diagnostic-read deadline with the existing disconnect monitor. Close short stalled error bodies and retain the known ModelErrorException. Regressions cover empty bodies and one or 50 short lines, caller latency, upstream closure, and payload-free warnings.
* fix(bedrock-runtime): share cancellation monitoring and split error-read deadline
Use one monitor accepting a cancellation condition and action for both Converse paths. Move error-read deadline implementation, regressions, and documentation to a separate follow-up at the maintainer request.
* fix(lambda): expose the executing version on cold launches
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(lambda): propagate executing version to Kubernetes pods
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
POST /cognito-idp/oauth2/token, and /oauth2/token on a custom domain, now
renew a session with grant_type=refresh_token through the refresh that
GetTokensFromRefreshToken uses, answering as AWS does. As on AWS, the
grant requires neither ALLOW_REFRESH_TOKEN_AUTH nor any OAuth setting on
the client. The client is checked before the token: a Basic header names
it whatever the body says. A public client's Basic credentials are
refused, and its body client_secret is ignored. Errors are 400 without
WWW-Authenticate: invalid_client for a missing or unknown client, a
public client's Basic credentials with an empty secret, or another pool's
client on a custom domain; invalid_client with invalid_client_secret for
a missing or wrong secret, or a public client's Basic credentials with a
secret; invalid_request with invalid_refresh_token for an empty or absent
token; and invalid_grant for a token that is not valid, expired, revoked,
or another client's. The answer has access_token, expires_in, token_type,
and an id_token exactly when the original sign-in issued one, and no
refresh_token, as rotation is not implemented. A request without
grant_type is now invalid_request with no description, as on AWS.
A code grant's refresh token now carries its granted scopes, base64url
encoded in a field after the family id, so a refresh keeps them instead of
falling back to aws.cognito.signin.user.admin, and the pre token
generation trigger is told them. API sign-ins and tokens minted before
this change have no such field and refresh as before. A refresh keeps the
sign-in's auth_time and origin_jti. InitiateAuth REFRESH_TOKEN_AUTH and
GetTokensFromRefreshToken mint the same tokens as the token endpoint.
As on AWS, a refresh of a grant holding a scope the client no longer
allows is refused rather than narrowed: invalid_grant on the token
endpoint, and NotAuthorizedException "Client is not allowed to request
these scopes" on both APIs. The refresh token is parsed from both ends,
so a username holding a pipe refreshes too.
GetTokensFromRefreshToken and InitiateAuth REFRESH_TOKEN_AUTH now refuse a
refresh token issued to another client with NotAuthorizedException
"Refresh Token has different Client".
* fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics
DescribeAutoScalingGroups dropped several members of the AutoScalingGroup shape
that CreateAutoScalingGroup and UpdateAutoScalingGroup accept, so a client that
set them read them back as absent and saw a permanent diff.
- AsgOptionalFields gains ServiceLinkedRoleARN, InstanceMaintenancePolicy,
AvailabilityZoneDistribution and CapacityReservationSpecification with its
CapacityReservationTarget. The four-argument constructor stays, so existing
call sites are unchanged.
- MixedInstancesPolicy launch template overrides carry WeightedCapacity.
- EnableMetricsCollection and DisableMetricsCollection are implemented, and
DescribeAutoScalingGroups reports EnabledMetrics.
- Validation follows the botocore model. MinHealthyPercentage 0 to 100 and
MaxHealthyPercentage 100 to 200, both required, at most 100 apart, and -1
on both clears the policy. CapacityDistributionStrategy and
CapacityReservationPreference enums. No target with preference none.
CapacityReservationIds 1 to 255 characters matching [A-Za-z0-9-_/] and
resource group ARNs 1 to 1600. ServiceLinkedRoleARN 1 to 1600 characters.
WeightedCapacity 1 to 999 in at most 32 characters, set on every override
or none. Granularity required and 1Minute. Known metric names only.
- The AWS::AutoScaling::AutoScalingGroup provisioner passes the new properties
and MetricsCollection through, and its update rollback snapshot restores
them. It requires CapacityReservationPreference and each entry's
Granularity as the resource schema does, and rejects an unknown metric
before creating the group.
- The Java SDK compatibility suite gains a round-trip case that sets every
new member, reads it back through DescribeAutoScalingGroups, then clears
the maintenance policy and the enabled metrics.
* fix(autoscaling): route the metrics collection actions and close the review gaps
EnableMetricsCollection and DisableMetricsCollection now route to Auto
Scaling when a request carries no credential scope. Both hold the group
lock, so concurrent calls keep each other's changes and a call racing a
delete cannot write the group back.
A failed stack update now clears the service-linked role, AZ
distribution and capacity reservation when the group had none before.
A blank ServiceLinkedRoleARN or WeightedCapacity in a template reaches
the service's validation instead of reading as unset. The provisioner
reuses the service's granularity rule and message.
Both actions returned every match in one response with IsTruncated false.
They now use the existing paginate helper, so an omitted MaxItems returns
100 items, a MaxItems outside 1 to 1000 is a ValidationError, and Marker
appears only on a truncated page. PathPrefix and Scope filter first.
Roles and customer managed policies are listed in name order so a marker
keeps pointing at the same place between calls.
* fix(cloudformation): honour the DescribeStackResources filters
Closes#5451
DescribeStackResources read only StackName, so LogicalResourceId and
PhysicalResourceId were accepted and ignored and every call answered with the
whole stack. That is quiet rather than loud: a caller that filters and reads the
first member gets whichever resource the stack happens to list first, with
nothing in the response saying the filter was dropped. Serverless Framework
resolves an AppSync API id that way after a deploy, so it ended up asking
AppSync for an API whose id was a Lambda function name.
Both filters now apply. Naming a LogicalResourceId the stack does not have is a
ValidationError rather than an empty list, so the miss cannot be read as "the
stack has no resources". A PhysicalResourceId with no StackName resolves the
stack that owns the resource, which is the other form AWS accepts, and a call
with neither is the ValidationError AWS answers.
The response also stamps the resolved stack's own name on each member rather
than echoing what the caller passed, which was an ARN when the caller used one
and null for the PhysicalResourceId-only form.
* fix(cloudformation): correct the DescribeStackResources physical-id form
Review on #5455, all against the API reference.
A PhysicalResourceId names the stack rather than narrowing it: "the associated
resources of the stack that the resource belongs to are returned". It no longer
filters the result down to the one resource.
Specifying both StackName and PhysicalResourceId is a ValidationError, which the
reference states outright and this did not enforce.
stackContaining walked listStacks directly, which answers oldest first and keeps
deleted stacks for their retention window, so a resource whose stack had been
redeployed resolved to the stack that used to own it. Live stacks now come
first, newest first within each group.
An unmatched LogicalResourceId is an empty result rather than a ValidationError.
The reference calls it a filter on the result and documents no error for a miss;
DescribeStackResource, the singular action where the resource is required rather
than optional, is the one that raises. The error here was my inference, not an
observed AWS response.
* docs(cloudformation): correct the DescribeStackResources Javadoc and pin the redeploy test
Review on #5455.
The four-argument describeStackResources still documented an unmatched
LogicalResourceId as a ValidationError, which is what the previous commit
removed. It now says what the code does: a physical id answers with the whole
stack, a logical id is only a filter, and DescribeStackResource is the singular
action that raises for a miss.
aRedeployedPhysicalIdResolvesToTheLiveStackNotTheDeletedOne created the second
stack straight after DeleteStack, which answers before the deletion runs. The
old stack could still be DELETE_IN_PROGRESS, sorting it with the live stacks, so
the test could pass on creation time alone without ever reaching the deleted
branch it is named for. Awaiting the deletion makes it compare against a
DELETE_COMPLETE stack every time, and it still fails on a straight walk of
listStacks.
* feat(cognito): register passkeys and sign in with WEB_AUTHN
* test(cognito): cover passkeys with the Java SDK
* docs(cognito): document passkey registration and sign-in
* fix(cognito): check passkey counters under the user lock and tighten passkey origins
* fix(cognito): turn passkey MFA on per user and page passkeys with a cursor
* fix(cognito): verify passkeys without webauthn4j and gate passkey MFA on tier
Drops the webauthn4j dependency and its native-image entries. Cognito
recognizes only ES256 and RS256 passkeys and does not enforce
attestation, so jackson-dataformat-cbor decodes the attestation object,
the authenticator data and the COSE key, and java.security checks the
signature. The attestation statement is no longer verified.
The helpers the verifier needs live in core.common, and the existing
copies across main and test code now call them:
- PublicKeys builds a public key from its raw components, for the JWT
verifiers of API Gateway and Verified Permissions, SshPublicKeys, and
the CloudFront and SES curve lookups.
- Digests.sha256 and Digests.sha256Hex replace every one-shot SHA-256
digest and the private hex helpers built on one, including the two
public sha256Hex methods on SigV4RequestValidator; incremental and
streaming digests keep MessageDigest.
- Base64Url.encode, for bytes or the UTF-8 bytes of a string, replaces
every unpadded base64url encode and the private helpers wrapping it.
- DomainNames.isWithin replaces the same-domain-or-subdomain check in
SES, ACM, Route 53, the embedded DNS server, the TLS certificate
manager and the Cognito message dispatcher.
Every replacement produces the same bytes as the code it replaces.
Turning passkey MFA on now also needs a pool in the Essentials tier or
higher, and in an optional-MFA pool a user with software-token MFA keeps
WEB_AUTHN when passkey MFA is on, as the AWS MFA table describes.
---------
Co-authored-by: Priamo <pgermosen@gmail.com>
* fix(ec2): reject VPC IPv4 prefixes outside /16 to /28
CreateVpc and AssociateVpcCidrBlock took any IPv4 prefix, while the VPC
User Guide allows only /16 to /28 for VPC blocks and AWS answers anything
else with InvalidVpc.Range. The EKS test that needs a VPC block covering
both default service CIDRs now widens a valid VPC in the store instead.
* refactor(ec2): share one prefix check, seed /8 VPC in subnet tests
DescribeAvailabilityZones ignored the ZoneName, ZoneId and Filter
parameters and always returned every zone of the region. It now reads and
applies all three:
- ZoneName and ZoneId are mutually exclusive (InvalidParameterCombination).
- A name or id the region does not publish is refused with
InvalidParameterValue rather than silently dropped, so a wrong id cannot
pass as an empty result.
- Filters: zone-name, zone-id, zone-type, state, region-name, message,
opt-in-status, group-name, group-long-name, parent-zone-id and
parent-zone-name, with repeated same-name filters preserved for AND
semantics.
- group-name and group-long-name are modelled from the region (its id and
display name) so those filters match instead of being compared against
zone-type, and opt-in-status is read from the zone.
CreateSubnet now refuses a zone name outside the published zones too, so a
subnet can always be paired with a zone DescribeAvailabilityZones lists. The
published zones stay a/b/c per region, matching the seeded default subnets
and the compatibility suite.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* feat(cloudformation): provision ElastiCache users and user groups
Add AWS::ElastiCache::User and AWS::ElastiCache::UserGroup provisioners with authentication mode handling, create-only UserName, membership deltas, engine changes and replacement on rename.
* fix(cloudformation): address review findings for ElastiCache users and user groups
- Require Engine property when provisioning AWS::ElastiCache::User
- Reject invalid and conflicting AuthenticationMode combinations
- Add setUserGroupMembers to atomically update group membership under lock
- Require UserIds property when provisioning AWS::ElastiCache::UserGroup
- Snapshot and restore User and UserGroup on stack update rollback
- Tighten replaced subnet group deletion assertion in integration test
* refactor(elasticache): share user authentication and user group update logic
Move the AuthenticationMode / Passwords / NoPasswordRequired decision into
UserAuthentication so the query handler and the CloudFormation provisioner
no longer duplicate it. Make modifyUserGroup and setUserGroupMembers share
one locked update path, and drop the concurrency test that passed without
the lock.
* fix(cloudformation): apply an S3 bucket's NotificationConfiguration
AWS::S3::Bucket dropped NotificationConfiguration silently, so a stack wiring a
bucket to a queue, topic or function reported CREATE_COMPLETE and never
delivered an event. The property now goes through the same service method as
PutBucketNotificationConfiguration, destination validation included.
An update that removes the property clears the bucket's configuration, and one
the stack never declared is left alone, as on AWS. ProvisionContext gains the
previous template's properties, evaluated under that deployment's conditions,
so a provisioner can tell the two apart.
* test(cloudformation): share the stack status wait as CfnStackWaits.awaitStatus
The notification integration test polled DescribeStacks with a private helper
that waits out the CREATE_FAILED or UPDATE_FAILED a stack shows on its way to a
rollback, which awaitTerminal returns on. It is now CfnStackWaits.awaitStatus,
so other suites can wait for a rollback the same way.
* fix(cloudformation): apply Tags, DNS attributes and InstanceTenancy on AWS::EC2::VPC
Ec2VpcCfnProvisioner read only CidrBlock, so a VPC from a template had no tags
and DescribeVpcs with a tag:Name filter (CDK Vpc.from_lookup) never found it.
EnableDnsSupport, EnableDnsHostnames and InstanceTenancy were dropped as well.
Tags are now reconciled through Ec2Tags on create and on update (keys removed
from the template are deleted), the DNS attributes are applied with the AWS
defaults when omitted, and InstanceTenancy is passed to CreateVpc, with the
dedicated-to-default change applied in place through a new modifyVpcTenancy and
any other change treated as a replacement. CreateVpc on the EC2 Query API now
honours InstanceTenancy too so the two paths agree. Fn::GetAtt gains
CidrBlockAssociations, DefaultNetworkAcl and Ipv6CidrBlocks.
* fix(cloudformation): validate VPC tenancy and treat blank DNS properties as omitted
EnableDnsSupport/EnableDnsHostnames resolving blank (Fn::If with AWS::NoValue)
now take the AWS default instead of false. CreateVpc rejects an InstanceTenancy
outside default/dedicated/host with InvalidParameterValue, and ModifyVpcTenancy
requires the VPC to be dedicated, as on AWS; the provisioner replaces on any
other tenancy change. The integration test reads outputs with XmlPath, and the
query-handler test stub follows the new createVpc overload.
* style(cloudformation): no final on the VPC local; compare tag sets unordered in the test
* fix(ec2): CreateVpc accepts default or dedicated tenancy only
* fix(ec2): share the enumerated-parameter check for VPC tenancy and cover it on the Query API
requireMetadataOptionValue becomes requireParameterValue and requireVpcTenancy
uses it, so the InvalidParameterValue wording lives in one place. A Query API
test sends InstanceTenancy to CreateVpc and reads it back from DescribeVpcs,
the provisioner test no longer turns DNS hostnames on with DNS support off,
and the CreateVpc docs row names the accepted tenancies.
* fix(ec2): only an absent InstanceTenancy defaults; order the test static imports
* fix(cognito): include domains in user pool responses
* test(cognito): cover UpdateUserPool domain fields
* fix(cognito): scope user pool domain lookups by account
* fix(cognito): avoid stale domain responses after reset
* fix(cognito): drop redundant domain delete lock
When a stack update sent a custom resource's handler an Update and the
update then failed, Floci never told the handler. If a later resource
failed, the rollback recorded "Rollback is not implemented for
Custom::..." and the stack ended UPDATE_ROLLBACK_FAILED with the
handler's change still applied. If the handler failed its own Update,
Floci put the previous resource back in silence. In both cases
CloudFormation sends the handler a second Update with the previous
properties so it can undo the change.
CustomResourceCfnProvisioner now snapshots the resource before an
Update reaches its handler: the prior physical id, the old and the
attempted properties, the region and the Data attributes, under the new
CUSTOM_RESOURCE_UPDATE_SNAPSHOT_ATTR. A stale snapshot from an earlier
update is dropped first, so an update that sends nothing needs no
rollback. The ServiceToken is checked as Lambda's Invoke checks it
before the snapshot is written, so an Update rejected before it reaches
any handler is restored as before and sends no rollback request. While
the snapshot is held, retainsFailedUpdateState answers
true, so an Update the handler failed keeps its copy for the rollback
walker instead of being restored over. Its rollbackUpdate spends the
snapshot:
- the physical id was kept: report UPDATE_IN_PROGRESS and send Update
with the old properties as ResourceProperties and the attempted ones
as OldResourceProperties, under the same physical id and stack id. On
SUCCESS the Data attributes are replaced by the response's. A
response naming another id is taken, and the id that was sent gets a
best effort Delete with the attempted properties at once, since Floci
has no rollback cleanup phase.
- the handler replaced the resource: send a best effort Delete for the
new id with the attempted properties and point the resource back at
the old id and attributes, with no Update. CloudFormation sends this
Delete in its cleanup phase; Floci sends it during the rollback.
The old properties become the resource's own before the handler is
called, as on AWS, which treats the rollback target as the resource's
properties even when the handler fails it: a later DeleteStack sends
them in its Delete and the next update sends them as
OldResourceProperties. A FAILED answer throws with the handler's
Reason, so the resource is UPDATE_FAILED and the stack
UPDATE_ROLLBACK_FAILED, as on AWS, and the snapshot stays so a retry
sends the same Update again.