Commit Graph
2569 Commits
Author SHA1 Message Date
Priamo Germosen 240fd865f0 fix(iam): match IAM's constraint-violation message shape (#4613)
The MaxItems and ServiceNamespaces validation messages added in #4543 did
not read the way IAM's do. AWS leads with the error count, quotes the
offending value, and names only the bound that was actually broken, so a
MaxItems of 1001 says "Member must have value less than or equal to 1000"
and nothing about the minimum.

Both messages now go through the helpers this handler already had for that
shape. tagValidationError builds the scalar form, so it is renamed
validationError now that it serves more than the tag paths, and MaxItems
reports whichever side of the range it fell outside rather than reciting
both. checkListLength builds the list form, which deliberately does not
quote the value, and takes its limit as an argument so ServiceNamespaces
can use it instead of echoing 201 namespaces back in an error message.

The tests asserted only that the response contained "ValidationError",
which is what let the wrong shape through in the first place. They now
assert the whole message, on the parsed Error.Message element rather than
the raw body, since the XML escapes the quotes AWS puts around the value.
2026-09-28 22:02:28 -05:00
Priamo Germosen 26146a3f94 feat(iam): expand wildcard service grants against a vendored namespace catalog (#4544)
GetServiceLastAccessedDetails reports the services an entity can reach, but
a grant that names no namespace could not be expanded: "Action": "*", a
globbed prefix such as s3*, and any NotAction all denote a set no policy
document spells out. A user holding only AdministratorAccess came back with
an empty report. Closes #4487.

The list of namespaces is vendored in aws/iam-service-namespaces.json and
generated by tools/aws/regen_service_namespaces.py from AWS's Service
Reference Information index, whose per-service "service" field is the IAM
namespace itself. botocore is deliberately not the source, even though every
other vendored file here comes from it: a namespace is not any botocore
field, since CloudWatch's endpointPrefix is monitoring and its serviceId is
CloudWatch against an IAM namespace of cloudwatch. A rule over botocore
metadata is wrong for some service, and a wrong namespace is worse than a
missing one because it names something IAM does not have.

That index is a live endpoint rather than a pinned dependency, so unlike
regen_partitions.py a fresh generation is not byte-identical and byte
equality is the wrong gate. What must be guaranteed is that nothing in the
file is invented, which is checked directly: make iam-namespaces-check
validates the file's shape offline, and make iam-namespaces-verify checks
online that every namespace in it still exists upstream, failing on one that
does not. Services AWS has added since the last sync are reported without
failing, since the file being behind makes the report incomplete rather than
wrong.

A namespace a policy names outright is kept whether or not the catalog knows
it, so a catalog trailing an AWS launch still reports an explicitly named
service; only wildcard expansion depends on it being current. A globbed
prefix now expands to the namespaces it matches rather than being treated as
every service and then dropped.
2026-09-28 22:02:13 -05:00
Abhigya b830ade6cd fix(elbv2): scope SetRulePriorities conflicts to the rule's listener (#4507)
* fix(elbv2): scope SetRulePriorities conflicts to the rule's listener

SetRulePriorities rejected a priority held by any rule in the region, so a
rule on one load balancer could not move to a priority used on another. AWS
scopes rule priorities to a listener ("A listener can't have multiple rules
with the same priority"), as CreateRule already did here.

Conflicts are now checked per listener, against that listener's rules that
are not part of the request. Two rules of the same listener given the same
priority in one request now fail with PriorityInUse instead of both being
applied.

* test(elbv2): keep SetRulePriorities compatibility tests in execution order

* fix(elbv2): check SetRulePriorities collisions against the concurrent rule map

The listener index lists are plain ArrayLists that CreateRule and DeleteRule
mutate without a lock, so iterating them could throw
ConcurrentModificationException. Iterate the region's ConcurrentHashMap and
filter by listener instead.
2026-09-28 22:46:06 -04:00
Abhigya e1cc7439f6 fix(elbv2): tunnel WebSocket upgrades to instance and ip targets (#4517)
* fix(elbv2): tunnel WebSocket upgrades to instance and ip targets

The ALB data plane stripped Connection and Upgrade as hop-by-hop headers and
proxied a WebSocket handshake as a plain request, so the target answered it as
a non-upgrade (typically 400) and socket.io clients stayed on long-polling.

Forward the handshake with its upgrade headers, relay the target's 101, then
tunnel bytes both ways until either side closes or the load balancer's
idle_timeout.timeout_seconds passes with no data. A target that refuses the
upgrade has its answer relayed unchanged. Upgrades to Lambda targets are
rejected with 400, as AWS does.

Closes #4516

* fix(elbv2): bracket IPv6 target literals in the proxied Host header

Covers WebSocket upgrades to instance targets as well.
2026-09-28 22:36:42 -04:00
Kenshin Okinaka 673c8838cf refactor(ses): model SES sends as an envelope plus content, like the v2 SDK (#4529)
* refactor(ses): model SES sends as an envelope plus content, like the v2 SDK

The five SES send methods took up to 15 positional parameters, and every
new send field cascaded through all of them and their callers. Sends now
follow the v2 SDK shape: a SendEmailRequest envelope carrying a sealed
EmailContent (Simple, Template, InlineTemplate or Raw), and a
SendBulkEmailRequest for bulk. SesService exposes sendEmail, which
switches on the content, and sendBulkEmail.

The controllers keep their validation, error codes and tenant gates;
each maps its wire input onto the envelope and picks the content
variant. The request always carries the content being sent: rendering
and header sanitizing rebuild it rather than holding a second copy.

No wire behaviour changes.

* refactor(ses): share the recipient join between the request and MIME headers
2026-09-28 21:40:58 -04:00
XuJian 11b762d08b fix(appsync): send VTL Lambda payload to function (#4579)
* fix(appsync): pass JS Lambda request envelope to function

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>

* fix(appsync): send VTL Lambda payload to function

---------

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-28 21:25:53 -04:00
TATSUNO “Taz” Yasuhiro dad5648b7b fix(dynamodb): validate GSI and LSI index names like AWS (#4601)
AWS checks IndexName on CreateTable GSIs and LSIs and on every UpdateTable
GSI Create, Update and Delete. It must be present, match [a-zA-Z0-9_.-]+
and be 3 to 255 characters long. The error names the member path, lists
the pattern error before the length error, and comes before the table
lookup. Floci accepted any name, and a malformed name on Update or Delete
was reported as a missing index.
2026-09-28 21:19:53 -04:00
Vũ Thế Huy 5ae46c2bd3 fix(ssm): support parameter selectors in GetParameter and align LabelParameterVersion with AWS (#4461)
* fix(ssm): support name:version and name:label selectors in GetParameter

- Support name:version and name:label selectors in GetParameter and GetParameters
- Resolve selector against parameter history copies without mutating stored parameters
- Validate labels in LabelParameterVersion per AWS spec (reject numeric and reserved labels)
- Return invalid labels in InvalidLabels response
- Synchronize labelParameterVersion and clone history entries to handle concurrent updates without in-place mutation
- Enforce 10-label maximum limit per parameter version
- Default to latest version only when ParameterVersion is omitted
- Guard against NPE and trailing colons in getParameter selector lookup

Closes #4396

* fix(ssm): enforce label validation constraints in LabelParameterVersion

- Reject empty labels and labels exceeding 100 characters with ValidationException
- Reject empty label lists and lists with more than 10 labels with ValidationException
- Update findSelectedVersion comment to reflect that labels are unique across versions
2026-09-28 21:07:46 -04:00
Vũ Thế Huy b8cae89a2d refactor(glue): extract shared Glue and Redshift role helpers (#4459)
* refactor(glue): move PartitionProjection from athena to glue package

PartitionProjection resolves Glue table partition layout, not Athena-specific
logic — Athena is only its current caller. Moving it into services/glue gives
the upcoming GlueTableResolver (Redshift Spectrum Phase 2) a home for it
without a glue-depends-on-athena layering inversion.

readPath and assertInjectedColumnsFiltered become public (their callers stay
in services/athena, a different package now); enabled/parameter stay
package-private since nothing outside the class uses them.

* refactor(glue): extract GlueTableResolver from GlueViewDdlBuilder

GlueViewDdlBuilder now delegates table-to-read-plan resolution (read function
inference, read expression, Iceberg detection, column projection) to a new
public GlueTableResolver, so Redshift Spectrum's Glue-backed external tables
can reuse the same logic Athena already proved correct.

* refactor(redshift): extract RedshiftRoleAccess from S3CopySimulator

COPY and UNLOAD's IAM role resolution and S3 authorization now live in a
standalone RedshiftRoleAccess, matching the existing ManifestReader
extraction pattern in this package, so Redshift Spectrum's Glue-backed
external schemas (IAM_ROLE-authorized reads) can reuse it instead of
duplicating role-session and policy-evaluation logic. Adds direct coverage
for the enforced-policy-denial path, which only had implicit
enforcement-off coverage before this extraction.

* fix(redshift): follow RedshiftRoleAccess in native init list and partition baseline
2026-09-28 18:51:53 -05:00
Clement 4001556a31 fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string (#4431)
* fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string

CreateUser read passwords only from AuthenticationMode, so a user created
with the top-level Passwords member (aws elasticache create-user --passwords)
was stored as no-password-required. ModifyUser ignored AuthenticationMode.Type,
NoPasswordRequired, AccessString and AppendAccessString, so a user's auth mode
and permissions could not be changed without deleting it.

Both actions now resolve authentication from AuthenticationMode or from the
top-level Passwords and NoPasswordRequired members, and reject contradictory
combinations with InvalidParameterCombination.

* test(elasticache): use explicit response types in the user auth compat test

* ci: re-run checks after a Docker Hub image pull rate limit

The previous run's shard 3 failed on 'toomanyrequests: Data limit exceeded' while pulling images for three ECS and core Docker integration tests. Nothing in this branch touches those paths.
2026-09-28 18:06:53 -05:00
Priamo Germosen 0f79cba0d9 fix(iam): apply the documented MaxItems and ServiceNamespaces limits (#4543)
The last-accessed readers accepted any MaxItems and treated an omitted one
as no limit at all, and ListPoliciesGrantingServiceAccess accepted any
number of service namespaces. The IAM API reference documents all three
bounds, so a client that pages against AWS saw different results here.

GetServiceLastAccessedDetails and GetServiceLastAccessedDetailsWithEntities
both state that the item count "defaults to 100" when MaxItems is omitted,
with a valid range of 1 to 1000. An omitted MaxItems now pages at 100 and
reports IsTruncated with a Marker rather than returning the whole report,
and a value outside the range is a ValidationError instead of being honored.
serviceNamespaceListType allows a maximum of 200 members, which is now
enforced alongside the existing minimum of 1.

The overflow guard on the page arithmetic stays even though the new ceiling
makes a value large enough to overflow unreachable, because the ceiling and
the offset are enforced in different places.
2026-09-28 17:24:48 -05:00
Priamo Germosen 585bad28c2 refactor(docker): share one helper for running a command in a container (#4505)
Ten container managers each carried their own copy of the docker exec
round trip: create the exec, attach a frame callback, wait for it, then
read the exit code. The copies disagreed on what a timeout returns, on
whether an attach-stream error throws, and on how output frames are
decoded.

ContainerExec now owns that round trip. MWAA, Flink, Timestream,
Redshift, RDS, EKS, both EC2 managers and the ECS credentials proxy call
it, and the four identical ExecResult records and three
ContainerExecResult variants give way to ContainerExec.Result. The seven
Docker integration tests that hand-rolled the same exec (EKS IMDS, IRSA,
pod identity, Route 53 and VPC route programming, EC2 volumes, RDS
Postgres) use it as well.

A timeout now returns exit code -1 with the output captured so far and a
"Timed out after Ns" note in stderr. MWAA, Flink and EKS still throw on a
timeout, through Result.throwIfTimedOut. Output is decoded once from the
collected bytes, so a multi-byte character split across frames survives,
and an interrupt keeps the thread's interrupt flag. The two EC2 managers
keep reporting a Docker error as a failed result, so an attach error on
one sshd path still falls through to the next. An interrupt is the
exception in Ec2ContainerManager: it still ends the setup step it hits,
as it did before, instead of being retried on the next sshd path.

The ECS credentials proxy's reachability probe waited on its exec with no
timeout at all. It now gives up after 10 seconds and treats that like any
other failed probe, retrying until its verify budget runs out.
2026-09-28 17:24:38 -05:00
Niels Kootstra 93ec5967fe fix(s3): return NoSuchTagSet from GetBucketTagging on untagged buckets (#4585)
GetBucketTagging returned 200 with an empty TagSet when a bucket had no tags, including after DeleteBucketTagging. AWS returns the NoSuchTagSet error instead. S3 Control ListTagsForResource still reports an empty list.
2026-09-28 16:25:06 -04:00
XuJian fbbbf244af fix(cognito): reject missing SRP challenge session (#4578)
Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-28 14:34:12 -04:00
XuJian 864f79cf31 fix(s3): sign generated presigned URLs with SigV4 (#4373)
* fix(s3): align generated presigned URLs with SigV4 and request region

* fix(s3): refresh presign credentials after storage reset

* fix(s3): retire expired generated presign sessions

* fix(iam): sweep expired sessions by stored key

* fix(s3): scope generated presign credentials

* fix(s3): authorize conditional generated URLs and slash keys

* test(s3): preserve signed URL semantics in tagging and SES regressions

* fix(s3): reject tag injection on scoped generated PUT URLs

* style(s3): alphabetize presigner Java imports

* fix(s3): deny scoped requests without a raw HTTP path

* fix(s3): authorize proxied presigned URLs by signed path

* fix(s3): use signed path for proxied object requests

* style(s3): order presigned URL test imports
2026-09-28 12:21:52 -04:00
Niklas Herder 5ec18c507c fix(dynamodb): reject undefined expression attribute placeholders (#4398)
* fix(dynamodb): reject undefined expression attribute placeholders

PutItem/DeleteItem/UpdateItem ConditionExpression, UpdateItem's own
UpdateExpression, Query KeyConditionExpression, Query/Scan FilterExpression,
and TransactWriteItems' ConditionCheck/Put/Delete/Update ConditionExpression
and Update UpdateExpression accepted a #name or :value placeholder with no
matching ExpressionAttributeNames/Values entry, instead of rejecting it with
AWS's ValidationException. Writes fell through to a false
ConditionalCheckFailedException (or, inside a transaction, a
TransactionCanceledException with a false ConditionalCheckFailed reason),
reads silently evaluated the condition as non-matching (Query) or ignored it
entirely (Scan), and an undefined #name in an UpdateExpression's SET clause
was silently stored as an attribute literally named "#n" instead of being
rejected (standalone UpdateItem and inside a transaction alike). An undefined
#name in KeyConditionExpression additionally surfaced the wrong error, "Query
condition missed key schema element", because attribute resolution silently
left the alias unresolved.

Generalizes the pattern already used for UpdateExpression's undefined :value
check and Query's FilterExpression undefined #name check into a shared
requireDefinedTokens helper, applied to the remaining expression/handler
combinations, and built on the same ordered token scanner extractHashTokens
and extractColonTokens already used. The helper reports whichever undefined
token appears first in the text; in UpdateItem the ConditionExpression check
now runs before the unused-EAN/EAV checks rather than after.
ProjectionExpression's undefined #name check and KeyConditionExpression's
undefined :value check were already correct and are untouched.

* fix(dynamodb): check undefined placeholders before semantic validation

ExpressionEvaluator.validateExpression's semantic checks (contains()'s
distinct-operand rule, begins_with()'s operand type, BETWEEN's bound
ordering) ran before requireDefinedTokens at every call site, so an
undefined #name/:value could surface the wrong error, e.g.
contains(#missing, #missing) reported the distinct-operand error instead
of the undefined name. Verified against amazon/dynamodb-local:3.3.1 that
DynamoDB reports the undefined placeholder first for contains(), begins_with()
type mismatch, and BETWEEN bound ordering, while a syntax error or redundant
parentheses still outrank an undefined placeholder.

Splits validateExpression into validateSyntax (tokenize/parse/redundant-
parentheses, unchanged position) and validateSemantics (the checks above),
and reorders each handler to run requireDefinedTokens between them.
validateExpression itself is untouched and still used as-is by
DynamoDbVectorSearch's SearchConditionExpression.

In UpdateItem, ConditionExpression's semantic check must also outrank the
unused-EAN/EAV checks (#2893), not just requireDefinedTokens: moved
validateSemantics to run immediately after requireDefinedTokens(conditionExpression)
in both the UpdateExpression-present and UpdateExpression-absent branches,
ahead of checkUnusedEan/checkUnusedEav. Verified the same ordering already
held in PutItem, DeleteItem, Query and Scan (their unused checks already ran
after validateSemantics), and that TransactWriteItems has no unused-EAN/EAV
check to conflict with.

Also adds braces to the unbraced conditionals in the token scanner added by
the previous commit, per AGENTS.md.

* fix(dynamodb): keep projection validation after filter semantics

The syntax/semantics split moved FilterExpression's undefined-token and
semantic checks below ProjectionExpression's in Query and Scan, so a
Query/Scan with FilterExpression "contains(a, a)" and an undefined #name in
ProjectionExpression now reports the projection error instead of the filter
one. Verified against amazon/dynamodb-local:3.3.1: FilterExpression's checks
outrank ProjectionExpression's, which in turn outrank
KeyConditionExpression's (unchanged, and already correctly ordered).
2026-09-28 12:13:36 -04:00
TATSUNO “Taz” Yasuhiro e7e49f9125 fix(dynamodb): report a missing GSI on UpdateTable the way AWS does (#4564)
On AWS, deleting or updating a GSI the table does not have fails with
ResourceNotFoundException "Requested resource not found: Index <index>
for table <table>", with the table name even when TableName is an ARN.
Floci used its own message for a delete and a ValidationException for an
update.
2026-09-28 11:03:18 -04:00
XuJian 5e2edcb89b feat(appsync): execute VTL unit resolvers over data sources (#4423)
* feat(appsync): execute VTL unit resolvers over data sources

* fix(appsync): reject unbatched VTL Lambda BatchInvoke

* fix(appsync): normalize VTL Lambda payload and transact RDS statements

* fix(appsync): preserve sequential RDS statement effects

* fix(appsync): send full VTL request document to Lambda
2026-09-28 10:27:46 -04:00
Simone Primarosa a8eedb1fd9 feat(route53resolver): apply resolver rules to DNS resolution (#4538)
* feat(route53resolver): apply resolver rules to DNS resolution

Resolver rules were stored and ignored. The embedded DNS server now consults them
before resolving a name itself, via two CDI SPIs so core.common.dns imports neither
Route 53 Resolver nor EKS: DnsForwardingRuleSource supplies the rules associated with
one VPC, DnsClientVpcSource maps a query's source address to the VPC it came from.

FORWARD rules forward the raw query to their TargetIps, each on its own port, in a
random order with the next target tried when one does not answer. SYSTEM and RECURSIVE
rules carry no targets and hand the query back to Floci, so a SYSTEM rule carves a
subdomain out of a broader FORWARD. Matching is exact-or-subdomain on label boundaries
and the most specific matching rule wins. A rule takes precedence over a private hosted
zone matching the same name, as AWS documents. Floci's own suffixes and ec2.internal
names resolve locally whatever the rules say, as AWS autodefines system rules for its
internal domains. A rule whose targets are all unreachable answers SERVFAIL for that
query only.

Route53ResolverDnsForwardingRules reads the rule and association stores through
Route53ResolverService across account partitions, since the packet path has no caller.
EksClusterManager claims its cluster node container addresses for the cluster's
resourcesVpcConfig.vpcId.

* fix(route53resolver): scope rule DNS lookups to the querying account

AssociateResolverRule stores whatever VPCId the caller names without proving
ownership of it, so joining associations across account partitions by VPC id let
one account redirect another account's cluster DNS by naming its VPC. The DNS
client VPC now carries the account alongside the VPC id, and the rule source
reads only that account's associations.

Rules are fetched by id instead of scanned for, so a query reads only the rules
an association named rather than the whole rule store, and registration warns
when a running cluster's container addresses cannot be determined instead of
leaving its rules silently inert.

Also stop setting the authoritative bit on the SERVFAIL answer for a forwarded
query: Floci is not the authority for a name a rule sends elsewhere.

* style(route53resolver): import Optional instead of qualifying it inline

* fix(route53resolver): scope rule DNS lookups to the querying region

Route 53 Resolver is regional, so a rule created in one region governs nothing in
another, but the DNS path matched on account and VPC alone. A rule created in
eu-west-1 therefore steered a query from a VPC in us-east-1. The DNS client origin
now carries the region, and a rule is only applied when its own region matches.

The stores carry no region in their keys, so a rule's region is read back from the
ARN the service minted for it rather than reshaping the stores. A stored rule with
no parseable ARN has no region to claim and is treated as belonging to the region
asking, which no create path can produce.

Associations are now read as rule ids rather than as nodes, so a query no longer
deep-copies a record per association when all it needs is which rules to look at.

* test(eks): pin the warning when a cluster's addresses cannot be determined

Inspecting the node container can fail, and when it does the cluster gets no VPC
mapping and its queries quietly ignore every associated resolver rule. Nothing
fails, so the warning is the only way a reader finds out, which makes it worth a
test rather than leaving it to inspection.

Levels are compared by severity rather than identity because JBoss LogManager
has its own Level constants, so its WARN is not java.util.logging's WARNING.
2026-09-28 09:44:28 -04:00
David bc15516cc0 feat(glue): create and run workflows (#4471)
Glue had no workflows: CreateWorkflow, StartWorkflowRun and the rest
answered InvalidAction. Add CreateWorkflow, GetWorkflow, ListWorkflows,
BatchGetWorkflows, UpdateWorkflow, DeleteWorkflow, StartWorkflowRun,
StopWorkflowRun, ResumeWorkflowRun, GetWorkflowRun, GetWorkflowRuns,
GetWorkflowRunProperties and PutWorkflowRunProperties, and let triggers
belong to a workflow.

StartWorkflowRun fires the workflow's starting triggers inside a new
run. The workflow's conditional triggers fire only on job runs and
crawls of that run, evaluate AND within it, and start their actions in
it; job runs get --WORKFLOW_NAME and --WORKFLOW_RUN_ID. A run completes
once nothing in it runs and nothing more fires. GetWorkflow and
GetWorkflowRun report the graph of trigger, job and crawler nodes.

Closes #4380
2026-09-28 09:26:50 -04:00
TATSUNO “Taz” Yasuhiro b8b5fcd476 fix(dynamodb): reject an unknown BillingMode (#4554)
* fix(dynamodb): reject an unknown BillingMode

CreateTable, UpdateTable and ImportTable accepted any BillingMode and
treated an unknown one as PROVISIONED. AWS rejects it with a
ValidationException before looking up the table. ImportTable reports the
member as tableCreationParameters.billingMode.

* fix(dynamodb): check an import's BillingMode before its ClientToken

On AWS an ImportTable retry with the same ClientToken and an unknown
BillingMode fails with the BillingMode ValidationException, not with
ImportConflictException. The check now runs before the token lookup.
2026-09-28 07:24:11 -04:00
Niels Kootstra bf47dd7193 perf(logs): filter log events by time before sorting (#4474)
GetLogEvents and FilterLogEvents sorted every stored event in the
stream or group before applying the startTime/endTime (and, for
FilterLogEvents, the filter pattern) window. Apply the cheap per-event
filters first so only the events that survive the window get sorted;
results, ordering, and pagination tokens are unchanged.
2026-09-28 01:04:56 -04:00
Aniket Shukla c7492ce0f4 fix(cloudmap): answer typed DNS records and honor routing policy (#4534)
* fix(cloudmap): answer typed DNS records and honor routing policy

* fix(cloudmap): validate targets and bound DNS UDP responses
2026-09-28 00:43:06 -04:00
TATSUNO “Taz” Yasuhiro c9427b5832 fix(dynamodb): size numbers by base-100 digit pairs (#4530)
* fix(dynamodb): size numbers by base-100 digit pairs

DynamoDB stores a number as base-100 digits paired from the decimal point.
It costs one byte per pair plus one, and one more when negative. Floci
counted the characters of the number text, so items full of numbers hit
the 400 KB limit too early or too late, and capacity was off too.

On AWS, 110 and 0.015 cost 3 bytes, 1100 and 0.0015 cost 2, 3.14159
costs 5 and 1E125 costs 2.

* fix(dynamodb): drop the sign byte at 20 pairs and survive huge exponents

On AWS a negative number of 20 base-100 pairs costs 21 bytes, the same as
a positive one. Below 20 pairs it costs one byte more.

A number whose exponent overflows BigDecimal's scale now falls back to its
text length instead of throwing, and the pair math runs in long.

* fix(dynamodb): brace the number size branch

* fix(dynamodb): charge a number set only for its members

On AWS an NS set costs the sum of its members and nothing per member.
{"NS":["1"]} costs 2 bytes like {"N":"1"}, and ["1","2","3"] costs 6.
2026-09-28 00:33:41 -04:00
Priamo Germosen c26f782ea8 fix(iam): refuse an unsigned management call under enforcement (#4489)
A request carrying no Authorization header returned before any policy check, so with enforcement on an unauthenticated caller reached every emulated API by simply omitting the header.

Refuse one whose wire shape names a management operation: a JSON, CBOR or Query claim exists only for a request carrying X-Amz-Target, an rpcv2 path or an Action parameter. AWS answers a credential-less request with MissingAuthenticationToken at 403, returned here in the encoding the request used.

Operations AWS itself serves without credentials stay allowed, taken from the authtype: none trait in its service models: the Cognito user-pool and identity flows and the two web-identity and SAML AssumeRole calls. The list is keyed by service because GetUser needs no credentials on cognito-idp and requires them on iam.

REST is left alone. This filter also sees the API Gateway execute path, Lambda function URLs, CloudFront serving and the Cognito OIDC endpoints, which are unsigned by design, and a REST claim does not say which service will serve the request.

The CBOR error shape moves into CborErrorResponses, shared with the rpcv2 controller so the two cannot drift into answering the same failure differently.

EksIrsaDockerIntegrationTest set up its IAM fixtures over unsigned Query calls and so began failing: CreateRole is not an operation AWS serves without credentials. Its fixture calls now carry the root stand-in credential, which is what every other test does under enforcement. The AssumeRoleWithWebIdentity calls it actually tests stay unsigned, as AWS serves those without credentials.
2026-09-27 22:59:34 -05:00
Priamo Germosen c55ff5362b fix(iam): hold untag TagKeys to the tag key constraints (#4506)
tagKeyListType members are tagKeyType, so the 1-128 length and the tag
character pattern apply to TagKeys on every untag action, not only to the
keys sent when tagging. extractTagKeys only checked the count, so an untag
with an empty, overlong or malformed key succeeded. The key checks now live
in one helper shared by extractTags and extractTagKeys, and a rejected
untag removes nothing.
2026-09-27 22:59:19 -05:00
Abhigya 52225e2053 fix(ecs): reconcile persisted services at boot (#4501)
* fix(ecs): reconcile persisted services at boot

EcsService is ApplicationScoped, so Quarkus only creates it on the first
ECS request, and creating it is what loads the ECS stores and starts the
reconciler. After a restart every persisted service stayed without tasks,
load balancer targets or Cloud Map instances until something called the
ECS API.

EmulatorLifecycle now calls EcsService.restorePersistedRuntime() after
storage is loaded and the load balancers are restored, the way it already
restores RDS, ElastiCache and ELBv2.

* test(ecs): assert boot starts the ECS reconciler through CDI
2026-09-27 22:28:13 -05:00
Abhigya 2895262064 fix(rds): keep an instance's endpoint port when its restore fails (#4497)
A failed restore released the reserved proxy port and persisted the record
with port 0, so the next boot allocated the lowest free port in iteration
order and renumbered the endpoints: an old DSN then reached a different
database and failed auth. The retry path also dereferenced the nulled
endpoint.

Failed instance and cluster restores now keep their port and endpoint
reserved, as proxies already did. Persisted ports are also reserved for
their owners before any restore allocates, so a record without a port
cannot take one that a later record persisted.
2026-09-27 22:28:03 -05:00
Priamo Germosen 3da68ff505 fix(codeartifact): close the remaining register-vs-reset gap in PerKeyContainerPool (#4447)
Follow-up to #4411, both items raised by hectorvent in that review.

ensureReady checked the pool's reset generation before registering its
new container in the map, not after: a stopAll() landing in the gap
between that check and the registration could still run its own sweep
over the map without finding the container (it was not in the map
yet), then have the registration land afterward with nothing left to
ever stop it, the same leak the generation check was meant to close in
the first place. A second variant let a stopAll() land between the
sweep and the map clear, wiping the entry stopAll() itself never got
the chance to visit.

Registering first and only then comparing the generation, removing and
stopping locally on a mismatch rather than trusting whatever stopAll()
may have already done to the map, closes both: either stopAll()'s own
sweep finds the container because the registration already landed, or
the registration lands after the sweep and the generation check catches
it. stopAndRemove already tolerates a double-stop of the same container
(both its stop and remove calls treat "already gone" as success), so
there's no failure mode where both paths race to clean up the same one.

Also drops VerdaccioSidecarManager's class javadoc reference to the
CodeArtifactService repository-record walk that #4411 removed; it was
describing something that no longer exists.
2026-09-27 22:15:00 -05:00
Priamo Germosen 81e646b86d docs(ecs): document task-role credentials configuration (#4500)
The wiring landed in #4486 but none of the four
FLOCI_SERVICES_ECS_TASK_ROLE_CREDENTIALS_* settings were written down
anywhere, and nothing said the credentials proxy needs a user-defined
Docker network rather than the default bridge.

Adds them to the environment variable reference, the application.yml
example and the ECS service page, the last with a short section on how
the endpoint is reached and the two cases where a task does not get
credentials: one that sets its own, and one under security-group
enforcement.

Also fixes two things the same work left behind in the source. The
cleanupProtectedNetwork javadoc was orphaned when
prepareTaskRoleCredentials was inserted between it and its method, and
two config javadocs still described the wiring and the proxy as
follow-up work.
2026-09-27 22:14:50 -05:00
TATSUNO “Taz” Yasuhiro 4faa2b1354 fix(ec2): instances under security group enforcement no longer terminate at launch (#4510)
* fix(ec2): include the security group helper Dockerfile in the native image

With security group enforcement on and no helper image on the daemon, the native image failed every EC2 launch with "Floci helper Dockerfile is missing". The Dockerfile is read with getResourceAsStream, which the native image only serves for listed resources.

* fix(docker): omit DNS servers for containers that share another container's network

Docker rejects DNS servers together with container:<id> network mode, so an EC2 instance or ECS task under security group enforcement failed to launch whenever Floci ran in a container, where it injects its embedded DNS. The container already uses the resolver of the container whose network it shares, the same reason extra hosts are left out.

* fix(ec2): give the security group helper Floci's DNS and host entries

A workload under enforcement joins its helper's network namespace and uses the helper's resolver and hosts file, where DNS servers and extra hosts on the workload itself are not allowed. The helper had neither, so a workload could not resolve Floci's endpoint hostname when Floci ran in a container.

* chore(config): check that helper Dockerfiles are in the native image

LocallyBuiltHelperImage reads its Dockerfile through a method parameter, which the constant check cannot follow.

* fix(ec2): let workloads reach their DNS servers whatever their security groups allow

Docker's resolver listens on loopback but forwards from the workload's network namespace, so a security group without UDP 53 egress left the workload unable to resolve any name. On AWS, security groups never filter traffic to the VPC resolver. The firewall now always allows port 53 to the helper's DNS servers.

* chore(ec2): keep each security group helper's DNS servers with the helper

Service fields stay final, and a helper no longer takes the DNS servers of the last helper created.

* fix(ec2): read a security group helper's DNS servers from its container

Keeping them in a map leaked an entry for every helper whose task failed before registering, and a helper restored after a restart had none. The rules now take them from the helper's HostConfig, which reconcileAll already inspects.

* fix(ec2): exempt only Floci's DNS from security groups, not the fallback resolvers

On AWS the exemption covers only the Amazon DNS server in the VPC, which Floci's embedded DNS stands in for. A public resolver is ordinary internet traffic that a security group filters, so a group that denies egress now blocks 8.8.8.8 and 8.8.4.4 too.
2026-09-27 20:27:53 -04:00
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