Commit Graph
3500 Commits
Author SHA1 Message Date
Priamo Germosen 6d7d85f0f8 fix(lambda): enforce function policies on cross-account calls (#5476)
Under IAM enforcement, a caller whose own policy allowed lambda:InvokeFunction could invoke
another account's function by ARN even when that function's policy granted nothing, and
RotateSecret could be pointed at another account's function the same way. Three things combined:
there was no resource-policy provider for Lambda, so the call was judged as same-account; the
function name was cut at its first colon, so an ARN was evaluated as function:arn in the caller's
account, where no Allow or Deny written for the function could match; and the invoke followed the
account in the ARN.

- LambdaResourcePolicyProvider supplies a function's policy statements and the account its ARN
  names, also when the function has no policy, so a call to another account's function needs that
  function's policy to allow the caller as well as the caller's own policy. It is keyed on the
  ARN, so RotateSecret's check on its rotation function, made under the secretsmanager scope,
  sees it too.
- ResourceArnBuilder evaluates each call against the function it acts on. An invoke runs in the
  account and Region a full or partial ARN names, as the version or alias it names in the function
  name or in Qualifier, since Lambda authorizes a qualified call against the qualified ARN.
  GetFunction, GetFunctionConfiguration and ListDurableExecutionsByFunction read a qualified full
  ARN in the account it names, so they are evaluated there too, and a read of another account's
  function needs its policy as on AWS. Every other route acts on the caller's own function of that
  name, so it is evaluated against that function, unqualified because not all of their handlers
  act on the qualifier.
- An invoke by partial ARN runs in the account it names, as one by full ARN already did.
- RotateSecret looks its function up where the rotation runs it: in the ARN's account, and as the
  version or alias the ARN names.
2026-10-11 21:47:27 -05:00
TiM 23c6666a51 fix(s3): evaluate identity policies per key in DeleteObjects (#5471)
* fix(s3): evaluate identity policies per key in DeleteObjects

Under IAM enforcement a batch DeleteObjects now honours the caller's
identity policies for every key it names, so a user allowed to delete
under one prefix can no longer empty the rest of the bucket in one
request. As in S3, the request still answers 200 and each denied key
comes back as an AccessDenied error with the message "Access Denied",
while the allowed keys are deleted.

IamEnforcementFilter cannot do this on its own: S3 has no
s3:DeleteObjects action, the keys arrive only in the request body, and
the outcome is per key rather than per request. S3Controller therefore
authorizes each entry through authorizeAdditionalResource before the
existing bucket-policy checks, the way CopyObject authorizes its source:
s3:DeleteObject, or s3:DeleteObjectVersion for an entry naming a
version, plus s3:GetObject for an ETag-conditioned entry, matching the
single-key conditional delete. The credential comes from the header or
the presigned query string, and no resource-policy decision is passed,
so the bucket policy is resolved with the same global condition keys
the filter uses for a single-key delete.

authorizeAdditionalResource now canonicalises the credential scope as
filter() does, so an s3express-signed request finds the S3 bucket
policy instead of none.

* fix(s3): close the remaining DeleteObjects identity-check gaps

A batch DeleteObjects now applies the caller's IAM policies to every key
however the request is signed and whichever service it was signed for,
and a governance-retention bypass now needs the bypass permission from
those policies too.

A presigned request that also sends an empty Authorization header is
evaluated with its query credential. IamEnforcementFilter.filter()
already treats a blank header as absent; the handler passed it through,
found no access key in it and skipped every per-key check.

When an entry is under active GOVERNANCE retention and the request asks
to bypass it, s3:BypassGovernanceRetention is evaluated through the same
per-key IAM path as the delete, with the same "Access Denied" error,
before the existing bucket-policy check. The single-key DeleteObject
path is unchanged.

authorizeAdditionalResource now picks resource-policy providers by the
service of the action being authorized, as filter() picks them by the
route's serving service, instead of by the caller's signing scope. A
request signed for another service, or for the s3express alias, now
sees the bucket policy. The canonicalised signing scope still selects
the error codes for an inactive key or expired session.

S3ResourcePolicyProvider is the only registered ResourcePolicyProvider,
so the other callers of the helper see no change: CopyObject's source
read passes its own resource-policy decision and never resolves
providers, and SecretsManager rotation (lambda:InvokeFunction) and SSM
secret references (secretsmanager:GetSecretValue) find no provider
under either scope. A presigned POST's s3:PutObject check changes only
for a form credential not scoped to s3, which now sees the bucket
policy like any other S3 request.

* fix(s3): check governance bypass for the null version in DeleteObjects

A DeleteObjects entry naming VersionId "null" under active GOVERNANCE
retention now needs s3:BypassGovernanceRetention before the bypass
header lets it through, as an entry naming any other version does.

isGovernanceRetentionActive looked the literal "null" up as a versioned
key, found nothing and reported the entry as unprotected, so the batch
path skipped both bypass checks (IAM and bucket policy). Deletion
treats "null" as the unversioned object at the plain key, the object
written before versioning was enabled. The helper now resolves it the
same way. DeleteObjects is its only caller.

The batch path evaluates identity policies for every key of a request
whose credential IAM knows. An unknown or unreadable credential with S3
request authentication off is handled as an unsigned request, as
filter() handles it; with S3 authentication on, S3 refuses an unknown
key. The comments in IamEnforcementFilter now say that DeleteObjects
reaches authorizeAdditionalResource with a key filter() has not
checked, since filter() returns before its key checks on a route no
action maps.

Tests: the null-version bypass, a mixed batch where only the retained
entry needs the bypass permission, and an inactive key and an expired
session signed for s3express answered with S3's InvalidAccessKeyId and
ExpiredToken rather than the other services' codes.

* test(s3): pin the null-version lookup to the pre-versioning object

A DeleteObjects entry naming VersionId null resolves to the object at the
plain key only when that object has no version id. On a versioning-enabled
bucket whose current version is GOVERNANCE-retained and versioned, a null
entry names a version that does not exist, so it must not demand
s3:BypassGovernanceRetention: S3 reports it deleted and the retained version
stays. The test fails if the version-id filter in isGovernanceRetentionActive
is dropped.

* fix(s3): name the version in each DeleteObjects error

An entry that names a VersionId now reports it in its <Error>, as S3 does,
so a batch naming several versions of one key says which of them failed.
This covers both the per-key authorization errors and the errors from the
delete itself (retention, precondition). An entry naming no version still
reports none.

* test(s3): pin the VersionId on a DeleteObjects error from the delete itself

A retained version deleted without the bypass header is refused by the
retention, not the authorization check, and that error names the version too.

* test(s3): create DeleteObjects test users through EnforcementFixtures

The two DeleteObjects enforcement classes carried their own copies of the
createUser and auth helpers that several S3 and IAM enforcement tests already
repeat. EnforcementFixtures now provides both: createUser registers removeUser
with PartitionCleanup before it creates the user, so the users and access keys
these classes make no longer outlive them in the shared application.
2026-10-11 22:18:53 -04:00
Nazimuddin Tajuddin Basha da063a82f8 fix(ec2): apply EBS encryption by default to new volumes and root volumes (#5371)
* fix(ec2): apply EBS encryption by default to new volumes and root volumes

EnableEbsEncryptionByDefault stored the flag but nothing on the volume
creation path read it, so CreateVolume and the RunInstances root volume
came back Encrypted=false even with the default on.

CreateVolume now encrypts when the region default is on, and an explicit
Encrypted=false cannot opt out, as on AWS. The RunInstances root volume
follows the same rule. The setting is per region.

Fixes #5370

* test(ec2): use an explicit RequestSpecification type instead of var

* refactor(ec2): take Ec2EbsEncryptionService on the CDI constructor

Constructor injection per AGENTS.md: Ec2EbsEncryptionService joins the
other CDI-only dependencies on Ec2Service's @Inject constructor instead
of being a field. The test uses a static import for assertEquals in
place of the private wrapper.
2026-10-11 22:13:26 -04:00
David Phillips eb3c14d414 fix(rds): reject malformed event subscription flags (#5481) 2026-10-11 20:44:26 -04:00
Kenshin Okinaka a96cc04fab fix(ses): reject non-array v2 reply-to and bulk destination members (#5477)
ReplyToAddresses in SendEmail and SendBulkEmail, and the To/Cc/Bcc of
each SendBulkEmail entry, read a value of the wrong JSON type as an empty
list. They are rejected with SerializationException, as the SendEmail
Destination members already are.
2026-10-11 20:38:55 -04:00
David Phillips 1e92b7e17b fix(rds): reject malformed cluster snapshot copy flags (#5472) 2026-10-11 19:44:08 -04:00
Mario Toffia 1a0afce7ec feat(cognito): serve the OAuth token revocation endpoint (#4936)
POST /cognito-idp/oauth2/revoke, and /oauth2/revoke on a custom domain,
revoke a refresh token through RevokeToken and answer as AWS's revocation
endpoint does, as measured: 200 with no body for a revoked, already
revoked or invalid token; 400 invalid_request for a missing token or a
client with revocation disabled; 400 unsupported_token_type for an access
or ID token; and 401 invalid_client with WWW-Authenticate: Basic for
missing or bad client credentials, a client of another pool, or a token
issued to another client. Unlike the token endpoint, a client secret is
taken only from the Basic header.

On a custom domain, the Cognito filter now answers a path under /oauth2/
that Cognito does not serve with AWS's JSON 404, and a served path called
with another method with an empty 405, so neither reaches S3 as a key of a
bucket named cognito-idp.
2026-10-11 19:38:32 -04:00
Daniël van Ziel 20bc835b6f fix(ec2): reject subnet CIDRs outside the VPC address space (#5461)
* fix(ec2): reject subnet CIDRs outside the VPC address space

* fix(ec2): serialize CIDR edits with subnet validation

* test(ec2): request native IPv6 subnets in endpoint fixtures
2026-10-11 18:52:30 -04:00
Matheus Oliveira 9698c216c5 fix(s3): limit CORS credentials header to S3-routed requests (#5375)
Add S3SignatureFilterScope.routedToS3 check to S3CorsFilter so
Access-Control-Allow-Credentials is only applied to requests routed
to S3Controller, not to other services like API Gateway's
/execute-api/ paths.

Add regression tests for:
- non-S3 routes with matching bucket names (API Gateway /execute-api/... paths)
- S3 bucket named 'execute-api' still receives correct CORS headers

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-11 18:47:28 -04:00
Bharat Kaurav a8374ee2ad fix(ec2): allocate endpoint IPv4 addresses within the subnet prefix (#5385)
* fix(ec2): allocate endpoint IPv4 addresses within the subnet prefix

Interface endpoint ENIs kept the subnet CIDR's first three octets and
picked a host of 200..249 from the endpoint id, ignoring the prefix
length. Two /25s inside one /24 got the same address, and the lower one
landed outside its own subnet; smaller subnets could also get reserved
or out-of-range addresses.

Derive the address from the subnet's parsed network and prefix: only
offsets AWS lets a resource hold (skipping the first four and the last
address) are candidates, the preferred one stays 200..249 for blocks of
256 addresses or more and moves to the top of the usable range for
smaller ones, and the range is probed in subnet order past addresses the
endpoint already holds (pinned ones first). Interface endpoints are
refused with InsufficientFreeAddressesInSubnet in a subnet with no
assignable address.

Fixes #5384

* fix(ec2): keep endpoint reads working for undersized subnets and avoid instance IP collisions

Deriving an interface endpoint's address threw InsufficientFreeAddressesInSubnet
when its subnet had no usable address, which an endpoint stored before
CreateVpcEndpoint refused such subnets can still hit. The derivation runs on
every read, so one such endpoint broke DescribeNetworkInterfaces for the whole
region. A subnet with nothing left for the interface now degrades it to the
synthetic fallback address instead; create and modify still refuse new ones.

Endpoint interfaces are derived rather than stored, so the instance allocator
never saw them and, in a /28, both could land on the same address. The
derivation now also skips addresses persisted ENIs, instances and NAT gateways
hold in the subnet (the allocator's own in-use scan), and the allocator treats
derived endpoint addresses as taken. The derivation reads only persisted state,
so the two cannot recurse, and the regional enumeration scans each subnet once.
2026-10-11 18:36:46 -04:00
David Phillips b86268e459 fix(ec2): preserve original Spot instance user data (#5468)
* fix(ec2): preserve original Spot instance user data

* fix(ec2): omit whitespace-only Spot user data

* docs(ec2): clarify Spot user-data encoding

* refactor(ec2): simplify Spot user-data handling
2026-10-11 18:27:48 -04:00
David Phillips 4fd8df2b00 fix(rds): reject malformed parameter reset flags (#5454) 2026-10-11 16:32:15 -04:00
Mario Toffia 8c61aa441d fix(cloudformation): report CREATE events for a resource an update adds (#4932)
A logical id the stack did not hold before an UpdateStack is created, so AWS
reports CREATE_IN_PROGRESS and CREATE_COMPLETE (or CREATE_FAILED) for it and
DescribeStackResource shows CREATE_COMPLETE. Floci used the stack-wide update
flag and reported UPDATE_* instead. The resource loop now decides per resource
from whether the stack held it; stack-level statuses and the rollback of an
added resource are unchanged.
2026-10-11 15:12:12 -04:00
Sam Fakhreddine e28c58cc8a fix(lambda): keep every AddPermission condition and store account principals as root ARNs (#5123)
AddPermission kept only one condition and stored an account principal as
the bare ID. It now writes every condition member in one statement, laid
out the way AWS writes it: SourceArn under ArnLike, SourceAccount,
FunctionUrlAuthType, PrincipalOrgID and EventSourceToken under
StringEquals, and InvokedViaFunctionUrl under Bool as the string "true".

A 12-digit account principal is stored as that account's root ARN in the
function's partition, and an ARN is recognised before the dot test, so an
IAM role, user or session name with a dot is no longer taken for a service.

The condition members are checked against the model's enum and patterns
before the function is looked up, and AWS::Lambda::Permission passes all
of them through from a template.

Fixes #4627
2026-10-11 15:10:53 -04:00
Aymen JAMAAOUI 8deac0a424 fix(cloudfront): reject a function runtime that CloudFront does not support (#5445)
Closes #5425
2026-10-11 14:52:01 -04:00
Niels Kootstra d6f93abb18 fix(eventbridge): stop a scheduled rule's timer when its rule is gone (#5462)
* fix(eventbridge): stop a scheduled rule's timer when its rule is gone

* fix(eventbridge): stop only the timer whose tick found its rule gone
2026-10-11 14:45:14 -04:00
Anders Wasen bfa9c2fbcc feat(cloudformation): provision Application Auto Scaling targets and policies (#5407)
* feat(cloudformation): provision Application Auto Scaling targets and policies

AWS::ApplicationAutoScaling::ScalableTarget and ::ScalingPolicy had no
provisioner, so a template that scales an ECS service failed on those two
resources although the Application Auto Scaling service behind them, including
the ECS capacity adjuster, was already there. This wires the two together.

A scalable target has no name of its own: it is keyed by the triple of service
namespace, resource id and scalable dimension, and CloudFormation's Ref is those
three joined by a pipe. That composite is the physical id, which is also what a
policy's ScalingTargetId carries when a template points one at the other with
Ref, so the provisioner splits it back into the triple. A policy's Ref is its
ARN rather than its name, so deleting one resolves the ARN through
findPolicyByArn to recover the name and triple the service deletes by.

Because the target's id is derived from the triple, changing any part of it
replaces the target rather than updating it, so both types go through
ReplacementCleanup to deregister what they displaced. Deletes tolerate only
ObjectNotFoundException through CfnDeletes.safeDelete: a target takes its own
policies with it, so a stack teardown reaches an already-deleted policy by
ordinary ordering, while any other failure still surfaces as DELETE_FAILED.

The properties each schema marks required are enforced rather than defaulted.
MinCapacity and MaxCapacity on a target, and PolicyName and PolicyType on a
policy, would otherwise register a target that never scales or accept a template
CloudFormation itself rejects.

The two scaling configuration blocks are parsed by the same code the
PutScalingPolicy API path uses, extracted to ScalingConfigurationParser, since
CloudFormation spells their members exactly as the API does. One parser means a
template and an API call cannot disagree about what a policy means.

ScheduledActions on a target is logged rather than dropped silently: Floci does
not run scheduled scaling, and a template that scales on a clock should not look
fully provisioned when nothing is scheduled.

* fix(cloudformation): resolve intrinsics inside the scaling configuration blocks

Review on #5407: the two scaling configuration blocks and SuspendedState reached
the parser as raw template JSON, so an intrinsic inside one was never resolved.
That is worse than it sounds, because an intrinsic is still a non-null node:
hasNonNull passes and the value is read with asDouble, asText or asBoolean,
which answer 0, "" and false. A policy written as TargetValue: !Ref TargetCpu
registered as a policy targeting 0 percent rather than failing, a ResourceLabel
built with Fn::Join arrived empty, and a flag behind Fn::If read false.

Each block now goes through ctx.engine().resolveNode first, which is what
AutoScalingScalingPolicyCfnProvisioner already does with its own block. Only
nested objects were affected: the top-level properties were already read through
ctx.resolveOptional, which resolves.

A target's Tags were dropped as well, passed to the service as an empty map
rather than read with ctx.resolveTags.

ScheduledActions now carries a note in the generated resource-type table rather
than only a warning in the log, so the gap is visible before someone wonders why
their clock-based scaling never fires.

* test(cloudformation): make the SuspendedState intrinsic test fail without its fix

Review on #5407: anIntrinsicInsideSuspendedStateIsResolvedToo passed against the
previous commit too. REFS had no Suspend entry, so the flag resolved to an empty
string and read false either way, and assertNotNull held regardless because the
raw block was already an object. The test pinned nothing.

REFS now maps Suspend to true and the assertion is on
isDynamicScalingInSuspended(), so it fails with expected: <true> but was:
<false> when SuspendedState is read without resolveNode. The redundant copy of
the properties node is gone.
2026-10-11 12:19:25 -04:00
Kenshin Okinaka 3ad1a76507 fix(ses): take v2 Raw send recipients from the MIME headers (#5442)
* fix(ses): take v2 Raw send recipients from the MIME headers

A v2 SendEmail with Content.Raw and no Destination was rejected in the
controller. AWS reads the recipients from the To/Cc/Bcc headers instead,
and when there are none it answers "Missing required header 'To'."
(BadRequestException on v2, InvalidParameterValue on v1 SendRawEmail).

* fix(ses): report a recipient-less Raw send between the tenant checks

AWS checks that the tenant exists, then answers "Missing required header
'To'." for a v2 Raw send with no recipients, ahead of the tenant
association gate. The tenant gate now follows that order. Adds tests for
an empty Destination and for a malformed To header recipient.

* fix(ses): reject a non-array v2 SendEmail destination member

A present ToAddresses/CcAddresses/BccAddresses of the wrong JSON type was
read as an omitted destination, which a Raw send now fills from the MIME
headers. It is rejected with SerializationException instead.

* refactor(ses): use SendEmailRequest.hasRecipients for Raw sends

The Raw tenant gate and sendRawEmail each spelled out the explicit
recipient check; both now ask the request.

* fix(ses): syntax-check the Cc and Bcc headers of a Raw send

AWS rejects a malformed address in a raw message's Cc or Bcc header with
the same messages as the To header, and a Raw send without a Destination
now takes its recipients from those headers.

* docs(ses): reword the raw header note on SesAddressSyntax
2026-10-11 11:56:32 -04:00
David Phillips af3672ed0c fix(rds): reject malformed proxy boolean flags (#5453) 2026-10-11 11:42:59 -04:00
Priamo Germosen 09a2d5c005 fix(s3): answer GetObject Range requests as S3 does (#5436)
GetObject answered 416 InvalidRange to any Range that was not one valid
byte range: several ranges, a last byte before the first, or a malformed
value such as bytes=-, bytes=-1- or bytes=0--1. S3 answers those as a
GetObject without a Range, with the whole object and 200, as
LocalStack's AWS-validated capture of GetObject over a dozen ranges
(test_get_object_range) records it. Only a range that starts past the
end of the object, or bytes=-0, gets 416. HeadObject and a CloudFront S3
origin already answered them with the whole object.

Since every caller now treats a Range that is not one valid range as no
Range at all, ByteRange.resolve reports it as WHOLE, and the separate
INVALID outcome is gone.

The same capture shows a 206 for a range covering the whole object
(bytes=-15 and bytes=0-100 of 10 bytes) carrying the object's checksum,
which Floci left out of every ranged response. The User Guide's
"Checking object integrity" has GetObject and HeadObject return a part's
checksum for "a part number or byte range that aligns with a single
part", and an object stored in one request, or completed from one part,
is that part. Such a range now gets the stored checksum, from GetObject
and HeadObject, when the request asks for checksums and the checksum is
a full-object one. A composite checksum is not that of any one part, nor
is a checksum of an object of several parts, so their ranges still get
none.
2026-10-11 09:13:03 -05:00
Priamo Germosen 013a9214b5 fix(s3): answer an expired session with ExpiredToken when verifying signatures (#5435)
When S3 verified a signature, it answered a request signed with temporary
credentials past their expiry as if the key did not exist: 403
InvalidAccessKeyId for a header-signed request, and 403
SignatureDoesNotMatch for a presigned POST and, under
validate-signatures alone, for a presigned URL. S3's error list has 400
ExpiredToken, "The provided token has expired.", for an expired token,
and IAM enforcement already answers S3 with it.

The secret-key lookup finds nothing for an expired session, so when it
comes back empty the three placements (header, presigned URL, presigned
POST) now ask IamService whether the key and token belong to a session
that has expired on its clock and is still stored, and answer 400
ExpiredToken if so. The token has to match. Sent with another token or
none, an expired session is still answered as a key that is not
registered, so a caller that does not hold the credential learns nothing
about it. Once Floci has removed an expired session it no longer knows
the key, as with enforcement.

IamServiceTest moves a session past its expiry and checks that the new
lookup answers only to the session's own token, and the boundary test
now holds it to the same instant as the other lookups.
S3ValidateSignaturesIntegrationTest signs with Sign-In credentials
through a header, a presigned URL and a presigned POST: each is accepted
until the clock passes their expiry, then answered 400 ExpiredToken. An
expired session sent with another token still gets InvalidAccessKeyId.
Each placement's test fails without its part of the change, and the
token tests fail when the token is not checked. S3RequestSigner can now
write a presigned URL's query string, so the presigned URL test signs
the way an SDK presigner does.
2026-10-11 09:12:52 -05:00
Priamo Germosen 7fa1a506c7 fix(codeartifact): escape the namespace/package boundary in storage keys (#5408)
packageKey and packageVersionKey joined namespace and package name with a
plain "::", but namespace/package tokens only reject '#', '/', and
whitespace, so ':' is legal in either. Namespace "a::b" + package "c" and
namespace "a" + package "b::c" are two different, independently valid
packages that produced the identical storage key, letting one's origin
configuration or published version answer for the other's.

Escapes ':' and '\' in the namespace/package/version segments before they
go into the key, using '#' as the escape introducer rather than '\'
itself. '#' is one of the three characters namespace/package/version can
never legally contain (AWS's own PackageName/PackageNamespace wire
pattern forbids it, same as Floci's own validation), so an escaped
segment can never equal a pre-existing raw key that happened to contain a
literal backslash, closing the same cross-contamination risk at the
old/new boundary that escaping with '\' as the introducer would have
reopened there. For any package whose namespace, name, or version never
contains a backslash or colon, the overwhelming majority, the escaped
segment is identical to the raw one, so this produces the exact same key
as before: no migration of already-persisted data is needed for that
common case.

Follow-up from the PutPackageOriginConfiguration review on #5381.
2026-10-11 09:12:41 -05:00
Priamo Germosen d884d55c26 fix(iam): evaluate every IAM action against the resource it acts on (#5404)
Under enforcement, almost every IAM action reached the policy evaluator with
* as its resource, because ResourceArnBuilder named only the server-certificate
operations and everything else fell through to the wildcard. A statement naming
an IAM resource was therefore ignored, and wrongly in both directions, because
the evaluator globs the statement's pattern against the request's resource and
a resource of * is matched as that literal string. So a Deny on
arn:aws:iam::000000000000:user/bob did not stop DeleteUser for bob, while an
Allow scoped to that same user did not permit DeleteUser on anyone at all: a
least-privilege policy naming the resource it meant to grant refused the call.
Measured both ways by reverting this resolver to the wildcard, which turns the
permitted call in aResourceScopedAllowGrantsThatUserOnly into a 403 and the
refused call in aDenyNamingOneUserLeavesTheOthersAlone into a 200. Nothing
failed and nothing warned, which is the dangerous shape for an emulator people
test policies against.

The resource type each action is evaluated against now comes from AWS's own
authorization metadata for IAM, action by action. That is not the parameter an
action happens to take: AddUserToGroup and RemoveUserFromGroup are evaluated
against the group, AddRoleToInstanceProfile and RemoveRoleFromInstanceProfile
against the instance profile, and EnableMFADevice, DeactivateMFADevice and
ResyncMFADevice against the user rather than the device they name. Mapping those
from the request's parameters would have scoped them to the wrong resource and
let a deny on the right one pass.

An action acting on a resource that exists is checked against that resource's
stored ARN. The reference gives the formats as user/${UserNameWithPath},
group/${GroupNameWithPath} and so on, so the path is part of the ARN a policy
names, and only the store knows it; the stored ARN also carries the partition
the resource was created in, which re-minting from the caller's signing region
would get wrong. A create has nothing stored, so its ARN is minted from the
request's own Path: reading a stored path there would authorize a create into
/team/ against the root path.

A policy, MFA device, SAML provider, OIDC provider or principal is named by an
ARN the request already carries, so that is passed through rather than rebuilt
from parts. Only an ARN is: a hardware MFA device's SerialNumber is a bare
serial, and naming the request after it would produce a resource no policy could
be written against.

That table is read before the one keyed by resource type, so an action in both
would silently take its ARN parameter and the mistake would look like a resource
that never matches rather than like a bug. An attach is the case that makes it
worth pinning down: it carries both a user and a policy ARN, and the reference
gives it the user alone, so it stays out of that table and
iamNamesTheUserRatherThanThePolicyOnAnAttach is what holds it there.

UpdateUser and UpdateGroup join UpdateServerCertificate in naming both the old
resource and the one the request would produce. Both are documented, which the
certificate case was not: UpdateUser's reference says the requester "must have
appropriate permissions on both the source object and the target object", and
UpdateGroup's that a principal allowed to update the old group but not the new
one has the update fail.

Two actions name their role indirectly and are derived rather than looked up.
CreateServiceLinkedRole does not name the role it creates, so the check reads
the same ServiceLinkedRoles table the create reads and cannot name a different
role. GetServiceLinkedRoleDeletionStatus carries only a DeletionTaskId, and its
reference publishes that identifier's format as
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>, which is
the role's own path and name with a prefix in front and a uuid behind; the role
is already deleted by the time the status is asked for, so there is no stored ARN
left to read either way. The /aws-service-role/ path moved to that class, so there is one copy of
it rather than a second in the builder. GetAccessKeyLastUsed names only a key,
and is evaluated against a user: the User Guide's own iam:*AccessKey* example
scopes exactly that set to user/${aws:username}, so the owner is resolved from
the key.

That covers all 130 of the IAM actions this emulator dispatches that AWS gives a
resource type, out of 164 in total. The remaining 34 have no resource type in the
reference, such as ListUsers, GetAccountSummary and SimulateCustomPolicy, so *
is the right answer for them. An action that names its target only by defaulting
to the calling user, such as GetUser or ChangePassword with no UserName, is
resolved from the credential instead, which the last paragraph here sets out.

Nine enforcement tests drive the whole path rather than the ARN the builder
returns, since the defect was invisible: a scoped statement was ignored, not
rejected. They cover a deny that must bind to one user and leave another alone,
the stored path being part of the ARN, the group and the instance profile being
the resource where two entities are named, a managed policy named by ARN, a
create authorized against the path it asks for, a rename refused on its
destination alone, and a scoped Allow granting one user only. Reverting the
mapping to the wildcard fails all nine.

The map is vendored rather than written out here, because a hand-written copy of
AWS's metadata is exactly what tools/aws exists to prevent.
regen_iam_action_resources.py generates src/main/resources/aws/iam-action-resources.json
from the same reference, 190 actions with the resource types each is authorized
against plus the ARN format of all 15 resource types, and it gates the file the
way regen_service_namespaces.py gates the namespace list: --check offline for
shape, --verify online against AWS. A type the file claims and AWS does not fails,
since that would authorize against a resource AWS does not use, which is the one
outcome worse than the wildcard. A type or an action AWS has added is reported
without failing, because being behind leaves that action on * and failing there
would break this build for someone else's launch. make
iam-action-resources-check runs per pull request beside the namespace check, and
make iam-action-resources-verify weekly in the drift workflow. Its unit tests need
no step of their own: make aws-data-test in that same job already runs every
generator's.

So no list of actions is written down here. What stays in code is the half that is
Floci's rather than AWS's: the parameter each resource type arrives in, the nine
creates and the name each spells, the actions whose request carries an ARN, the
three resolved from something other than a name, and the three resource types
that belong only to actions the handler does not dispatch. IamActionResourcesTest
checks the code against the data: every resource type AWS uses must be resolved
or declared unresolved, every create must have exactly one type to mint, and
every minted prefix must match the ARN format AWS publishes for that type. A
regeneration that brings in a new resource type then fails a test naming the
type, rather than quietly putting that action back on *, which is the permissive
answer and a silent one. The create check reads the resolver's own map rather
than restating it, so a create added there is checked too, and the minting falls
back to the wildcard instead of indexing an empty list: a create AWS authorizes
against no single type has no ARN to build, and a request should not fail on
what is a defect in this class.

The reason each declared-unresolved type gives is a claim about the handler, not
about the builder, so nothing inside the builder can check it, and getting it
wrong is silent and fail-open: dispatching such an action without teaching the
resolver its type leaves it evaluated against *, which is the gap this closes.
UnresolvedResourceTypesIntegrationTest therefore sends every action carrying one
of those types and holds it to answering UnsupportedOperation, naming the action
and what to do if it no longer does. No other vendored-data loader validates at class init
either, so the checks read the data the way AwsPartitions and
AwsServiceNamespaces do: parse, and let the gate and the tests have the opinion.

The nineteen user actions whose UserName the model marks optional act on the
user who signed the request, so that user is the resource they resolve to. The
access key id in the credential names the identity, which is the same lookup
GetAccessKeyLastUsed already makes on a key passed as a parameter, and the
stored ARN carries the path and partition as everywhere else here. The wildcard
still stands when the signer is not an IAM user, an account's root stand-in and
a session credential having no user record to name.

What stays at the wildcard is what AWS gives no resource type, 34 of the 164.

Closes #4979

The online gate verifies the ARN formats as well as the action mapping. A format
drifts invisibly otherwise: the offline check only asks whether it still looks
like an IAM ARN, and a changed one does, while the minting reads that string to
place the resource type. So a right-looking file could build a wrong ARN.

The resource types this class covers are worked out from its own tables rather
than restated in the test, so a type cannot be waved through by adding it to a
list in the test file. That is the check the earlier startup guard made.

The three actions whose resource the request carries in some other form hold
their own resolver, rather than being listed in one place and routed by name in
another. A list cannot then say an action is handled while the dispatch has
nothing for it, since adding a key means supplying the resolver that goes with
it.

The enforcement suite removes what it creates. The emulator is shared, so a user,
group, role, profile, policy or provider left behind turns up in the next class
to list one, and the shared fixture helper grew the prerequisites IAM enforces
before a delete: group memberships and attached policies for a user, inline and
managed policies for a role and a group. A rename leaves its destination name
behind rather than the name that was created, and the create test goes through
the enforced path, so both register their own removal.

The drift workflow stays one check, and make iam-data-verify is what keeps that
honest. Two sequential steps stop at the first failure: while the namespace list
was stale, the action resource check this change adds never ran at all, so the
gate arrived unexercised in CI. The target runs both regardless of the first
result and then fails, naming the file that drifted rather than leaving a reader
to guess from one message. The workflow file is renamed to match what it covers,
and the IAM targets it uses join .PHONY, which they should have done when they
were added.

That namespace check was red because AWS retired evidently and iotevents, and
the vendored list still claimed both. Regenerating it drops those two, picks up
end-user-messaging and startups, and leaves the count at 456. A retired
namespace only narrows wildcard expansion; a policy naming one literally is
still reported, since a namespace written out is kept whether or not the catalog
knows it.
2026-10-11 09:12:29 -05:00
Mario Toffia 9a7ec1c9d0 fix(dynamodb): mark time-to-live deletions on the stream as AWS does (#4930)
AWS writes a TTL deletion to the table's stream as a REMOVE record whose
userIdentity names the DynamoDB service. A DeleteItem removal has none.
The member names depend on where the record is read:

- The DynamoDB Streams API (GetRecords) capitalises them, as the SDK's
  Identity shape expects:
  {"PrincipalId": "dynamodb.amazonaws.com", "Type": "Service"}.
- The Lambda and EventBridge Pipes event record and the Kinesis Data
  Streams destination payload use lowercase names,
  {"type": "Service", "principalId": "dynamodb.amazonaws.com"}, the
  shape the developer guide's TTL filter pattern matches.

With the DynamoDB Local engine, Floci passed Local's record through as
is: eventName UNKNOWN_TO_SDK_VERSION and no userIdentity.
DynamoDbLocalBackend now rewrites such records in a successful Streams
GetRecords reply to REMOVE with the Streams API identity, the one place
the public API, the Lambda poller, Pipes and the Redshift zero-ETL
consumer all read through.

The native engine wrote REMOVE but no identity, so a TTL deletion could
not be told from a DeleteItem. The sweep now marks its stream records
(a new in-memory DynamoDbStreamRecord flag) and its Kinesis CDC records.
GetRecords writes the Streams API identity, and the Kinesis record the
lowercase one.

The Lambda event source mapping poller and the Pipes poller rename the
Streams API identity to the event record shape before filtering and
delivery. DynamoDbTtlIdentity.Shape holds the member names of every
output. DeleteItem removals are unchanged.
2026-10-11 09:42:23 -04:00
Aniket Shukla 04621d8444 fix(apigatewayv2): honor payload format 1.0 (#5338)
* fix(apigatewayv2): honor payload format 1.0

* fix(apigatewayv2): preserve v1 stage variables

* fix(apigatewayv2): preserve v1 authorization header

* docs(apigateway): document v1 IAM identity context
2026-10-11 09:10:07 -04:00
David Phillips 80e8b7465d fix(ec2): preserve endpoint IP types across updates and templates (#5438)
* fix(ec2): preserve endpoint IP types across updates and templates

* fix(ec2): honor omitted endpoint address types in templates
2026-10-11 09:06:25 -04:00
David Phillips f4bce30269 fix(ec2): preserve original user-data bytes in instance metadata (#5437)
* fix(ec2): preserve original user-data bytes in instance metadata

* fix(ec2): recover malformed saved user data
2026-10-11 09:03:49 -04:00
Vũ Thế Huy bac2c7cbf9 feat(elasticache): add serverless cache APIs (#5366)
* feat(elasticache): add serverless cache APIs

Add CreateServerlessCache, DescribeServerlessCaches, ModifyServerlessCache and DeleteServerlessCache over the Query protocol. Each cache is backed by a hidden cluster that the ordinary cluster APIs do not list, with its own user-group authentication path in the proxy.

* fix(elasticache): sua loi container rollback, validation tag, leak log stream va npipe hang

- Thu hoi container va storage khi tao Memcached provisioning that bai
- Format thong bao loi deleteCacheCluster chua cluster id
- Validate tag key trong CreateServerlessCache khi co tag value
- Chuan hoa case-insensitive cho userGroupId va region key cho nhom attachment
- Giai phong dung logStream khi stop container trong ElastiCache va Memcached container manager
- Tat validateAfterInactivity tren npipe trong FlociDockerHttpClient de tranh deadlock tren Windows

* fix(elasticache): release serverless backing on reset and make delete and list tolerant

- release backing clusters and user group attachments in clear()
- let DeleteServerlessCache be retried after the backing cluster is already gone
- keep DescribeServerlessCaches working when one cache has lost its backing
- drop the unused replaceTags and document that tags are create-only

* fix(core): drop the named-pipe stale-connection change, #5400 makes it
2026-10-11 08:53:07 -04:00
David PhillipsandJason van Zyl 47d1e10e5c fix(ec2): preserve VPC endpoint IP address types (#5427)
* fix(ec2): preserve SDK endpoint compatibility

Return endpoint states that AWS SDK clients recognize and preserve the
requested address family, so endpoint create and describe responses
round-trip correctly. Keep documented state-filter values working.

* fix(ec2): preserve saved endpoint states and reject invalid IP types

* fix(ec2): reject unsupported endpoint IP types safely

* fix(ec2): retain endpoint states and address-type metadata

---------

Co-authored-by: Jason van Zyl <jason@vanzyl.ca>
2026-10-11 00:34:40 -04:00
David Phillips ad1fbbc9b9 fix(rds): preserve snapshot partitions in custom regions (#5428)
* fix(rds): preserve snapshot partitions in custom regions

* fix(rds): reject relabeled cross-partition snapshot sources
2026-10-11 00:28:49 -04:00
Hector Ventura 98100054a8 feat(core): make the Docker call timeout configurable (#5431)
* feat(core): make the Docker call timeout configurable

Ordinary Docker calls failed after a hard-coded five minutes without a
response. floci.docker.api-timeout-seconds (FLOCI_DOCKER_API_TIMEOUT_SECONDS)
now sets it for both pools, defaulting to 300 so nothing changes by
default; a shorter value bounds how long a hung daemon can hold a request.
Like the connection request timeout, it must be at least 1, because
httpclient5 reads 0 as no limit. Long-lived streams (container waits, exec
and attach output, followed logs, streamed stats, events, image pulls and
builds) stay exempt.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* docs(core): say the Docker call timeout applies to each attempt

The control-plane pool retries a request that is safe to repeat up to six
times, and a response timeout is one of the failures it retries. The docs,
the config Javadoc and the application.yml comment said the setting bounds
a request; it bounds each attempt, so a silent daemon can hold a replayable
request for about six times the limit, plus backoff.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-11 00:17:11 -04:00
Aymen JAMAAOUI 61fe304619 feat(cloudformation): provision CloudFront public keys, key groups and functions (#5390)
* fix(cloudfront): reject CreateFunction when the name already exists

* feat(cloudformation): provision CloudFront public keys, key groups and functions

* fix(cloudformation): validate CloudFront function properties and always drop its tags on delete

* fix(cloudformation): require the CloudFront function comment and reuse resolveOptional
2026-10-11 00:16:51 -04:00
Hector Ventura cce4b5f6c0 chore(core): fail fast when an ARN is minted with a blank region (#5430)
* chore(core): fail fast when an ARN is minted with a blank region

Arn.of derives the partition from the region, so a blank region that arrives through a
variable silently mints arn:aws:, which the partition-check gate cannot see. The test build
now sets a JVM system property that makes such a mint throw, naming the call site; outside
it the ARN is minted as before and the call site is logged once, so production responses do
not change.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* test: give two fixtures the region the blank-region guard requires

GlobalAcceleratorServiceTest mocked RegionResolver.buildArn with Arn.of, which
the real resolver never calls for the blank region Global Accelerator passes:
it mints a global ARN. The mock now delegates to a real resolver.
EventSourceMappingSerializationTest built mappings with no region, which
LambdaService always sets on create; the fixtures set one.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-11 00:11:46 -04:00
Priamo Germosen 0ab58edb3c refactor(iam): measure session expiry on the injected clock (#5382)
IamService decided whether a temporary session had expired against
Instant.now(), while AWS Sign-In stamps the expiry of the sessions it
issues from the injected Clock. In production both read the system
clock, so nothing changes there. In tests the injected clock is a
MutableClock fixed at 2026-01-01, so a Sign-In session was already
expired when it was issued: no test could use its credentials, and no
test could move a session past its expiry without waiting.

IamService now takes the injected Clock and reads it everywhere it
decides whether a session has expired: the secret-key lookup (and with
it S3 signature validation and the EKS token webhook), account routing,
the caller context, the caller ARNs, the caller user ID, and the sweep
of expired sessions. The presigned URL generator ran that sweep on its
first URL with its own system-clock time, which in tests deleted every
Sign-In session issued before it; it now asks IamService to sweep on
its own clock. IamService's package-private constructors keep the
system clock.

Those checks now also agree on the boundary: a session is expired from
the instant its expiration names. The secret-key lookup and the sweep
already drew it there, while account routing, the caller lookups and
the enforcement check still accepted a session at that instant. The
injected clock can land on it exactly, so they now share one predicate.
In production that changes the answer at that one instant only.

IAM enforcement reads the same clock. The filter asks the
expired-session check and the caller lookup about one moment, on every
request and on a presigned POST, and now takes that moment from the
injected Clock. On the system clock a live Sign-In session was refused
with ExpiredTokenException in tests with enforcement on. The filter's
package-private constructors keep the system clock.

Issuers that stamp from the system clock keep doing so. Most of them
(STS, the EC2 metadata and ECS credential endpoints, EKS Pod Identity,
the SSO portal) report the expiry to an SDK client that compares it with
its own wall clock, the SDKs inside the Docker-backed tests included.
Their sessions stay valid in tests, as before. In tests IamService now
measures them on the MutableClock, months behind the system clock, so
there they never expire and no test can move one past its expiry. No
test relied on that.

Service-specific credentials read the same clock. One with a
CredentialAgeDays reports Expired once its ExpirationDate has passed,
and that date is counted from its CreateDate, so both the stamp and the
comparison now use the injected Clock. In production that is the system
clock, as before; in tests a one-day key, the shortest AWS allows, can
now be moved past its expiry instead of having a past date planted in
the store.

A unit test moves a session past its expiry on a MutableClock through
each of the five lookups, another checks that the sweep keeps a session
live on that clock, a third holds a fixed clock at a session's
expiration and checks that every lookup, the enforcement check and the
sweep treat it as expired, and S3ValidateSignaturesIntegrationTest signs
requests with Sign-In credentials until the clock passes their lifetime.
With enforcement on, ExpiredSessionEnforcementIntegrationTest accepts a
session stamped from the injected clock until the clock passes its
expiry, then gets ExpiredTokenException, and IamEnforcementFilterTest
checks that both enforcement paths ask about the clock's moment. All of
these fail without this change. ServiceSpecificCredentialStateTest's
two expiry tests now advance a MutableClock past a one-day key's
expiry.
2026-10-10 21:29:13 -05:00
Priamo Germosen ff20750d91 fix(cloudfront): serve viewer Range GETs (#5377)
A distribution ignored a viewer's Range header: an S3 origin answered
every GET with the whole object and 200, while advertising
Accept-Ranges: bytes, and a custom origin behind a cache or origin
request policy never saw the header, so seeking in a video or resuming
a download read the object from the start.

An S3 origin now serves the one byte range asked for as 206 with its
Content-Range, read from the snapshot GetObject serves, and answers 416
when the range starts past the end of the object. Any other Range gets
the whole object, as CloudFront answers a Range it does not accept and
as S3 does not serve several ranges in one request. A custom origin gets
the viewer's Range and If-Range on every GET or HEAD with a Range
whatever the forwarding settings, as CloudFront forwards a range GET to
the origin and a HEAD can then report the range's length, and its answer
is passed on. A custom error page is served whole.

A Range now applies only while the If-Range sent with it, if any, still
describes the object: a strong ETag equal to the object's, or an
HTTP-date equal to its Last-Modified, matched exactly as RFC 9110
section 13.1.5 requires. Otherwise the whole object is served. This
holds for GetObject, HeadObject and the S3 origin. A presigned URL that
signs Range must also sign an If-Range the request carries, as the S3
User Guide requires.

HeadObject honors Range as the API Reference describes: a satisfiable
range sets Content-Length to the length of the range, leaving out the
whole-object checksum as a ranged GetObject does, and one past the end
answers 416, while a Range that is not one valid range is ignored, as
before. An S3 origin answers a HEAD the same way.

A ranged GetObject is now recorded in CloudTrail like any other, with
the bytes of the range sent, and a range past the end of the object,
for GetObject or HeadObject, is recorded as InvalidRange.

The range parsing GetObject did is now ByteRange, which both use, and
UploadPartCopy's range stream becomes ByteRangeInputStream. GetObject
now matches the range unit in any case, as RFC 9110 section 14.1 has
it, and its InvalidRange error is the one S3 sends, as an AWS-validated
LocalStack capture records it: the message "The requested range is not
satisfiable", with no trailing period, and the RangeRequested and
ActualObjectSize fields.
2026-10-10 21:29:02 -05:00
Allen SanbornandPriamo 7d71df6ac9 fix(cloudformation): honour PermissionsBoundary on AWS::IAM::Role and AWS::IAM::User (#5266)
* fix(cloudformation): honour PermissionsBoundary on AWS::IAM::Role and AWS::IAM::User

Both provisioners ignored the PermissionsBoundary property: create called
the overloads without a boundary, and an update that adopts the existing
entity never touched it.

Create now passes the resolved boundary to createRole/createUser. On the
adoption path a changed boundary is put, and one the template dropped is
deleted (only when the entity currently has one). If a later step fails,
the prior boundary is restored alongside the existing trust-policy/path
rollback.

* fix(cloudformation): treat a blank PermissionsBoundary as absent

Fn::If with Ref AWS::NoValue resolves to an empty string, which the CDK
bootstrap template uses for CloudFormationExecutionRole when no boundary
is configured. The role and user provisioners passed that through and
failed with "Policy  does not exist." Resolve the property with
resolveOrDefault so a blank value means no boundary.

* fix(cloudformation): ID-verify permissions boundary writes on adopted IAM roles and users

The boundary write and its rollback restore went through name-only
IamService methods, so a role or user deleted and recreated under the
same name after adoption could receive them; a rollback restoring "no
boundary" would strip the replacement's boundary. Add put/delete
permissions boundary overloads that take the expected immutable ID, as
updateAssumeRolePolicy and updateUser already do, and pass the adopted
ID for both the primary write and the restore.

* fix(iam): verify role IDs under the name lock on boundary and trust-policy writes

The ID-verified role writes looked the role up and wrote it back outside
resourceNameLock, while createRole holds it. A role deleted and recreated
between the lookup and roles.put got the stale object written over it,
which is the case the ID check exists to stop. They now take the lock, as
the user-side writes already do.

updateUser and updateAssumeRolePolicy call requireSameUser and
requireSameRole instead of repeating the check inline.

* test(iam): stub the role lookup GetRole now makes

roleResponsesWriteMillisecondTimestamps builds a mock IamService and stubbed
getRole, but handleGetRole reads the role through getValidatedRole, which #5391
added so every role action validates its RoleName first. An unstubbed method on
a Mockito mock answers null, so the handler rendered a null role and all nine
parameterized rows failed with a NullPointerException on getPath().

Neither change is wrong on its own base. #5110 added this test and #5391 moved
the lookup it exercises, and each was green where it was written. Together on
main the class is red.

The stub names getValidatedRole because that is what the handler calls. Nothing
else moves: the handler's other role paths still read getRole, and so do the
CloudFormation provisioner tests that stub it.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-10 20:15:37 -04:00
David Phillips 23e6fce6ef fix(rds): report the default managed secret key (#5420)
* fix(rds): report the default managed secret key

Clients need the key identity for a managed master secret even when they
omit a customer key. Report the actual Secrets Manager default key in the
database's account and region so the returned ARN resolves through KMS.

* fix(rds): keep failed managed-key requests retryable

* fix(rds): recover managed keys for saved databases

* fix(rds): recover saved managed keys during startup

* fix(rds): reuse account scopes for saved key recovery
2026-10-10 19:39:13 -04:00
Matheus Oliveira b2b083ee91 fix(iam): validate RoleName in every role action (#5391)
Every action whose RoleName is roleNameType now answers a bad name with ValidationError instead of NoSuchEntity, as CreateRole does.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-10 17:58:43 -04:00
David Phillips 60837956de fix(rds): reject tag ARNs from another partition (#5419)
* fix(rds): reject tag ARNs from another partition

A tag request must identify the resource in the current account, region
and partition. An ARN from another partition must not read or change a
same-named local resource.

* fix(rds): preserve tagging in custom regions

* fix(rds): preserve event tags in custom regions

* fix(rds): repair saved custom-region event ARNs

* fix(rds): preserve restored proxy target group partitions
2026-10-10 17:25:27 -04:00
Andre KuraitandPriamo 3cdc9ef22d fix: serialize IAM and STS Query timestamps with millisecond precision (#5110)
* fix: format IAM and STS Query timestamps at millisecond precision

Truncate only the Query XML projection, preserving stored instants and
session expiration. Cover nanosecond inputs, millisecond and second
boundaries, and timezone offsets with direct mocked handler tests.

Signed-off-by: Andre Kurait <akurait@amazon.com>

* fix(iam): write credential report times as AWS does, pin STS test time

The credential report CSV still wrote ISO_INSTANT at nanosecond
precision with a trailing Z. The IAM User Guide's example report writes
2014-10-15T16:31:25+00:00, whole seconds with a numeric offset, so the
report now uses that form.

The AssumeRole expiration test pinned time by static-mocking
Instant.now(). StsQueryHandler gains a package-private constructor that
takes a Clock (the CDI constructor keeps the system clock), and the test
moves into StsQueryHandlerTest on its existing harness. The IAM cases
move to IamQueryHandlerTest; input offsets, which only exercised JDK
parsing, are dropped.

---------

Signed-off-by: Andre Kurait <akurait@amazon.com>
Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-10 16:46:17 -04:00
Vũ Thế Huy 972ff03f00 fix(redshift-serverless): return HTTP 400 for ResourceNotFoundException and ConflictException (#5409) 2026-10-10 15:16:21 -04:00
XuJian 58ac05433a fix(ses): return Easy DKIM signing hosted zone (#5068)
* fix(ses): expose DKIM signing hosted zone

* fix(ses): keep DKIM signing hosted zone constant

* fix(ses): align signing zone tests with review
2026-10-10 15:13:20 -04:00
Hector Ventura fb202cce6a fix(eks): accept a role ARN from another partition the way STS does (#5398)
* fix(eks): accept a role ARN from another partition the way STS does

An account keeps one IAM namespace whichever partition a request is for
(partitions.md, Known gaps). STS AssumeRole already resolved a role ARN
from another partition to the account's role, while EKS Pod Identity and
add-ons required the cluster's partition and an exact stored-ARN match.

Move the STS role-ARN matcher to IamService.roleArnMatches and use it for
the Pod Identity roleArn and the add-on role ARNs; targetRoleArn accepts
any well-formed partition. The Pod Identity session names the stored
role's ARN, as an STS session does. The EKS model sets no pattern on
roleArn or targetRoleArn.

* fix(eks): keep a role recreated under another path out of a pod identity session

The credentials endpoint finds the association's role by name only. Since
the session started naming the stored role's ARN, a role deleted and
recreated under another path gave the session its ARN and role id through
the old association. The found role now has to match the association's
role ARN the way roleArnMatches does everywhere else; one that does not is
treated as absent, as before this branch.

The association test also checks that a rejected role update leaves the
stored role ARN as it was.

* fix(eks): refuse pod identity credentials when the association's role is gone

EKS Auth assumes the association's role through STS, so a role that no
longer exists gets no credentials. The endpoint still issued them, and
since enforcement loads a session's policies by role name, a pod whose
role was recreated under another path ran with the replacement's policies.

A role that is missing, or that does not match the association's role ARN,
is now a 400 AccessDeniedException and no session is registered.
2026-10-10 14:54:12 -04:00
Sam Fakhreddine 29319fbfb5 fix(lambda): default event source mapping BatchSize by source type (#5362)
CreateEventSourceMapping stored BatchSize 10 for every event source when
the request omitted it. The Lambda model documents a per-source default:
10 for SQS and 100 for Kinesis, DynamoDB Streams, Amazon MSK, self-managed
Apache Kafka, Amazon MQ and DocumentDB. SQS mappings keep 10; every other
source now defaults to 100.

updateEventSourceMapping_invalidLaterField_leavesBatchSizeAndEnabledUnchanged
asserted the untouched Kafka mapping kept the old default of 10; it now
expects 100.

Fixes #4740
2026-10-10 14:02:20 -04:00
Mario Toffia 1082941bc2 feat(iot): search the supported fleet index subset (#4913)
Floci served the fleet indexing configuration but not SearchIndex, so
an application that finds its things by name, type, group or attribute
got "Unknown operation: POST /indices/search".

SearchIndex now runs on POST /indices/search over the things of the
caller's account and region, in thing name order. Its page token names
the last thing returned, so a page continues after it even when things
before it were deleted, as measured on AWS. Like AWS's, a token
continues only the request that issued it: another queryString, or an
indexName or queryVersion sent differently, is "nextToken was from a
request with different parameters", and an empty, forged, edited or
truncated token is "Invalid nextToken". A new parser,
IotFleetIndexQuery, evaluates field:value terms with case-insensitive
values, case-sensitive field names, * and ? wildcards, existence and
match-all, quoted values, AND, OR and NOT with their symbolic forms,
leading - negation and parentheses. Precedence is the one measured on
AWS, where whitespace is an AND that binds looser than OR. The fields
are thingName, thingId, thingTypeName, thingGroupNames and attributes.*.

Requests are validated with the messages and in the order measured on
AWS: a body that is not a JSON object and every member type, member
constraints, index name, query version, a disabled index, the query,
then the page token. Within the query a syntax error comes first, then
the 12-term limit, in which each value of a field group counts and the
field does not, then the first other error, where the field of a group
is checked like any other field. A range counts as one term, and a
malformed range or an unescaped bracket outside one is a syntax error.
AWS's limits hold: a queryString of at most 1000 characters, at most 12
terms, at most two * wildcards in a value and no value starting with ?.
maxResults takes any number, truncated toward zero and capped at the int
range as on AWS. A classic shadow field needs REGISTRY_AND_SHADOW
indexing, and a named shadow field named shadow indexing and a shadow in
its filter, or it is AWS's invalid field name. Constructs AWS accepts
but Floci does not evaluate, such as ranges, comparisons, free text,
field grouping and shadow or Device Defender fields, are refused with
InvalidQueryException instead of matching nothing, and so is a search of
AWS_ThingGroups. Connectivity fields are refused like shadow and Device
Defender fields: AWS's InvalidRequestException while connectivity
indexing is off, InvalidQueryException once it is on. Documents leave
out the members a thing lacks and never carry a shadow or a
connectivity member, where AWS adds connectivity while connectivity
indexing is on.
2026-10-10 13:56:54 -04:00
Aniket Shukla 2015d01864 fix(appconfig): support deleting environments (#5337)
* fix(appconfig): support deleting environments

* fix(appconfig): cascade environment deletion

* fix(appconfig): preserve deployment numbering

* fix(appconfig): resolve delete identifiers
2026-10-10 13:45:28 -04:00
Hector Ventura a1f90453fb fix(apigateway): refuse EDGE REST APIs outside the commercial partition (#5397)
Edge-optimized endpoints exist only in the commercial partition.
CreateRestApi and an UpdateRestApi switch of /endpointConfiguration/types
now run the same check custom domains already use, so an EDGE REST API in
China, GovCloud, ISO or EUSC is a BadRequestException. REGIONAL APIs, and
a move away from EDGE, are still accepted everywhere.
2026-10-10 12:07:42 -04:00
Vũ Thế Huy 475d230ebc feat(cloudformation): provision ElastiCache cache clusters and subnet groups (#5307)
* feat(cloudformation): provision ElastiCache cache clusters and subnet groups

Add AWS::ElastiCache::CacheCluster and AWS::ElastiCache::SubnetGroup provisioners with Ref, Fn::GetAtt endpoint attributes, create-only replacement and update handling. Subnet group updates now carry tags through modifyCacheSubnetGroup, and Memcached clusters record their network type.

* fix(elasticache): validate cluster name, rollback subnet groups and preserve memcached tags

* fix(elasticache): align in-use error wire code and enforce schema required properties
2026-10-10 11:11:00 -04:00
Vũ Thế Huy 141fd747ee feat(redshift-serverless): add usage limit actions (#5378)
* feat(redshift-serverless): add usage limit actions

Add CreateUsageLimit, GetUsageLimit, ListUsageLimits, UpdateUsageLimit and
DeleteUsageLimit, following the botocore redshift-serverless model.

Usage limits are stored and echoed, not enforced: Floci does not meter RPU
consumption, so breachAction never fires. A limit belongs to a workgroup,
at most one per usageType, and disappears with it. The service checks the
workgroup on read instead of hooking deleteWorkgroup, so deletes through
CloudFormation are covered too.

* fix(redshift-serverless): reject malformed usage limit members and purge stale limits on read

- Usage limit string members of another JSON type (a numeric period,
  breachAction, resourceArn, usageType, usageLimitId or nextToken) were read
  as absent, so a create took the defaults, an update ignored the action and
  a list dropped its filter. They are now a ValidationException.
- maxResults accepted fractional and out-of-range numbers and truncated them.
  It must be an integer that fits an int.
- GetUsageLimit and the other id lookups answered 404 for a limit whose
  workgroup was gone but left the record in storage; they now delete it.
- Listing checked every limit with a full workgroup scan. It now takes one
  snapshot of the Region's workgroup ARNs per scan.
- Add a paging test that deletes the limit behind the nextToken.

* fix(redshift-serverless): permit multiple usage limits per type and return 400 on missing resources

- Remove the one-limit-per-usageType check on CreateUsageLimit so a workgroup can have multiple limits for the same usage type with different periods (e.g. daily and monthly serverless-compute).
- Align ResourceNotFoundException on usage limit actions with the AWS Redshift Serverless API specification by returning HTTP 400 instead of 404.
- Update documentation and test assertions accordingly.
2026-10-10 11:06:34 -04:00
Hector Ventura 8b83892dff fix(eks): mirror the cluster's own region and account in the registry config (#5399)
The k3s registries.yaml listed the default account across the regions of
the deployment's partition, so a cluster in another account, or in a region
of another partition served by the same process, could not pull from
Floci's ECR through its own repository hostnames.

Build the mirror from the cluster's account (then the default account)
across every region of the cluster's partition. A commercial cluster in
the default account gets the same file as before.
2026-10-10 10:20:40 -04:00