Commit Graph
3688 Commits
Author SHA1 Message Date
Simone Primarosa 50dc610d35 feat(eks): program cluster routes from emulated VPC route tables (#4496)
Program static kernel routes in EKS cluster containers from emulated
VPC route tables associated with the cluster subnets or VPC.

- Implement route table resolution for cluster VPC and subnets
- Resolve EC2 instance and network interface targets to reachable IPs
- Generate idempotent routing shell commands using ip route
- Attach cluster containers to the VPC bridge network when present
- Notify active clusters on route table modifications via VpcRouteTableListener
- Add configuration flag floci.services.eks.vpc-route-programming
- Add unit and Docker integration tests for route programming
2026-09-27 20:20:12 -04:00
Kenshin Okinaka 5fc38e33cb fix(redshift): remove a stale cluster container before creating it (#4537)
* fix(redshift): remove a stale cluster container before creating it

* fix(redshift): keep legacy-named containers when starting a cluster

* test(redshift): drop the zero-ETL cluster teardown
2026-09-27 20:15:22 -04:00
Abdul Wali Dal a43dcfa689 fix(iam): reject duplicate tag keys and make user and role tags case-insensitive (#4484) (#4520)
Reject duplicate tag keys in a single request with 400 InvalidInput, matching AWS IAM behavior:
- Users and roles treat tag keys case-insensitively for duplicate checks.
- Policies, instance profiles, OIDC and SAML providers treat tag keys case-sensitively for duplicate checks.
- User and role tag updates preserve existing tag key casing.
- UntagUser and UntagRole remove tags case-insensitively.
- Re-tagging an existing tag with alternate casing stays within the 50-tag quota.

Signed-off-by: Abdul Wali Dal <148618788+abdulwalidal@users.noreply.github.com>
2026-09-27 20:08:38 -04:00
Aniket Shukla b9efda8606 fix(apigateway): honor import warnings and strict rollback (#4531) 2026-09-27 18:22:48 -04:00
Vũ Thế Huy 98e1cca8a5 fix(iot): stabilize MQTT WebSocket concurrent sessions (#3816)
* fix(iot): stabilize MQTT WebSocket bridge sessions

* chore: remove internal planning documents

* test(iot): verify all close overloads and pin MQTT 3.1.1 version in WebSocket tests

* test(iot): coordinate concurrent test cleanup and cover websocket exception path
2026-09-27 16:32:54 -04:00
Vũ Thế Huy 47ea463146 fix(cognito): validate PasswordPolicy MinimumLength and remove default of 8 (#4359)
* fix(cognito): validate PasswordPolicy MinimumLength and remove default of 8

When PasswordPolicy is supplied on CreateUserPool or UpdateUserPool, live Cognito evaluates an omitted MinimumLength as 0 and rejects it with InvalidParameterException against the constraint MinimumLength >= 6. It does not default MinimumLength to 8.

Remove the synthetic default of 8, enforce constraint validation on MinimumLength (6-99), TemporaryPasswordValidityDays (0-365), and PasswordHistorySize (0-24) when PasswordPolicy is provided, and keep documented default of 7 for TemporaryPasswordValidityDays.

Closes #4256

* fix(cognito): reject oversized password policy values

* fix(cognito): reject unparseable password policy integers
2026-09-27 11:48:34 -04:00
Simone Primarosa 70c1c407bc feat(ec2): support instance and network-interface route targets (#4416)
Support InstanceId and NetworkInterfaceId in CreateRoute, ReplaceRoute,
and DescribeRouteTables, automatically resolving InstanceOwnerId.

- Parse and store InstanceId and NetworkInterfaceId on Route
- Validate instance target existence and set InstanceOwnerId to caller account
- Enforce single-target mutual exclusion across all supported route targets
- Remove InstanceId and NetworkInterfaceId from UNSUPPORTED_ROUTE_TARGETS
- Render instanceId, instanceOwnerId, and networkInterfaceId in DescribeRouteTables
- Add DescribeRouteTables filter support for route.instance-id and route.network-interface-id
- Document route target support in docs/services/ec2.md
- Add integration tests in Ec2RouteTargetIntegrationTest
- Add AWS SDK compatibility tests in Ec2RouteTargetTest
2026-09-27 09:18:29 -04:00
XuJian 228086ddb3 fix(iam): authorize REST and Query serving services (#4419)
* fix(iam): authorize REST and Query serving services

* fix(iam): enforce Operation query actions

* fix(iam): scope Operation fallback to Query requests

* style(iam): import CurrentVertxRequest in tests

* fix(iam): ignore Action fields on REST routes

* fix(iam): authorize Query actions from dispatched form body

* fix(iam): make Query authorization independent of claim order
2026-09-27 08:54:31 -04:00
XuJian 9c93e6ab7b fix(cognito): hide unknown users in USER_AUTH (#4478)
* fix(cognito): hide unknown users in USER_AUTH

* fix(cognito): honor per-client challenge session validity
2026-09-27 08:50:51 -04:00
Kenshin Okinaka 3441532a9d feat(ses): paginate template lists and align ListExportJobs paging (#4465)
* feat(ses): paginate template lists and align ListExportJobs paging

Add a namespaced Pagination.paginate overload and SesListPaging, which
holds the probed per-operation page-size bounds, default page sizes,
error messages and empty-token handling. ListTemplates (v1) and
ListEmailTemplates (v2) now page newest first and share one token
namespace, so a token from either continues the other. Without a page
size the template lists serve 10, as SES does. ListExportJobs refuses a
PageSize above 100 instead of clamping it, returns a null NextToken on
the last page, and uses SES's own error messages.

* refactor(ses): inject the template service clock and drop the paging test sleeps

* test(ses): tick the clock between template create and update
2026-09-27 08:44:58 -04:00
Abhigya 53de56f487 feat(cloudmap): honor service TTL in DNS A answers (#4448)
* feat(cloudmap): honor service TTL in DNS A answers

* fix(cloudmap): distinguish DNS no-data and reject case collisions

* fix(cloudmap): resolve SRV instance A hostnames

* refactor(cloudmap): simplify DNS answer states and resolver

Give DnsAnswer explicit records, noData and nxDomain factories, drop the
test-only buildAResponse overload, split Cloud Map name resolution into
service and instance-hostname lookups, and parse DnsConfig once on
CreateService.

* fix(cloudmap): lowercase DNS names independent of the default locale

* fix(route53): answer private zone DNS with the record set TTL

Port Route53DnsRecordSource to DnsAnswer after rebasing onto #4353. Answers
carry the record set TTL, a flattened CNAME chain uses the shortest TTL in
the chain, and an alias uses its target's. A name absent from the zone gets
NXDOMAIN; a name with records but no A gets NOERROR with no answers.

* fix(route53): answer empty non-terminals with no data and cap external CNAME TTL

A private zone name with records only beneath it exists in DNS, so it now
answers NOERROR with no A records instead of NXDOMAIN. A CNAME to a name
outside the private zones answers with at most 60 seconds, matching the
alias path, since the target's own TTL is not visible.

* fix(route53): stop wildcards matching at or beneath empty non-terminals

A name with records only beneath it exists, so under RFC 4592 a wildcard
from a farther ancestor must not answer for it or for names below it. The
closer-name check now counts any record sharing an ancestor with the query
name, including wildcard owners, so a closer wildcard also shadows a
parent wildcard.
2026-09-26 23:08:56 -04:00
XuJian c530d1f705 fix(elasticache): support HELLO AUTH handshakes (#4476)
* fix(elasticache): support HELLO AUTH handshakes

* fix(elasticache): bound HELLO handshake retries
2026-09-26 20:48:43 -04:00
Priamo Germosen 67437115c5 feat(iam): add last-accessed reporting actions (#4488)
Add GenerateServiceLastAccessedDetails, GetServiceLastAccessedDetails,
GetServiceLastAccessedDetailsWithEntities and ListPoliciesGrantingServiceAccess.

Floci records no service-access history, but AWS's "never used" shape keeps
the report and nulls the usage fields rather than emptying the report, so
that is what these reproduce. GetServiceLastAccessedDetails lists every
service the entity could reach through its permissions policies and leaves
LastAuthenticated and TotalAuthenticatedEntities absent for the ones never
used. GetServiceLastAccessedDetailsWithEntities lists the entities that
could have used the reported permissions: a group report yields the group's
users, a policy report the users and roles it is attached to, and a user or
role report that entity. Both lists come from permissions-policy logic,
which Floci can evaluate, so both are computed rather than stubbed; the
usage timestamps are the only part left out.

A report is produced when the job is created and stored with it, matching
AWS, where the Get operations retrieve a report that Generate produced. So
editing the policies afterwards does not change what a completed job
answers, and deleting the entity does not stop a valid JobId resolving.
Generate resolves the whole ARN first, rejecting one whose account is not
the caller's or whose path is not the resolved entity's, so it cannot fall
back to a same-named local identity; AWS-managed policy ARNs carry the
literal "aws" account and are allowed through to the global catalog. An
unknown JobId is NoSuchEntity, Granularity is validated and echoed back as
JobType, and both readers honour MaxItems and Marker.

ListPoliciesGrantingServiceAccess needs no job and no usage history, since
AWS defines it purely over permissions-policy logic. A user contributes its
own managed and inline policies plus those of every group it belongs to,
while a group or role contributes only its own; permissions boundaries are
excluded. Only Allow grants, and Allow with NotAction grants every service
the list does not carve out. It models a Marker but no MaxItems, so only the
former is applied.

Services reachable only through a wildcard or NotAction cannot be
enumerated without a catalog of IAM service namespaces, which is tracked
separately in #4487 and documented.
2026-09-26 20:12:27 -04:00
Hector Ventura 0cfb467cac fix(s3): apply AWS's CreateBucket region rules in every partition (#4494)
* fix(s3): apply AWS's CreateBucket region rules in every partition

CreateBucket follows the rules moto verified against AWS: the us-east-1 endpoint takes any LocationConstraint but its own (InvalidLocationConstraint), and every other regional endpoint requires a constraint naming exactly its region, answering IllegalLocationConstraintException otherwise. The signing region alone no longer places a bucket, so a China or GovCloud client must send the constraint, which the AWS SDKs do. GetBucketLocation still answers an empty constraint only for us-east-1, in every partition.

WAF's CLOUDFRONT scope lives in the partition's implicit global region and is refused with WAFInvalidParameterException where the partition has no CloudFront. Lightsail lists no regions outside the commercial partition. Region fallbacks read the configured default where a resolver or config is in scope, and PreSignedUrlGenerator gains an overload that signs for a given region. The region-literal category of the partition guardrail is now gated; every remaining literal carries a stated reason.

Tests that created buckets under a regional signing scope with no constraint now send one, and S3IntegrationTest's case that pinned the old signing-region placement is replaced by the rejection and its positive twin.

Part of #4272

* fix(s3,wafv2): answer a us-east-1 constraint off its endpoint as a mismatch, and gate the CLOUDFRONT scope on every operation

A CreateBucket on a regional endpoint other than us-east-1 with LocationConstraint us-east-1 is just another mismatched region, IllegalLocationConstraintException, as moto's aws_verified test_create_bucket_with_wrong_location_constraint records; InvalidLocationConstraint belongs to the us-east-1 endpoint alone (test_bucket_create_force_us_east_1). The body parse no longer rejects us-east-1 early, and bucketRegionForCreate checks the endpoint mismatch first.

WAF's CLOUDFRONT scope was refused in partitions without CloudFront only when creating a resource; validateScope, which every operation already calls, now applies the same check, so a List or Get for that scope answers the same WAFInvalidParameterException.

* fix(wafv2): check the CLOUDFRONT scope against the region each call is about

The previous change checked the scope in validateScope against the request region, but CloudFormation calls the service outside any request, where that region falls back to the deployment default: under a GovCloud default a commercial stack's CLOUDFRONT WebACL was refused on create, update and delete. WafV2Handler now checks Scope=CLOUDFRONT against the region the API request was sent to, before dispatch, so every operation still answers the same error; validateScope checks the enum only, and a create keeps its check against the region it is given where the ARN is built.
2026-09-26 20:09:34 -04:00
Aymen JAMAAOUI 1b176bda0d fix(kinesisanalytics): make the savepoints volume writable by the Flink user (#4490)
* fix(kinesisanalytics): make the savepoints volume writable by the Flink user

Docker creates the savepoints named volume root:root, while the official
apache/flink images run Flink as uid/gid 9999, so the JobManager could not
create /opt/flink/savepoints and every CreateApplicationSnapshot ended
FAILED. Initialise the volume root through
ContainerLifecycleManager.ensureSharedVolume, chowning it to 9999:9999
before the JobManager starts.

Closes #4443

* fix(core): reinitialise shared volume ownership when the volume is recreated

ensureSharedVolume memoised the one-off chown per volume name for the
whole process, so a volume removed and recreated under the same name
(DeleteApplication in memory mode, or docker volume rm) came back
root:root without being initialised again. Drop the memo whenever the
volume has just been created.
2026-09-26 17:39:08 -05:00
Simone Primarosa 4032efd9c7 feat(route53): resolve private hosted zone records from cluster containers (#4353)
Implement DnsRecordSource SPI via Route53DnsRecordSource to decouple Route 53 resolution from EmbeddedDnsServer. Add DnsLookupHelper in core.common.dns for external IPv4 resolution via upstream forwarders with system fallback, shared by Route53DnsRecordSource for CNAME and ALIAS chasing. Discover private hosted zones via Route53Service and support in-zone chasing, built-in Floci suffixes, and EC2 internal names. Authoritatively resolve A records within private zones to prevent upstream query leakage. Wire EKS cluster containers to embedded DNS via specBuilder.withEmbeddedDns().
2026-09-26 16:59:04 -05:00
Mario Toffia 84363f9570 fix(iot): run MQTT topic rules off the event loop (#4462)
An MQTT publish ran every matching topic rule action on the Vert.x event loop serving the connection before fanning the message out, so a slow action stalled every client on that loop and delayed delivery to subscribers.
The broker now stores the retained message, records the publish, sends the PUBACK and fans out on the event loop, and hands topic rule evaluation to a single-thread worker executor of its own. IoT Data Publish still evaluates its rules before it returns. At most 1,000 evaluations are pending; beyond that a publish is still delivered but its rules are skipped, with one warning until the backlog drains. A state reset or a broker shutdown skips the rules still waiting, and an MQTT publish received during the reset or while the broker is stopped runs none.
2026-09-26 16:58:54 -05:00
Aniket Shukla c0cb49facc fix(cognito): persist app client AuthSessionValidity (#4481)
* fix(cognito): persist app client AuthSessionValidity

* test(cognito): cover session validity through the SDK

* fix(cognito): align session validity validation with AWS errors
2026-09-26 16:47:30 -05:00
Clement 16a6c24e15 fix(elbv2): probe the target group's HealthCheckPort instead of always the traffic port (#4432)
* fix(elbv2): probe the target group's HealthCheckPort instead of always the traffic port

The health checker always probed each target on its traffic port, so a target
group whose HealthCheckPort names a separate port (an app serving traffic on
one port and its health endpoint on another) was marked unhealthy even though
its health endpoint answered. AWS probes HealthCheckPort when it is a port
number and the target's own port when it is traffic-port, the default.
Health state stays keyed by the traffic port either way.

* fix(elbv2): reject a HealthCheckPort that is not traffic-port or a port from 1 to 65535
2026-09-26 16:44:04 -05:00
Emmanuel Olowosulu b4d8483348 fix(cognito): fire PreTokenGeneration when the token endpoint redeems a code (#4438)
* fix(cognito): fire PreTokenGeneration when the token endpoint redeems a code

Managed login and federated sign-in both mint their tokens at
POST /oauth2/token, which called generateAuthResult directly and so never
invoked the pre token generation trigger. A pool whose trigger adds claims
got them from InitiateAuth but not from a hosted-UI sign-in, so an
application that authorizes on a custom claim rejected every token a browser
obtained while the same user's tokens from InitiateAuth were accepted.

Redemption now mints through a hosted-auth path that fires the trigger with
triggerSource TokenGeneration_HostedAuth, which is what AWS uses for a
sign-in through the hosted UI, for a pool's own users and federated users
alike. The authorization request's nonce is applied after the trigger's
claims so a trigger cannot displace it; AWS likewise does not let this
trigger override nonce.

* fix(cognito): pass the requested scopes to the hosted-auth trigger

Review feedback. The authorization code stores the scopes the authorize
request asked for, but the hosted-auth trigger call sent an empty list, so a
V2 lambda that branches on requested scopes had nothing to branch on. Thread
the code's scopes through to the trigger event. The other call sites keep
sending an empty list, which is what their non-OAuth flows carry.

Also replace the em-dashes in the new comments, per AGENTS.md.

* fix(cognito): narrow the trigger's scopes to the client's allowed set

Review feedback. An authorization request names its own scopes and nothing
checks them against the client's AllowedOAuthScopes when the code is issued,
so a stored code can carry a scope the client may not use. Passing those
straight through meant a V2 trigger could grant claims, or add scopes, from a
scope the client was never entitled to request.

The hosted-auth path now narrows the requested scopes to the client's allowed
set before the trigger is told about them, dropping the rest the way AWS
ignores a scope that is not associated with the client. The narrowing lives in
the service method rather than at the call site, so every caller gets it.

* style(cognito): brace the new conditionals

Review feedback. AGENTS.md requires braces in all conditionals, and the four
early returns in the claims-merge helpers omitted them.
2026-09-26 16:43:52 -05:00
David e186a772a8 fix(glue): keep counting a trigger chain when its origin is gone (#4472)
The trigger loop safeguard kept a chain's run count on the origin run or
crawl and reserved it for whole firings, so it skipped downstream actions
in three cases: a failed start still spent budget, an origin crawl that
aged out of history or whose crawler was deleted ended its chain, and
runs persisted before the bookkeeping existed were refused.

Keep the counts in their own bounded store keyed by origin (least
recently used forgotten past 1000 chains), claim one run per action just
before it starts and give it back if the start fails, and treat a crawl
without a recorded origin as its own origin.
2026-09-26 16:43:42 -05:00
Ben Younes 5467506fca fix(apigatewayv2): pin websocket HTTP targets (#4341)
Resolve the plain http:// target of a WebSocket HTTP or HTTP_PROXY
integration once, reject metadata and link-local results, and connect to
the checked InetAddress so the name cannot be re-resolved between the
check and the connection.

The pinned request and its response parsing now live in a shared
PinnedHttpClient that HTTP_PROXY uses too, so both integrations keep the
same bounds: the 10 MB payload quota on the Content-Length, chunked and
close-delimited paths, rejected negative or oversized chunk sizes, and
the CRLF check after each chunk.

The Host header carries the target host and port only, without any
credentials the integration URI holds.
2026-09-26 16:33:15 -05:00
Niels Kootstra fe55cf0d06 fix(bedrock-agentcore): expire remembered delete client tokens (#4477)
* fix(bedrock-agentcore): expire remembered delete client tokens

Runtime, endpoint, and memory deletes remembered every clientToken of
a completed delete forever, so a long-running emulator would grow an
unbounded set of tokens. Replace the per-service token sets with a
shared DeletedTokenLedger that stamps each token with the time it was
recorded and treats it as absent once it is older than an 8 hour
window, matching the clientToken idempotency window AWS documents for
other control planes (for example DynamoDB's ImportTable and
SageMaker APIs) and already used in this repo's
VerifiedPermissionsService. A replay past that window now 404s like
an unknown token instead of returning the DELETING marker forever,
and expired entries are purged on the next write so the ledger cannot
grow without bound.

* perf(bedrock-agentcore): purge expired delete tokens from the front of a queue

Recording a token scanned every live token to find the expired ones, so
a run of deletes inside the 8 hour window did quadratic work. Tokens
are now also queued in the order they were recorded, and purge pops
only the expired entries at the front. A token reused while its first
record is live keeps the newer record when the older one is purged.

* fix(bedrock-agentcore): keep one ledger entry per delete token

The queue added one entry per record, so a client reusing a token for
many deletes inside the window grew the ledger with the number of
deletes rather than the number of tokens. An insertion-ordered map now
holds one entry per token; re-recording moves the token to the back, and
purge still stops at the first live entry.

* fix(bedrock-agentcore): time delete tokens from their first use

Re-recording a token restamped it, so a token reused every few hours
never expired. The window AWS documents for client tokens runs from the
first request that used the token, so record now keeps the first
timestamp with putIfAbsent. The ledger stays ordered by first use, so
purge can still stop at the first live entry.

* fix(bedrock-agentcore): restart an expired delete token the purge missed

If the wall clock steps back, an expired token can sit behind a live
one where the front purge stops, and putIfAbsent then kept its stale
timestamp on reuse, so an immediate replay 404ed. record now goes
through contains, which drops an expired entry, so reusing it starts a
fresh window.
2026-09-26 16:33:02 -05:00
Matheus Oliveira 60b8fd2037 fix(s3): honor bucket-policy grants on presigned POST uploads (#4278)
A presigned POST was authorized against the signing principal's identity
policies alone, so a same-account caller that only the bucket policy named was
denied. The IAM filter now resolves the applicable resource policies on that
path too, letting either policy provide the grant while an explicit deny in
either still wins and cross-account access still requires both.

That resolution now also carries the global condition keys
(aws:PrincipalAccount, aws:ResourceAccount, aws:RequestedRegion) filter()
already supplies for every other enforcement path, instead of only
aws:PrincipalArn, so a conditional bucket-policy statement is judged
consistently between the two enforcement paths.

Per-action, header-derived keys (s3:RequestObjectTag/* from x-amz-tagging)
are deliberately not resolved here: a presigned POST's outer HTTP headers are
not covered by its signed policy document and do not correspond to any tag
S3Controller actually applies to the object, so trusting one would let a
caller satisfy a tag-scoped grant condition without the object ever carrying
that tag.

Closes #4243

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-26 16:32:47 -05:00
Aniket Shukla 5ace4281f3 fix(ec2): validate DescribeVpcs ids at the query boundary (#4482)
* fix(ec2): validate DescribeVpcs ids at the query boundary

* fix(ec2): preserve DescribeVpcs filter error precedence

* fix(ec2): remove obsolete shared VPC lookup catches
2026-09-26 16:32:43 -05:00
Mario Toffia d658c75a41 refactor(dynamodb): scope runtime work to the selected backend (#4401)
Add DynamoDbRuntime and a DynamoDbBackendLifecycle seam so the emulator lifecycle starts, resets and stops only the selected backend.
Native start initializes the engine before persisted stream consumers and schedules the TTL sweep, which never ran because its bean was unused.
Reset gains a checkReset preflight that runs before anything is stopped or cleared, and native reset now drops streams, item caches, idempotency tokens and forwarder queues.
Reset also pauses the TTL sweep and waits out in-flight zero-ETL writes before Floci storage is cleared.
Shutdown stops the Lambda DynamoDB poller, the Redshift zero-ETL consumer and the Kinesis forwarding drains before the final flush, and the Redshift consumer is now Resettable.
2026-09-26 16:24:03 -05:00
MIdhun 5cb973c561 feat(kms): support ECC imported key material (#4428)
* feat(kms): support ECC imported key material

* test(kms): cover verify, digest signing and import lifecycle for ECC keys

* docs(kms): explain why ECC keys accept every supported wrapping algorithm

* fix(kms): reject ECC key material whose inner curve parameters differ

* fix(kms): report malformed ECC key fields as IncorrectKeyMaterialException

* fix(kms): reject RSAES_OAEP wrapping of ECC_NIST_P521 material under an RSA_2048 key
2026-09-26 16:23:53 -05:00
stodan 60d112542d fix(cloudformation): delete UPDATE_FAILED resources on DeleteStack (#4470)
* fix(cloudformation): delete UPDATE_FAILED resources on DeleteStack

A failed update whose rollback cannot restore a resource leaves it
UPDATE_FAILED with its physical id and the stack in
UPDATE_ROLLBACK_FAILED. DeleteStack only walked CREATE_COMPLETE,
UPDATE_COMPLETE and DELETE_FAILED resources, plus UPDATE_FAILED ones
whose provisioner opted in, so every other failed resource was skipped
without an event and the stack still reached DELETE_COMPLETE, leaving
the role, log group or bucket behind.

Delete every UPDATE_FAILED resource that has a physical id. Delete a
CREATE_FAILED resource only when the provisioner marked its entity as
created by the stack, as the create rollback does, since a failed
create can name an entity that existed before.

Closes #4467

* test(cloudformation): clean up the outside log group when the test fails

* docs(cloudformation): list the resource statuses DeleteStack deletes

* fix(cloudformation): mark a failed nested stack the operation created as stack-owned

A nested stack whose child fails during creation came back CREATE_FAILED
with the child's stack id but no ownership marker, so neither the create
rollback nor DeleteStack deleted the child stack.

* test(cloudformation): clean up the stack, role and log group when the test fails

* docs(cloudformation): update the hasPendingRollbackCleanup javadoc now that DeleteStack no longer calls it
2026-09-26 16:23:44 -05:00
Priamo Germosen 64375691ac fix(iam): enforce tag constraints across every IAM tagging action (#4485)
extractTags collapsed Tags.member.N into a map before any count was taken,
so a 51-member list with one repeated key slipped through as 50 tags, and
TagUser, TagRole, TagPolicy and TagOpenIDConnectProvider bounded nothing.

The request-shape rules now live in the handler, on the members as sent:
tagListType and tagKeyListType are capped at 50 for every tag and untag
action, keys must be 1-128 characters and values at most 256, both matching
IAM's tag character pattern, with errors naming the offending member index.

Users, roles, policies and OIDC providers now also enforce the 50-tag
per-resource quota (LimitExceeded, as instance and SAML providers already
did), and the tag read-modify-write runs under a lock so two requests that
each fit cannot together push a resource past it.

Closes #4407
2026-09-26 16:10:41 -05:00
Priamo Germosen 1451693cda feat(ecs): give task containers their role credentials (#4486)
Wires the pieces together so a task that declares a taskRoleArn actually gets
credentials. EcsContainerManager issues the task's session, stands the proxy
up on the network its containers join, publishes one relative URI to every
container in the task the way real ECS does, and gives each container its own
address in 169.254.0.0/16 so it has a connected route to the endpoint at all.
Credentials and addresses are released when the task stops, exits, or fails
part way through a launch.

EcsTaskLinkLocalAddresses owns the addresses because Docker will not: it
accepts two containers claiming the same link-local address on one network
and then which one answers depends on whose ARP reply wins. Addresses are
tracked per network, since separate networks are separate L2 segments, and
freed with the task.

ContainerBuilder.resolveDockerNetwork exposes the network a spec would land
on, which the allocator needs before the spec exists. withDockerNetwork now
calls the same method rather than keeping a second copy of the resolution.

A security-group protected task is skipped for now and says so: those
containers run in an isolated helper namespace that the proxy's address does
not reach, so issuing credentials there would hand out an endpoint the task
cannot use.

Closes #4483.
2026-09-26 16:10:30 -05:00
Niels Kootstra 8b9f441bb4 fix(cognito): expire auth challenge sessions (#4417)
* fix(cognito): expire auth challenge sessions

InitiateAuth and RespondToAuthChallenge session tokens for SRP, custom
auth, and USER_AUTH never expired, so an abandoned challenge session
lingered in memory forever and could still be completed long after
AWS would have rejected it. Track when each session was issued and
reject expired ones with the NotAuthorizedException Cognito returns
in that case, purging expired entries whenever a new one is created.

AWS defaults AuthSessionValidity to 3 minutes (configurable 3-15 via
CreateUserPoolClient); UserPoolClient does not yet store a per-client
override, so every client uses the 3 minute default for now.

* fix(cognito): stamp custom auth tokens when they are issued

A CUSTOM_AUTH session's issue time was recorded before the
DefineAuthChallenge and CreateAuthChallenge triggers ran, so a slow
trigger shortened the session handed to the client. The issue time
also lived on the flow state shared across rounds, so minting the next
round's token refreshed the old token while it was still in the map.

Each custom auth token now carries its own issue time, stamped when it
is stored, and every issuance path (including both continuations)
purges expired tokens first.

* style(cognito): brace the custom auth session lookup

* test(cognito): use the shared MutableClock

* docs(cognito): document auth challenge session expiry

* chore: rerun CI

* chore: rerun CI
2026-09-26 16:10:19 -05:00
Abhigya a5ded3e162 fix(apigateway): import x-amazon-apigateway-any-method in the native image and roll back failed imports (#4473)
* fix(apigateway): import x-amazon-apigateway-any-method in the native image and roll back failed imports

The ANY pseudo-operation reaches the service as an untyped extension map, and it was
bound to io.swagger.v3.oas.models.Operation with Jackson bean deserialization. The
swagger model graph is not registered for reflection, so in the native image every
ImportRestApi or PutRestApi body with x-amazon-apigateway-any-method failed with
BadRequestException. Parse it with the swagger parser's own Operation reader, the one
that already builds the real verbs, which needs no reflection.

A failed import also left state behind: ImportRestApi kept a half-built API whose id the
caller never received, and PutRestApi left the API cleared and partly rebuilt. ImportRestApi
now deletes what it created and PutRestApi restores the API-scoped state it replaced.

* chore(apigateway): import swagger Json instead of qualifying it inline
2026-09-26 14:03:30 -04:00
vamsiakandVamsi Akavarapu f3dde75c0b fix(sns): retry failed sqs subscription deliveries (#4468)
* fix(sns): retry failed sqs subscription deliveries

* fix(sns): support fifo subscription dead letter queues

* fix(sns): distinguish shared fifo dlq deliveries

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-26 13:59:29 -04:00
Abhigya 5af1d4048e fix(elasticache): report a ConfigurationEndpoint only for cluster-mode-enabled replication groups (#4469)
A cluster-mode-disabled replication group reported a ConfigurationEndpoint
alongside NodeGroups[0].PrimaryEndpoint. AWS only returns ConfigurationEndpoint
for a cluster-mode-enabled group, and terraform-provider-aws branches on its
presence: when it is set, primary_endpoint_address and reader_endpoint_address
are left null.
2026-09-26 13:33:47 -04:00
vamsiakandVamsi Akavarapu bbb1e10fc8 fix(sqs): retain fifo deduplication after message deletion (#4460)
* fix(sqs): retain fifo deduplication after message deletion

* fix(sqs): preserve fifo send identity after deletion

* fix(sqs): serialize fifo dedup expiry with sends

* fix(sqs): narrow FIFO deduplication send locking

* chore(ci): rerun PR test workflow

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-26 10:58:42 -04:00
Hector Ventura 2cccc73499 fix(core): build and recognise AWS hostnames in every partition (#4451)
* fix(core): build and recognise AWS hostnames in every partition

AwsEndpoints builds the AWS-shaped hosts Floci returns from the region's partition DNS suffix: execute-api, the S3 bucket, regional, dual-stack and website hosts, Cognito and EKS OIDC issuers, APS, Bedrock AgentCore, AppSync and EC2 public DNS names. partitions.json records the regions whose S3 endpoint publishes a dual-stack variant, so DualStackDomainName is only returned there. The S3 virtual-host fallback, the execute-api host filter, the ECR image URI and the CloudFront S3-origin parsers recognise every published suffix, longest first. The CloudFront domain suffix Cognito and API Gateway mint comes from floci.services.cloudfront.domain-suffix.

Two commercial bugs go with it: WebsiteURL uses the dash form (s3-website-<region>) in the nine regions that keep it and ends with a slash, and EMR's public DNS name is compute-1 only in us-east-1.

Also carries the follow-ups from the #4444 review: accessDeniedResponse gets its Javadoc back in IamEnforcementFilter, IamAuthValidator's imports are in order, and the IAM test helper's pair loop cannot read past the array.

Part of #4272

* fix(core): keep CloudTrail S3 hosts and CFN dual-stack attributes consistent with their region

CloudTrail built an S3 data event's Host, TLS host header and resource ARNs from the request scope, but the log writer emits its own deliveries from the flush thread, where the request region falls back to the deployment default: a cn-north-1 trail's self-delivery record said awsRegion cn-north-1 with a .amazonaws.com host and an arn:aws: ARN. buildS3Record now takes the event region emitS3DataEvent already resolves and derives all of them from it.

AWS::S3::Bucket drops a prior DualStackDomainName when an update lands in a region without an S3 dual-stack endpoint, since provision receives the previous attributes on update.

* test(resourceexplorer2): check a regionless ARN's partition against the resource's region

The cn-north-1 CloudTrail self-delivery test left its bucket behind in the shared emulator, and ResourceExplorer2's partition assertion then failed on arn:aws-cn:s3:::loop-logs-..., a correct ARN: S3 ARNs carry no region, so the expected partition fell back to aws. The assertion now takes a regionless ARN's partition from the Region the listing reports, and skips it when that is not a published region (global resources). The CloudTrail test deletes its trail, objects and bucket after each case through PartitionCleanup.
2026-09-26 10:15:18 -04:00
Aniket Shukla df67d421f9 fix(rds): honor Port on cluster snapshot restore (#4326)
* fix(rds): honor requested port when restoring a cluster snapshot

Reserve an explicit RestoreDBClusterFromSnapshot port for the cluster endpoint and proxy, validate its AWS range, and reject local port collisions. Keep automatic allocation when Port is omitted.

* fix(rds): keep requested ports within published proxy range

* fix(rds): reject occupied requested ports and preserve handler calls
2026-09-26 01:34:59 -05:00
Priamo Germosen b18ddc2c24 fix(sns): refuse http endpoints on link-local and metadata addresses (#4400)
Subscribe checked only that an http/https endpoint carried a matching scheme, then Floci posted the SubscriptionConfirmation and every notification to it. An unauthenticated Subscribe therefore turned the emulator into a blind request forwarder against addresses only it can reach.

Resolve and screen the endpoint at Subscribe, which is where a name can be judged. At delivery, screen only an endpoint that names an address outright, which reaches a subscription stored before Subscribe began refusing them and costs no lookup. Deliberately no second resolution there: HttpClient resolves the name again when it connects and cannot be given the result of a check, so a lookup could never decide where the request goes.

Loopback and private ranges stay allowed, since delivering to a neighbouring container is the normal case, and a host that does not resolve yet is accepted as it is on AWS.
2026-09-26 01:11:19 -05:00
Mario Toffia 2df052181d fix(dynamodb): route stream consumers through one account-scoped reader (#4394)
* refactor(dynamodb): add a stream reader and key native streams by table ARN

DynamoDbStreamReader is the engine-neutral way to read DynamoDB Streams.
DynamoDbApiStreamReader implements it over the selected DynamoDbOperations using the Streams wire API.
Native streams were keyed by region and table name, so same-named tables in two accounts shared one stream.
They are now keyed by table ARN, and ListStreams returns only the caller's account and region.

Streams of every account are restored from persisted tables at startup.

* refactor(dynamodb): move stream consumers onto the stream reader

The Lambda DynamoDB Streams poller reads through DynamoDbStreamReader: each tick renews iterators from committed progress for every readable shard, and reads a child shard only after its parent was read to its end.
It discards restart checkpoints only for a process-lifetime engine, and pins LATEST per shard via newestSequenceNumbers, replacing DynamoDbStreamService.latestSequenceNumber.
A read fills a batch from as many GetRecords calls as it needs, so a batch is not cut at the 1000 record GetRecords maximum.
EventBridge Pipes reads DynamoDB streams the same way, committing a batch only once it is delivered or sent to the DLQ, delivers the AWS stream record shape with eventSourceARN, and honors LATEST.
The Redshift zero-ETL consumer reads the same way, keeping per-shard progress in the integration (legacy checkpointSequenceNumber is ignored on load) and committing a batch only after it is written to the landing table.
It discards that progress at startup for a process-lifetime engine, and the writer now takes AWS stream records, so Redshift no longer uses DynamoDbStreamService or DynamoDbStreamRecord, whose SHARD_ID is now package-private.
2026-09-26 01:08:45 -05:00
Priamo Germosen 0a4320132d feat(ecs): hold 169.254.170.2 on the task's network with a small proxy container (#4293)
Adds EcsCredentialsProxy, which launches one small socat container per Docker
network, on first use, holding the address AWS SDKs hardcode for container
credentials and forwarding to EcsTaskRoleCredentialsServer over
host.docker.internal. Reuses the same floci/network-helper:local image and
build-on-first-use logic as security-group enforcement (now factored into
LocallyBuiltHelperImage, shared by both).

Docker accepts a link-local address request even when the runtime then drops
it (the review discussion on #4063), so the bind is never trusted from the
API call alone: after start, an actual HTTP round trip through the address,
socat, and to the real server is required before the proxy is considered
ready, not just that the address shows up on the interface. A prior version
of this checked only the interface, which has a real race between the
address appearing and socat finishing its bind; the end-to-end check is what
catches both that and a genuinely dropped LinkLocalIPs.

Proven against a real Docker daemon: a plain container with its own
169.254.0.0/16 address (what the follow-up EcsContainerManager wiring gives
each task container) fetches real credentials through the proxy end to end.
That same test corrects an assumption from earlier discussion: a task
container needs an address in that range to reach the proxy at all. Without
one, its routing table has no connected route for 169.254.0.0/16, so the
kernel routes toward the default gateway instead of resolving the peer
directly, and the connection is refused before it reaches the proxy's
socket, the same symptom a completely absent listener produces. This is
exactly why the original design in #2987 gave every task container its own
link-local address; that part of the design was right.

EmulatorLifecycle now starts and stops the credentials server, and runs the
session sweep, gated on the same enabled() flag: previously the flag did
nothing at all, since nothing in main called it after three merged PRs.
EcsCredentialsProxy also implements ContainerTeardown, so its proxy
containers are removed on shutdown and on /state/reset instead of
outliving either indefinitely. Full task wiring (EcsContainerManager
actually issuing credentials and giving task containers their own
link-local address) is still a separate follow-up.
2026-09-26 01:06:57 -05:00
MIdhun f29c2b1c95 fix(kms): return an empty Description when CreateKey omits one (#4349)
* fix(kms): return an empty Description when CreateKey omits one

* fix(kms): return an empty Description for stored keys without one
2026-09-25 23:17:59 -04:00
David 0d813adf95 feat(glue): create, run and chain triggers (#4436)
Glue had no triggers: CreateTrigger and the rest answered InvalidAction.
Add CreateTrigger, GetTrigger, GetTriggers, ListTriggers,
BatchGetTriggers, UpdateTrigger, DeleteTrigger, StartTrigger and
StopTrigger.

StartTrigger runs an ON_DEMAND trigger's actions. An activated
CONDITIONAL trigger fires when a watched job run or crawl finishes in
the named state, evaluated after every Glue request, so a chain of
triggers completes within the request that starts it when runs finish
at once. Runs started by a trigger carry its TriggerName. SCHEDULED
triggers are stored and can be activated but do not fire on a timer.

Part of #4380
2026-09-25 23:14:51 -04:00
Hector Ventura 7a583cc293 fix(sfn): resolve Reference Paths rooted at the Context Object (#4445)
* fix(sfn): resolve Reference Paths rooted at the Context Object

ASL accepts a string_sampler wherever it accepts a Reference Path, and a Context Object path ($$) is one of its three spellings, so a definition that deploys on AWS was rejected or silently mishandled here.

Validation rejected $$ outright. isReferencePath required a $-rooted path, so CreateStateMachine answered "Value is not a Reference Path" for the six Map numeric path fields (MaxConcurrencyPath, MaxItemsPath, ToleratedFailureCountPath, ToleratedFailurePercentagePath and the two ItemBatcher ones). The walk now strips a $$ root and keeps the existing strictness that rejects wildcards, filters and slices.

Resolution never saw the Context Object. Five sites called the context-free resolvePath overload, so an accepted $$ path resolved to a missing node: InputPath narrowed the state input to null, OutputPath returned null, Wait's SecondsPath fell through without waiting at all, Wait's TimestampPath failed with "Invalid Timestamp: null", and the ItemReader's MaxItemsPath failed with "MaxItems must resolve to an integer of 0 or more", each blaming the value rather than the unresolved path. applyInputPath and applyOutputPath now take the Context Object and it is threaded through all fifteen state-handler call sites, each of which already received it.

StepFunctionsValidateStateMachineDefinitionIntegrationTest used "$$.Execution.Input.count" as its example of an invalid Reference Path, so the test pinned the defect and CI stayed green while the behaviour was wrong. It now uses "$.counts[*]", which is genuinely not a Reference Path, and that assertion still passes against the unpatched validator.

Grammar reference: ASLParser.g4 input_path_decl:85, output_path_decl:91, seconds_path:110, timestamp_path:115, max_concurrency_path:128, max_items_path:330, tolerated_failure_count_path:336, tolerated_failure_percentage_path:342, all string_sampler at :475.

* test(sfn): pin Context Object Wait paths through the sleeper seam and execute Map batch and tolerance paths

The two Wait cases timed the whole execution from the client, so setup and polling counted toward the wait and they spent about two seconds proving a path resolves. They now live in AslExecutorWaitStateTest, where the fixed clock and recording sleeper assert the exact requested pause for SecondsPath and TimestampPath rooted at $$.

MaxItemsPerBatchPath and ToleratedFailureCountPath were only validated with a $$ root; two execution cases now run a distributed Map that reads each from the Context Object, with InputPath narrowing the input so a resolver that sees only the state input cannot pass.

applyOutputPath drops its state-input parameter, which it never read.
2026-09-25 22:46:41 -04:00
Mario Toffia f51679c1f6 fix(iot): parse exponent and large integer literals in rule SQL (#4441)
A number literal written with an exponent (1e5, 1E-3) or an integer beyond 64 bits failed to parse, so in the default lenient mode the rule fell back to a passthrough that ignored WHERE, and in strict mode CreateTopicRule was rejected.
The tokenizer now reads an optional exponent and such literals become decimals, following the JSON number syntax AWS IoT SQL uses for literals.
2026-09-25 22:27:02 -04:00
Vũ Thế Huy cee5b441d9 fix(lambda): drop a DynamoDB Streams batch whose OnFailure send fails (#4338)
* fix(lambda): discard streams records on delivery failure

* test(lambda): align streams failure test with discard behavior

* fix(lambda): log stream destination refusal once
2026-09-25 20:45:54 -04:00
Vũ Thế Huy c3c5c16c81 fix(lambda): support async retries and dead-letter queue (DLQ) for asynchronous invocations (#4251)
* fix(lambda): support async retries and dead-letter queue (DLQ)

- Add retry loop honoring MaximumRetryAttempts and MaximumEventAgeInSeconds in LambdaExecutorService
- Deliver original payload and message attributes (RequestID, ErrorCode, ErrorMessage) to SQS/SNS DLQ in AsyncInvokeDestinationRouter
- Give precedence to OnFailure destination over DeadLetterConfig
- Wrap EventInvokeConfig queries in RequestScopes.callAs for correct account partitioning
- Add comprehensive unit and integration tests covering retries and DLQ delivery

Closes #4194

* test(lambda): cover cross-account DLQ delivery

* fix(lambda): add missing async destination test helper

* test(lambda): allow async retry attempts in chain guard test

* fix(lambda): preserve async result on age expiry
2026-09-25 20:35:23 -04:00
Aniket Shukla cd9843f5bd fix(sts): preserve assumed role session identity (#4403)
* fix(sts): preserve assumed role session identity

* test(sts): cover federated caller identity round trips
2026-09-25 20:29:14 -04:00
lex00 4b15ca8950 fix(ec2): deliver flow log records in the format the flow log declares (#4429)
* fix(ec2): deliver flow log records in the format the flow log declares

record took no format argument and emitted all 29 available fields in
alphabetical order every time. Only the header line varied, so a flow log
created with a six field LogFormat wrote a six field header above 29 field
rows, and a reader following that header took the wrong value for every
column.

The field list now reaches record, which resolves a value per token. A field
this emulator carries no value for keeps its column and reads "-", since
dropping it would shift every later value one place left against the header
the caller asked for.

A flow log with no LogFormat delivers the version 2 fields in the documented
order rather than the alphabetised superset. The version a record reports is
now the highest its selected fields belong to, in place of a fixed 5.

* fix(ec2): keep every LogFormat token, whatever its spelling

The token pattern matched lowercase names only, so a format naming ${DSTADDR}
lost that column from the header and every row. Any non-blank token now holds
its column and reads "-" when there is no value for it.

A field outside the version table counts as the highest version that table
defines rather than the lowest. The table is complete through version 5, so an
unlisted field belongs to a later one, and calling it version 2 labelled a
record that plainly was not one.

Row assertions go through a helper that fails on a delivery carrying only a
header, so none of them can pass without seeing a record.
2026-09-25 20:21:34 -04:00
Hector Ventura 0e8f965cb6 fix(core): mint every ARN in the request's partition (#4444)
* fix(core): mint every ARN in the request's partition

The build side of the multi-partition plan. 123 of the 126 gated arn:aws: literals in src/main now go through AwsArnUtils.Arn.of for regional resources, RegionResolver.buildGlobalArn for regionless ones minted under a request, and Arn.global with the region's partition where only a region is in scope, so a resource created in cn-north-1 or us-gov-west-1 carries arn:aws-cn: or arn:aws-us-gov:. CloudFormation's AWS::Partition and AWS::URLSuffix pseudo-parameters follow the stack region instead of a literal aws and amazonaws.com, and the SAM transform emits arn:${AWS::Partition}:... as the real translator does.

Seven literals are escaped with a stated reason: the stub-resource marker, the three Greengrass runtime ids from the Lambda Runtime enum, S3 Control's error text, and the two console client ids. The three still gated (the managed policy catalog, Flink and the RDS proxy validator) belong to later phases.

ResourceExplorer2IntegrationTest holds every listed ARN to its region's partition again; P0 had relaxed it to commercial regions while China-region resources were still minted arn:aws:.

Part of #4272

* fix(s3): evaluate a bucket policy against the bucket's own partition

A bucket policy names its bucket in the partition of the bucket's region. The authorization paths built the resource ARN from the request's partition instead, so with bucket names shared across regions a same-account request signed for cn-north-1 against a us-east-1 bucket was checked against arn:aws-cn:s3:::bucket/key, missed an explicit deny on arn:aws:s3:::bucket/*, and was allowed. The seven S3Service call sites now take the partition from the bucket's region, which also drops their dependency on a RegionResolver that the package-private test constructors leave null.

* fix(iam): match S3 resource ARNs against the bucket's own partition under IAM enforcement

IamEnforcementFilter built every S3 resource ARN through a regionless Arn.of, which always yields arn:aws:. Once AWS::Partition follows the stack region, a bucket created in cn-north-1 gets a policy naming arn:aws-cn:s3:::bucket/*, and under IAM enforcement its statements never matched, so an explicit deny was skipped.

ResourceArnBuilder now mints S3 ARNs in the request region's partition, which is right for a bucket that does not exist yet. ResourcePolicyProvider gains resolveResourceArn, a default no-op, and S3ResourcePolicyProvider re-mints an existing bucket's ARN in the partition of the bucket's region before any identity or resource policy is evaluated. S3Service.bucketPartition is the single rule for both layers and for the CopyObject source and presigned POST ARNs in S3Controller.

S3PartitionBucketPolicyIamEnforcementIntegrationTest runs with IAM enforcement alone, so S3's own policy check cannot deny first: the China-bucket deny fails without this change, and the cross-partition deny on a us-east-1 bucket fails if the re-minting step is skipped.
2026-09-25 20:15:49 -04:00
David 93c7b1f93f feat(glue): start and stop crawls, crawler metrics, listing and schedules (#4427)
A crawler could be defined but never run: StartCrawler answered
InvalidAction and a crawler stayed READY with no LastCrawl. Add
StartCrawler, StopCrawler, GetCrawlerMetrics, ListCrawlers,
BatchGetCrawlers, UpdateCrawlerSchedule, StartCrawlerSchedule and
StopCrawlerSchedule.

Crawls follow the crawler state machine without reading data and are
settled on read, as job runs are;
floci.services.glue.crawler-run-duration-seconds (default 0) can keep a
crawler RUNNING. UpdateCrawler and DeleteCrawler are refused while a
crawl runs, and DeleteCrawler removes the crawl history.

Part of #4380
2026-09-25 18:50:30 -04:00