Commit Graph
3406 Commits
Author SHA1 Message Date
David Phillips 167336fc73 fix(servicequotas): report the standard EC2 quota default (#5778)
* fix(servicequotas): report the standard EC2 quota default

* test(servicequotas): cover paged quotas and account isolation
2026-10-16 06:59:58 -04:00
Hector Ventura f897dfc3b6 fix(core): let a native host path follow a configured persistent path (#5777)
HostDefaultsConfigSource set floci.storage.host-persistent-path to the user
data directory as a fixed value. A persistent path set only in
config/application.yml then moved the state but not the directory child
containers bind. The host path now defaults to ${floci.storage.persistent-path},
so it follows whichever persistent path wins, and an explicit host path still
takes precedence.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-16 06:57:53 -04:00
Kenshin Okinaka e24a2882bc fix(ses): check v2 send request bodies against the service model (#5765)
* fix(ses): check v2 send request bodies against the service model

SendEmail, SendBulkEmail and SendCustomVerificationEmail read their
members by hand, so a member of the wrong JSON type was coerced, read as
empty, or rejected with a Floci-specific BadRequestException, depending
on which member it was. AWS deserializes the whole body against the
model first and answers the first member of the wrong type, in body
order, with a SerializationException and its deserializer message.

tools/aws/regen_sesv2_shapes.py vendors the body shapes of botocore's
SES v2 model into src/main/resources/aws/sesv2-request-shapes.json, kept
in sync by make aws-data-check like the DynamoDB shapes.
SesV2RequestShapes checks a body against them, and the three send
endpoints call it before reading any member. The type checks it makes
redundant are removed from the send helpers. A null address list
element still passes and fails as "Invalid email address null.", as on
AWS.

Only the string, blob, list, structure and map messages have been
probed, so number, boolean and timestamp members are left to their
controllers.

* fix(ses): report a null v2 send address where SES does

A null element of a v2 send address list was rejected for the whole
request while the body was read. SES lets it through deserialization
and reports it later: SendEmail answers "Invalid email address null."
after its content and sender checks and before the tenant lookup, and
SendBulkEmail reports it as the INVALID_PARAMETER status of the entry it
belongs to, of every entry for a null Reply-To, or as "Destination
cannot be empty" when no entry of the request has a non-null recipient.

The address lists now keep the null, SendEmail checks for it ahead of
the tenant gate, and the bulk entry check reports it per entry. Two
ordered integration tests that shared an @Order value get their own.

* chore(core): share the vendored request-shape model

DynamoDbRequestShapes and SesV2RequestShapes each carried the same
Shape and Model records and the same parse() and load(), and load()
repeated VendoredResources.read. RequestShapeModel in core.common now
holds that half and both checks use it; each keeps its own walk and its
protocol's messages.
2026-10-16 06:46:25 -04:00
Hector Ventura 0a5809a559 feat(core): keep a host native binary's state in the user data directory (#5769)
The bundled persistent path is ./data, relative to the working directory.
That suits the image (which sets /app/data) and a run from the checkout, but
a native binary on the PATH would write its state, and its TLS material,
into whatever directory it was started from.

A native run outside a container now defaults to the platform's per-user data
directory: $XDG_DATA_HOME/floci-aws (or ~/.local/share/floci-aws) on Linux,
~/Library/Application Support/floci-aws on macOS, %LOCALAPPDATA%\floci-aws on
Windows. HostDefaultsConfigSource sits at ordinal 260, between the bundled
application.yml (255) and config/application.yml (265), so any path the
user configures still wins. The JVM, dev mode and the image keep ./data.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-16 00:01:06 -04:00
TATSUNO “Taz” Yasuhiro 6e01216f88 feat(lambdaweb): serve endpoint domains from a Node.js environment per revision (#5760)
* feat(lambdaweb): serve endpoint domains from a Node.js environment per revision

A request whose Host is an endpoint's domainName goes over HTTP/1.1 to
a container that Floci starts from the revision's S3 code on the first
request: public.ecr.aws/lambda/nodejs:24 with the code in /var/task,
index.js or AWS_LAMBDA_NODEJS_ENTRYPOINT as the entry file, the node
flags and the environment variables AWS sets, ten seconds to listen,
SIGTERM and one second when idle, and a fresh environment after the
process exits between requests.

The forwarded request carries the headers AWS adds and loses the ones
AWS drops. The response carries lambda-web-request-id and
lambda-web-logstream and streams as the app writes it. Two revisions in
revisionWeights split the traffic by weight. The platform pages for an
unsupported method, an unknown domain, HTTP/1.0, a server that does not
listen, a timeout, a crash and a disabled endpoint are the AWS pages.

Part of #5699

* fix(lambdaweb): index endpoint domains and claim only the minted host shapes

A request looked its domain up by scanning every stored function across
accounts and iterating live endpoint maps outside the function lock. The
service now keeps a domain index, filled from storage at start and kept
by the create and delete paths, and copies the function under its lock.
The data plane claims only hosts shaped like the domains Floci mints, in
any case and with any port, so a dotted S3 bucket with a lambda-web
label still reaches S3.

* fix(lambdaweb): reserve environments against the idle reaper and track exits

acquire now reserves the environment under the same lock the idle
reaper takes, so a request cannot start on a container the reaper is
about to stop. Docker faults in the reaper and in discard are contained
so one error does not end the periodic run or skip the removal. The exit
watcher records the exit time and arms itself again when its stream
drops, and a request that found a dead process is replayed only when
that recorded exit came first, never because the container is gone. The
unpacked code directory is removed on every path. The container gets the
execution role's session credentials when the role exists, and the
function account's credentials otherwise, as the Lambda launcher does.

* fix(lambdaweb): bound the whole exchange by timeoutSeconds and forward chunked bodies

timeoutSeconds is a deadline on the whole request, as recorded against
AWS: a response that has not started by then is the 504 page, one that
is still streaming is cut, and a slow upload gets its 504 once the body
is in, since the edge takes the body before it answers. A body without a
Content-Length is sent chunked instead of carrying the client's
Transfer-Encoding header. A failure of the upload stream ends the
exchange and releases the environment once.

* test(compat): probe the unknown Lambda Web domain in the shape Floci mints

The data plane claims only hosts shaped like the domains it mints, so
the unknown-domain check needs a 16 character id to reach it.
2026-10-15 22:50:05 -05:00
Allen Sanborn 8362d0817d fix(core): give launched containers the port Floci listens on (#5754)
ContainerReachableEndpoint now picks the port a launched container can
reach (quarkus.http.port, or floci.port under TLS), but three sites kept
their own copy of the old logic:

- FlociDuckClient built the sidecar's S3 endpoint from the floci.base-url
  port, which under -p 4811:4566 is a host-only port. It now calls
  ContainerReachableEndpoint.baseUrl().
- CodeBuildRunner set AWS_ENDPOINT_URL from floci.port. It now takes the
  port from ContainerReachableEndpoint.port(); hostname logic unchanged.
- EmulatorLifecycle.onHttpStart compared the started server's port with
  floci.port (or a hardcoded 4510 under TLS), so start/ready hooks never
  ran with QUARKUS_HTTP_PORT overridden alone. It now compares against
  quarkus.http.port, which TlsConfigSource already pins to the TLS
  backend.

The DuckDB-backed test profiles set quarkus.http.port alongside their
test port, as SidecarContainersProfile does.
2026-10-15 22:49:53 -05:00
David Phillips ae3ff3405a fix(core): reject colons in region names (#5705) 2026-10-15 22:49:42 -05:00
Mario Toffia a522c5a9da fix(build): keep build-time Jackson cache locks out of the native image heap (#5065)
Catalogs parsed while the native image is built, such as AwsManagedPolicies,
add entries to Jackson caches every mapper shares and briefly take their lock.
A heap scan inside that window follows the lock's owner to the builder thread
and fails the build. Recompute PrivateMaxEntriesMap.evictionLock and
InternCache.lock as new, unlocked locks in the image heap.

Closes #5062
2026-10-15 22:49:31 -05:00
outofplace d0e0af502b feat(cognito): support SMS and email MFA challenges (#5104)
SetUserPoolMfaConfig validated SmsMfaConfiguration and
EmailMfaConfiguration but stored neither, SMSMfaSettings was ignored,
and no MFA code was ever sent, so a user who picked SMS or email as a
second factor signed in without one.

- SetUserPoolMfaConfig stores both configurations, GetUserPoolMfaConfig
  returns them, and OFF drops them. SmsMfaConfiguration also sets the
  pool's SmsAuthenticationMessage and SmsConfiguration.
- A pool offers SMS MFA once it has an SmsMfaConfiguration or an
  SmsConfiguration from CreateUserPool or UpdateUserPool, as AWS makes
  SMS an MFA factor for any pool with an SMS configuration.
- SetUserMFAPreference and AdminSetUserMFAPreference store
  SMSMfaSettings. Turning SMS or email MFA on for a user without a
  phone_number or email fails with InvalidParameterException.
  UserMFASettingList and PreferredMfaSetting report SMS_MFA.
- After a password or SRP first factor, the user's factors follow the
  developer guide's MFA logic: with OPTIONAL the factors the user turned
  on, with ON every factor the pool offers and the user can receive. The
  preferred factor's challenge follows, the only factor's, or
  SELECT_MFA_TYPE between several.
- SMS_MFA sends a code through SNS with SmsAuthenticationMessage. Email
  MFA is the EMAIL_OTP challenge, a code through SES with
  EmailMfaConfiguration's subject and message, which also carry the
  USER_AUTH EMAIL_OTP sign-in code once set. Both fire the CustomMessage
  trigger with CustomMessage_Authentication, and a right code marks the
  phone number or email address verified.
- In USER_AUTH, a user with such a factor in an optional-MFA pool is
  offered only password challenges.

Closes #5182
2026-10-15 23:38:41 -04:00
Hector Ventura db8c441ed4 fix(core): report the build version when FLOCI_VERSION is unset (#5768)
/health, /_floci/health and the TLS certificate metadata read FLOCI_VERSION
and fell back to "dev". Only the Docker images set it, so a native binary
run on the host reported "dev" and the floci-cli version check skipped it.

One FlociVersion helper now resolves FLOCI_VERSION first, then the version
the Maven build stamps into floci/version.properties (filtered, and included
in the native image), and "dev" only when neither is known. It replaces
five copies of the lookup.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-15 23:36:16 -04:00
Priamo Germosen 21184df828 fix(iam): authorize S3 object operations as the actions S3 documents (#5756)
Under IAM enforcement, CreateMultipartUpload, CompleteMultipartUpload, RestoreObject and
SelectObjectContent were never checked against the caller's identity policies. They are POST
requests, the registry had no S3 POST rule, and an action no rule maps is allowed. A user with no S3
permission could start and complete multipart uploads, restore objects and read them through
Select.

Many other S3 requests were checked as the wrong action:
- ListParts and AbortMultipartUpload as s3:GetObject and s3:DeleteObject.
- Object retention and legal hold as s3:GetObject and s3:PutObject, so a user allowed only to write
  objects could set a retention period or a legal hold.
- Object annotations as the plain object actions.
- A request naming a versionId as the current-version action. A deny on s3:DeleteObjectVersion, the
  usual guard against permanent deletes, did not stop one, and reading a version needed s3:GetObject
  rather than s3:GetObjectVersion.
- Analytics, inventory and Intelligent-Tiering configurations as s3:ListBucket, s3:CreateBucket or
  s3:DeleteBucket.
- DeleteBucketTagging as s3:DeleteBucketTagging, which is not an IAM action. A policy naming it
  granted the call, and one granting s3:PutBucketTagging, the action AWS checks, was refused.
- A request naming two sub-resources as the first one the registry looked for. The controller runs
  a different one: GET ?acl&tagging returns the tags while needing only s3:GetObjectAcl.

The object sub-resources are now resolved per method, in the order S3Controller dispatches them. A
versionId selects the version action AWS checks for a read, head, delete, ACL or annotation
request, and for Select, which S3Controller runs on the version named; the bucket configurations
follow the controller's bucket chains. Tagging keeps the tagging actions: the tagging operations
still act on the current version whatever versionId names, so a version tagging action would
authorize one version and let the request change another.

The actions come from the S3 user guide's "Required permissions for S3 API operations" and
multipart permissions tables, the API reference and the Service Reference:
- s3:PutObject for creating and completing an upload;
- s3:RestoreObject, and s3:GetObject for Select;
- s3:AbortMultipartUpload and s3:ListMultipartUploadParts;
- the retention, legal-hold, version and configuration actions;
- s3:PutBucketTagging for DeleteBucketTagging, and each configuration's Put action for its delete.

A write carrying If-Match already needed s3:GetObject as well. The conditional-writes guide lists
PutObject, CopyObject and CompleteMultipartUpload as the operations that take the header, so now
that completing an upload is checked as s3:PutObject it gets that check too, while
CreateMultipartUpload and UploadPart, which ignore the header, no longer do.

A conditional delete with an If-Match ETag already needed s3:GetObject. A delete naming a version is
now s3:DeleteObjectVersion, so that check covers it too, still as s3:GetObject: the
conditional-deletes guide evaluates the condition against the current version only.

Condition keys, per the Service Reference:
- s3:versionid is given to the version actions.
- s3:ExistingObjectTag is given to the version actions and the annotation actions, read from the
  version the request names.
- DeleteBucketTagging, checked as s3:PutBucketTagging, keeps the bucket's tags in its context.

CloudTrail denials name the version actions' operations, and give no name to a POST operation
rather than a wrong one.

The actions an operation needs besides its own, S3 behaviour behind these checks and S3's own
bucket-policy check follow separately (#5716).

Refs #5716
2026-10-15 22:14:39 -05:00
Allen Sanborn c23641457a fix(backup): publish BACKUP_JOB_COMPLETED to the vault's SNS topic (#5623)
* fix(backup): publish BACKUP_JOB_COMPLETED to the vault's SNS topic

PutBackupVaultNotifications stored the configuration but job completion
never read it, so a subscriber received nothing. When a backup job
completes in a vault whose BackupVaultEvents include BACKUP_JOB_COMPLETED,
publish one message to the configured SNSTopicArn after the job and
recovery point are stored. A failed publish is logged and never undoes
the completion. Other events remain stored-only; docs say which.

* fix(backup): log the exception when a BACKUP_JOB_COMPLETED publish fails

* test(backup): import log-capture classes instead of qualifying them inline

* fix(backup): notify only the vault a job started in, not a same-name replacement

completeJob looked the vault up by name at completion time, so a job whose
vault was deleted and recreated mid-run published BACKUP_JOB_COMPLETED to the
replacement vault's topic. Pin the vault's sub-resource key (which carries its
creation date) when the job starts and read the notification configuration
through it; a deleted vault's configuration goes with it, so nothing is sent.

* fix(backup): match AWS's BACKUP_JOB_COMPLETED message and pin vaults by id

The published notification now follows AWS's documented "Backup job
completed" example: the body ends at the BackupJob ID with no vault name,
and the publish carries the EventType, State, AccountId, Id and StartTime
message attributes that subscription filter policies match on.

Vault sub-resources and in-flight jobs were bound to a vault by its
creation second, so a vault deleted and recreated within the same second
shared a key with its predecessor and a running job could notify the
replacement. Each vault now gets a random FlociVaultId at creation and
the sub-resource key uses it; vaults stored before the field existed fall
back to the creation date, so their stored configuration is still found.
The id is persisted but stripped from DescribeBackupVault and
ListBackupVaults responses.

* test(backup): spell out the RequestSpecification type instead of var
2026-10-15 23:14:33 -04:00
Priamo Germosen b58d181a30 feat(iam): authorize the account password policy's self-service flag (#5717)
The account password policy accepted AllowUsersToChangePassword, echoed it
back from GetAccountPasswordPolicy, and no authorization decision read it: the
six references in src/main were the field, its accessors, the setter call and
the XML element. So under enforcement a user needed a policy naming their own
user however the flag was set, and the option AWS describes as account-level
authorized nothing.

The user guide: the option "gives users access to the iam:ChangePassword
action for only their user and to the iam:GetAccountPasswordPolicy action",
and it "does not attach a permissions policy to each user. Rather, IAM applies
the permissions at the account-level for all users."

So it is one document for the whole account rather than a grant assembled per
user: iam:ChangePassword on user/${aws:username} and on
user/*/${aws:username}, the two patterns AWS's own IAMUserChangePassword
policy writes, the second for a user under a path, plus
iam:GetAccountPasswordPolicy. The resource ARNs are minted in the request's
partition, for the account whose password policy sets the flag.

Writing it with the variable rather than the caller's resolved ARN is what
makes it the grant the guide describes, and it carries two properties for
free. The scope to "only their user" is the variable's, so one stored document
serves every user in the account. And the grant belongs to IAM users without a
principal check of its own: a role session and the account root have no
aws:username, the variable resolves to nothing, and a resource holding a
variable with no value "will not match any resource". It therefore rests on the
substitution #5639 added, now on main; without it the statement is literal
text and matches nobody, which is what the probe below shows.

The grant reaches the caller wherever the principal is an IAM user: its own
access key, a session token it minted, and the simulate path. It is appended
to the identity policies the evaluator already reads, so nothing about
evaluation order changes: an explicit Deny still refuses the call and a
permissions boundary still caps it. collectUserPolicies stays the user's own
set, so ListUserPolicies, ListAttachedUserPolicies and
GetAccountAuthorizationDetails report nothing new, which is the "does not
attach a permissions policy" half of the guide.

That half holds for the answers AWS scopes to attached policies.
ListPoliciesGrantingServiceAccess reports policies by name and type and has
none to report here, and GetContextKeysForPrincipalPolicy returns "only
context keys referenced by the identity-based policies attached to the
specified entity, and any additional policies that you provide", so it reads
the attached set rather than the evaluated one: it had been naming the
${aws:username} of the grant's own resource, twice, once per pattern, out of
a document the user does not hold.

A last-accessed report answers the other question, "every AWS service that
the resource could access using permissions policies", and an account-level
permission is one the user can reach: GenerateServiceLastAccessedDetails
lists iam for a user carrying no policy of their own while the flag is set,
and nothing for that same user once it is cleared. The grant goes into the
documents the service list is read from rather than into the policies the
report names, since it is no policy of the user's and has no name or ARN to
report as one.

One thing the variable form exposed. SimulatePrincipalPolicy built its context
from the call's ContextEntries alone, so a policy scoped to ${aws:username}
simulated as if the key were absent and this grant answered implicitDeny for a
permission the account really gives. The guide lists what a simulation starts
with, "aws:PrincipalAccount, aws:PrincipalId, aws:PrincipalType, aws:Type,
aws:UserId, aws:UserName", adding that "because these keys are populated for
you ... You provide the values for all other condition keys". So the handler
now populates them for a user policy source, through the same CallerArns
writer the enforcement filter uses, which makes a simulation read what an
enforced request reads: aws:PrincipalArn, aws:PrincipalType, aws:username,
aws:userid and the account. The guide's aws:PrincipalId and aws:Type are in no
request context here, so a simulation does not invent them either, and iam.md
says so rather than leaving the list to imply all six. A value the call
supplied still wins, in whatever case it spelled the key, since the context is
keyed the way the evaluator compares key names: keyed by the raw spelling, a
supplied aws:principaltype and a populated aws:PrincipalType were two entries
and the later lowercasing kept whichever hashing happened to reach first. The
account comes from the identity that resolved rather than from the ARN the
call wrote, which need not be one this emulator can parse: a PolicySourceArn
is resolved by its trailing name, so arn:aws:iam:user/bob names a user while
parsing as nothing, and parsing the request's own text turned that call into a
500. A role named as the source is not a session: there is no session name for
an aws:userid and no documented aws:PrincipalType for it, so those keys stay
absent and a statement matching on one does not match.

The flag that answers for a user is their own account's. A PolicySourceArn is
the one way to name a user elsewhere, and the lookup already resolves them in
the account their ARN names, so the flag is read there as well and the grant's
resource ARNs are minted for that account. This account's grant therefore
never resolves ${aws:username} to a user its password policy does not cover,
and a user of another account is not refused a permission their own account
really gives: an allowed answer needs their account to set the flag and the
resource to be theirs.

Thirteen integration tests under enforcement: the flag letting a user with
no policies change its own password and read the policy, the grant appearing
in neither listing nor in GetAccountAuthorizationDetails, nor among the
context keys a simulation's caller is told to supply, while a policy the
user really carries appears in all three, a last-accessed report listing iam
for a user carrying nothing else while the flag is set and nothing once it
is cleared, an explicit Deny of iam:ChangePassword still refusing the call,
a permissions boundary still capping it, the grant reaching none of GetUser,
UpdateLoginProfile or CreateUser, the flag read both ways by one user whose
policies never change, the scope checked through SimulatePrincipalPolicy
against another user's ARN, a supplied context value surviving a key spelled
in another case, a PolicySourceArn that parses as nothing still simulating,
this account's flag not reaching a user of another account, and that user's
own account's flag reaching them over their own ARNs. Each of the
authorizing ones ends on something only the grant allows, which the first
round of them lacked: two asserted refusals alone and passed with the grant
withheld. Probed six ways, by withholding the grant, by disabling
substitution, by dropping the simulator's populated keys, and by reverting
each of three tests' fixes, failing all ten, all ten, the one simulation,
and one test apiece. The three added here were probed the same way, one
behaviour at a time: the other account's user went back to implicitDeny, the
context keys answered aws:username twice, and withholding the grant from the
report emptied it.

Verified on main: 6680 tests across the 342 IAM, core, enforcement and
resource-policy classes that reach the evaluator, 13 skipped and none
failing, with Checkstyle, docs-check and partition-check clean, the last
because the grant mints its resource ARNs rather than writing a partition
literal.
2026-10-15 22:14:18 -05:00
Priamo Germosen 1ba977a14c feat(codeartifact): bridge DescribePackageVersion to Maven/npm/pypi sidecars (#5715)
Maven, npm, and pypi publish straight to their own sidecar and never create
the generic-format packageVersions record DescribePackageVersion depended on,
so it always 404ed for those three formats. Real CodeArtifact's
PackageVersionDescription has no asset listing at all, so the bridge only
needs a cheap per-sidecar existence check for the exact version, not asset
enumeration: Verdaccio's packument already lists every version, Reposilite's
own details API answers directory existence the same way container
readiness probing already relies on, and pypiserver's per-project JSON
listing already groups files by version. The revision is synthesized the
same deterministic way GetPackageVersionAsset's own bridge already does, so
describing a version and fetching one of its assets see the same value.
2026-10-15 22:14:08 -05:00
Vũ Thế Huy a68e6bc768 feat(redshift-serverless): add resource policy actions for snapshots (#5730)
* feat(redshift-serverless): add resource policy actions for snapshots

Add PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy. A policy is
stored per account and Region and echoed in the shape of the API model, not
evaluated. It is tied to the snapshot it was put on by the snapshot's creation
time, so a snapshot recreated under the same name does not inherit it.

Required members come from the AWS model through RedshiftServerlessRequestShapes.

* fix(redshift-serverless): validate resource ARN before policy lookup and add account isolation tests

Validate resourceArn with snapshotNameFromArn at the start of require() so that foreign-account or non-snapshot ARNs return ValidationException on GetResourcePolicy and DeleteResourcePolicy even when no policy is stored. Parameterize snapshotNameFromArn so error messages reference resourceArn.

Add regression tests covering missing resourceArn on PutResourcePolicy and foreign ARN reads/deletes. Add integration test verifying policy isolation across accounts under real request contexts.
2026-10-15 22:13:02 -04:00
Andre Kurait 209ecd799b fix(swf): accept legacy JSON target headers (#5728)
* fix(swf): accept legacy JSON target headers

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

* fix(swf): reject unsupported CBOR and clarify missing targets

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

* refactor(protocol): declare targeted plain JSON in the service catalog

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

---------

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-15 22:05:37 -04:00
Matheus Oliveira eca2199de6 fix(s3): answer InvalidRequest for CompleteMultipartUpload with no parts (#5759)
CompleteMultipartUpload with an empty or absent parts list answered 400
MalformedXML. AWS and LocalStack answer 400 InvalidRequest with the message
"You must specify at least one part". A body that is not well-formed XML
still answers MalformedXML.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-15 21:58:05 -04:00
Allen Sanborn 05153b30be feat(autoscaling): implement DescribeTags (#5750)
* feat(autoscaling): implement DescribeTags

DescribeTags returned UnsupportedOperation while CreateOrUpdateTags and
DeleteTags already stored group tags. Serve it from those stored tags:
filters auto-scaling-group, key, value and propagate-at-launch (values
within a filter ORed, filters ANDed, unknown filter names rejected with
ValidationError), MaxRecords/NextToken paging reusing the offset token
DescribeInstanceRefreshes uses, results ordered by group then key.

* fix(autoscaling): reject non-numeric MaxRecords and sparse filter indices in DescribeTags

* fix(autoscaling): harden DescribeTags paging, vanished groups and oversized indices

- rejectIndexGap compares member indices as BigInteger, so an index past
  int range is a 400 ValidationError instead of a NumberFormatException 500.
- describeTags skips a null group value (deleted between StorageBackedMap's
  key snapshot and value read).
- NextToken is now an opaque cursor on the last (group, key) returned, not
  an offset, so tags added or removed between pages are neither skipped
  nor repeated.
- Import hamcrest containsString in the integration test.

* fix(autoscaling): sign DescribeTags NextToken and route DescribeTags by Version

A token that decodes to a (group, key) it was never issued for is now
refused with InvalidNextToken, as AWS refuses a token it did not mint:
the cursor carries an HMAC-SHA256 over region and cursor under a
per-process key. DescribeTags joins the autoscaling action set so a
request without a credential scope reaches autoscaling under its
2011-01-01 Version instead of ec2.

* fix(autoscaling): bind DescribeTags NextToken to the account; per-instance HMAC key

A static SecureRandom key can be initialized at native-image build time and
baked into every process; hold it on the ApplicationScoped bean instead. The
MAC now covers the caller's account id, so a token issued under one account
is InvalidNextToken under another.

* fix(autoscaling): draw the DescribeTags cursor key with nextBytes, not generateSeed

* fix(autoscaling): AND repeated DescribeTags filters of the same name

Each Filters.member entry is now its own filter, so two 'key' filters
must both match instead of being merged into one ORed value list, per
the Filter shape: multiple filters are joined with AND.

Also cover a NextToken whose own cursor tag is deleted between pages.

* fix(autoscaling): page DescribeTags through core Pagination, read filters to first gap

Per review: the NextToken is now a (group, key) cursor through
core.common.Pagination with a namespace and InvalidNextToken, replacing
the HMAC, per-instance key and account binding (groups are stored per
account, and the per-instance key voided every token on restart).
rejectIndexGap is gone; filters are read up to the first missing index
like every other member list in the handler. propagate-at-launch values
match exactly, as the Filter model says values are case-sensitive.
2026-10-15 21:07:14 -04:00
jwoa95 cbd2f61dc4 feat(s3): apply lifecycle expiration rules (#5158)
A bucket's lifecycle configuration was stored and returned but never
evaluated. A background sweep now applies its expiration actions:

- Expiration (Days, Date) deletes the current version of a matching
  object, or adds a delete marker in a versioning-enabled bucket. Day
  counts run from the last-modified time and round up to the next
  midnight UTC, as on S3.
- ExpiredObjectDeleteMarker, and a Days or Date expiration once the
  marker is old enough, remove a delete marker with no other versions.
- NoncurrentVersionExpiration (NoncurrentDays, NewerNoncurrentVersions)
  permanently deletes noncurrent versions, counting from when the next
  newer version was written.
- AbortIncompleteMultipartUpload (DaysAfterInitiation) aborts uploads
  under a prefix-only filter.

Filters are Prefix, Tag, ObjectSizeGreaterThan, ObjectSizeLessThan, an
And of them, or the older rule-level Prefix. Disabled rules are skipped,
versions under Object Lock retention or a legal hold are never deleted,
and each bucket is swept in its owning account. Lifecycle deletions are
notified as s3:LifecycleExpiration:* rather than s3:ObjectRemoved:*,
with S3 itself as the requester, and their EventBridge reason is
"Lifecycle Expiration".

A rule S3 would have refused on put, such as Days 0, a size bound that
is not a number or a Tag without a Value, is skipped as a whole, so a
bad value never widens what a rule deletes. A body that is not one
well-formed LifecycleConfiguration document has no rules.

Each key is planned from one pass over its account's objects, then read
again by its known store keys and applied under the bucket monitor.
Lifecycle configuration changes and tagging now change under that
monitor too, and a multipart upload is aborted only
while its bucket and the rules are still the ones the sweep started on.
Versions written in the same millisecond keep the order they were
written in, for ListObjectVersions as well as for lifecycle.

PutObject, GetObject and HeadObject on a current version that an
Expiration rule matches return x-amz-expiration with the expiry date
and the URL-encoded rule id.

The sweep runs every 60 seconds by default, configured with
floci.services.s3.lifecycle-sweep-enabled and
floci.services.s3.lifecycle-sweep-interval-seconds. Transition actions
are still not applied.

Closes #5137
2026-10-15 20:52:43 -04:00
XuJian a4eb854614 fix(s3): enforce ownership controls and restore CFN updates (#5712)
* fix(cloudformation): apply S3 bucket OwnershipControls

* fix(s3): validate ownership controls in service

* fix(s3): return MalformedXML for invalid ownership controls

* fix(s3): enforce ownership controls and restore bucket updates

* fix(s3): reject ownership enforcement for nonprivate ACLs
2026-10-15 20:30:26 -04:00
Allen Sanborn f045d7d0a8 fix(autoscaling): skip groups deleted mid-iteration and lock instance updates (#5751)
The groups map is a StorageBackedMap once storage is initialised. Its
iterator snapshots keys and reads each value lazily, so a group deleted
between the two yields a null value. describeAutoScalingGroups returned
that null (the reconciler then NPE'd in reconcile and again in its catch
block), and describeAutoScalingInstances, SetInstanceHealth and
TerminateInstanceInAutoScalingGroup NPE'd outright (HTTP 500).

Skip null values at those iteration sites. SetInstanceHealth and
TerminateInstanceInAutoScalingGroup now re-read and update the group
under its per-group lock, as saveAutoScalingGroupIfPresent does, instead
of an unlocked find/mutate/put that could race the reconciler or
resurrect a just-deleted group.
2026-10-15 19:50:58 -04:00
TATSUNO “Taz” Yasuhiro 0492fc9842 feat(lambdaweb): CloudFormation types for Lambda Web Functions (#5722)
* feat(lambdaweb): CloudFormation types for Lambda Web Functions

AWS::Lambda::WebFunction, AWS::Lambda::WebFunctionRevision and
AWS::Lambda::WebFunctionEndpoint provision through the resource
registry. Ref of each is its ARN. Every property of a revision is
createOnly in the registry schema, so a changed revision mints a new one
and the displaced revision is deleted once the update commits. An
endpoint keeps its identity while its function, name, type and regions
stay the same. Fn::GetAtt on RegionalEndpoints is recorded as a gap.

Part of #5699

* fix(lambdaweb): compare a revision against the function's default log group

revisionMatches filled a request without a log group with the existing
revision's log group, so a template that dropped a custom log group kept
the old revision. The default is the function's log group, as when a
revision is created. replaceTags returns the updated function.

* fix(cloudformation): put a Lambda Web function or endpoint back after a failed stack update

A function's tags and an endpoint's mutable configuration are changed in
place on update. The provisioner now snapshots them before the change and
restores them from rollbackUpdate, as the other in-place provisioners do.
The function attributes after a tag update come from the updated
function, so UpdatedAt moves with the tag change.

* test(cloudformation): roll a Lambda Web stack update back after a failed revision

A revision that fails to create after the endpoint moved to a replaced
revision rolls the stack back. The endpoint returns to the kept revision
and the replacement is deleted. The doc page says that a CloudFormation
endpoint is always Disabled with RevisionWeights, since the schema has no
AutoDeploymentMode, and that a failed update puts in-place changes back.

* fix(cloudformation): refuse AutoDeploymentMode on a Lambda Web endpoint

The registry schema has no AutoDeploymentMode property and AWS fails a
template that sets it at validation. An endpoint from CloudFormation is
always Disabled and routes by RevisionWeights. Floci passed the property
through to the service, which accepted LatestRevision.

* refactor(lambdaweb): share the create and tag steps between the API and CloudFormation paths

createFunction and createFunctionShell both check the name and refuse a
duplicate under the function's lock. tagResource and replaceTags both
check the tags, lock, write, stamp and persist. Each pair now calls one
private helper, so the two paths cannot drift.
2026-10-15 19:02:50 -04:00
Matheus Oliveira 01cc020419 refactor(account): share the alternate-contact not-found exception (#5755)
getAlternateContact and deleteAlternateContact each built the same
ResourceNotFoundException. Move it into a notFound() helper next to
validation() so the two stay in step.

Follow-up to #5560.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-15 18:59:10 -04:00
Jackson Price 945f5d3995 fix(cloudformation): restore SSM parameters on failed updates (#5752)
A stack update that changed an AWS::SSM::Parameter and then failed on a
later resource ended in UPDATE_ROLLBACK_FAILED with the new value left
in place: the provisioner had no rollback.

An update that keeps the name now keeps the parameter's value, settings
and managed tags before it writes, and the rollback writes them back as
a new version unless the parameter still holds them. A changed Name
creates the replacement and leaves the displaced parameter to the
shared ReplacementCleanup record: a committed rename deletes it unless
UpdateReplacePolicy is Retain, a rollback deletes the replacement, and
ContinueUpdateRollback retries a restore or delete that failed. A
snapshot is spent when the update commits, and one a skipped rollback
left is dropped when the next update starts.

A create or replacement is one PutParameter without overwrite that
carries the tags, as AWS's handler sends it, so a name held outside the
stack fails the resource instead of being overwritten or adopted; a
dispatcher stub's id is taken over by a create. As AWS's handler checks
that the parameter exists before an update writes it, a parameter
deleted outside the stack fails the update in place, and a rollback
that finds it gone, with ParameterNotFound. A delete treats
ParameterNotFound as already deleted.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-15 18:27:31 -04:00
Matheus Oliveira 9174147cb6 fix(account): implement DeleteAlternateContact (#5560)
* fix(account): implement DeleteAlternateContact

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* docs(account): document DeleteAlternateContact

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-15 18:02:19 -04:00
Jackson Price ad8fba7f45 fix(cloudformation): evaluate conditions with intrinsics, require parameter values (#5737)
* fix(cloudformation): require a value for every declared parameter

CreateStack, UpdateStack and CreateChangeSet accepted a template that
declares a parameter with no Default when the request gave it no value.
The stack deployed with the parameter unset: a condition compared it as
an empty string, and a Ref resolved to the parameter's own name.

Such a request now fails with ValidationError "Parameters: [Env] must
have values", naming every such parameter in declaration order, before
the SAM transform and the dependency preflight run and before any stack
state changes. An empty value counts as a value. An update does not
carry values over, so it needs a value or UsePreviousValue, which keeps
the deployed one, for each parameter without a Default.
UsePreviousValue on a parameter with no deployed value passes none,
rather than an empty string. A request its stack refuses outright, an
update of a stack that is missing or cannot be updated or a create over
a name in use, still gets that refusal. A parameter that an AWS::Include
defines, which only execution merges, is not checked up front.

The same check refuses CreateStackSet and UpdateStackSet, before the
stack set changes or an operation is recorded. UpdateStackSet resolves
UsePreviousValue against the previous template's Defaults too, since a
stack set keeps only the values it was given. A nested stack resource
whose Parameters leave a child parameter without a value fails, before
the child is created or changed. Those Parameters now resolve as a
property value: an Fn::If may choose the whole map, and an AWS::NoValue
value passes nothing.

A CreateStackInstances whose targets cannot be resolved, or whose
change set is refused, now ends its operation FAILED. Left RUNNING, it
refused every later operation on the stack set.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): evaluate conditions through the template engine

Conditions resolved only a bare Ref, and only to a parameter, the
account or the region. Every function other than that Ref compared as
an empty string inside Fn::Equals: Fn::FindInMap, a Ref to
AWS::StackName or AWS::StackId, Fn::Join. A condition on a mapped value
or on the stack's own name was decided wrongly, so the wrong resources,
or none, were created.

The operands now resolve through the template engine, with the
template's Mappings and the stack's name and id. The change-set preview
and the dependency preflight evaluate against the stack too: the live
one an update targets, or the name a create takes, whose id does not
exist yet. An operand the engine cannot resolve compares as an empty
string, as every function did before, so a template that evaluated then
still does. A declared parameter that a stack stored by an older Floci
lacks still compares as an empty string, and AWS::NotificationARNs is
the empty list, now in properties and outputs too.

CloudFormation does not allow Fn::ImportValue in a condition, so a
template being deployed with one there is refused with "Template error:
Cannot use Fn::ImportValue in Conditions.", also in an operand that
evaluation never reaches. A SAM template's change set, or its stack,
fails with that reason instead. A stored template compares the import
as an empty string, so it never blocks an update that supplies a new
template; UsePreviousTemplate checks the stored one as it would a new
one.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): check a create's dependencies with its stack id

A create's dependency preflight evaluated AWS::StackId as an empty
string while the execution used the stack's id, so a dependency on a
resource whose condition reads the stack id could pass the preflight
and then fail the deploy, or the other way round. A create over a name
in use was checked against the stack holding the name instead, and
could get a dependency error rather than AlreadyExistsException.

createChangeSet now allocates the new stack's id before the preflight
and creates the stack with it, so the preflight, the change-set preview
and the execution evaluate the same id. An update, or a create that
attaches to a REVIEW_IN_PROGRESS placeholder, is checked against that
stack as before, and a create over a name in use is checked as the new
stack it asks for.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): place the parameter check before dependency checks

The parameter section said template errors such as a dependency cycle
come first, but createChangeSet checks the parameter values before the
dependency checks, which evaluate conditions that read those values.
Say so, and keep the stack's own refusal ahead of both.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): order the stack's refusal after dependency errors

The previous commit said the stack's own refusal comes ahead of both
the parameter check and the dependency checks. It comes ahead of the
parameter check only: a request its stack refuses still gets a
template's dependency error first, as on main. Say so, and re-wrap the
conditions paragraph.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say parameter values are checked before dependency errors

The parameter section still read as if a template's dependency errors
came first. createChangeSet checks the parameter values before the
dependency checks, which evaluate conditions that read the values, so
a template with a cycle and a missing value gets the parameter error.
Say that, and that a stack's own refusal replaces the parameter error
but still follows a dependency error.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin a missing value ahead of a dependency cycle

A template with both a DependsOn cycle and a parameter without a value
gets "Parameters: [Env] must have values" and creates no stack.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): name the tolerated parse failures ignored

requireParameterValues and parametersWithDefaults return when the
template does not parse, as intended: there is nothing to check or to
add, and the preflight and the execution report the parse error. Name
the caught exception ignored and say why, as AGENTS.md asks.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): say only execution reports a parse failure

The comment on the ignored parse failure in requireParameterValues
said the preflight reports it too. The dependency preflight skips a
template that does not parse; only executing the change set reports
the error.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-15 16:56:00 -04:00
Robin BaeckmanandRobin Baeckman 8eddae4ed6 fix(ec2): restore and stop the instances of every account (#5103)
Startup restore runs from @PostConstruct and shutdown from a lifecycle
hook, both outside any request, so an account-aware keys() sees only
the default account. Every other account's EC2 state was skipped:

- after a restart its VPCs and subnets were not re-declared, so paths
  that do not declare lazily, such as an EKS node joining its VPC,
  found no network; reconcileOrphans also judged its VPC networks
  against the default account only;
- its instances' private addresses were not re-reserved and their
  IMDS registrations were not restored, so IMDS stopped answering;
- shutdown, and a state reset, which wipes every account, did not stop
  its running instances.

Restore and shutdown now walk every account's VPCs, subnets and
instances. Restore runs each instance as its own account, so the
security groups and prefix lists it resolves come from that account, in
the instance's own region, and both paths write to the owning partition.
VPCs are declared default account first, then in account and key order,
because overlapping CIDRs go to whichever VPC is declared first. The
port-forward persister, which also runs on container executor threads
with no request, writes to the account that holds the instance instead
of the current one, and writes nothing when no account holds it any more
(terminated meanwhile). A pre-multi-account key is migrated once, or
dropped when a scoped copy already exists.

Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
2026-10-15 16:52:54 -04:00
David 9cd9002e73 feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled (#5736)
* feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled

EnableHttpEndpoint and DisableHttpEndpoint answered UnsupportedOperation
and DBCluster carried no HttpEndpointEnabled, so Terraform's
enable_http_endpoint and CDK's enableDataApi never read back what they
set.

Clusters now record the flag and report it. The two actions take the
cluster's ARN and raise ResourceNotFoundFault and
InvalidResourceStateFault as the model lists them; CreateDBCluster,
ModifyDBCluster and the AWS::RDS::DBCluster EnableHttpEndpoint property
set it too. Turning it on is refused for engines other than Aurora
PostgreSQL and Aurora MySQL. The Data API itself does not check the
flag, so existing callers keep working.

Closes #5732

* refactor(rds): one cluster ARN parser, and stricter Data API inputs

clusterForResourceArn repeated the ARN parsing, cluster: prefix and
account and Region check of clusterIdentifierFromArnOrName; both now
call clusterIdFromArn, each raising the error its API documents.

The Data API engine check takes aurora-postgresql, aurora-mysql and the
older aurora name exactly instead of any name starting with aurora, and
the AWS::RDS::DBCluster EnableHttpEndpoint property accepts true or
false only, so a malformed value fails instead of turning the endpoint
off.

* fix(rds): take only aurora-mysql and aurora-postgresql for the Data API

The API reference lists those two engines, and new clusters cannot carry
the bare aurora name, so the check no longer accepts it.
2026-10-15 16:49:23 -04:00
Allen Sanborn a37c27516a feat(route53resolver): implement ListResolverEndpointIpAddresses (#5731)
* feat(route53resolver): implement ListResolverEndpointIpAddresses

The Terraform provider lists an endpoint's IP addresses right after
CreateResolverEndpoint, so the missing operation (UnknownOperationException)
failed every aws_route53_resolver_endpoint create.

Built from the IpAddresses recorded at create time: one ATTACHED entry per
request with a deterministic rni- IpId. Unknown endpoint ids raise
ResourceNotFoundException. Not paginated, like the sibling List operations.

* docs(route53resolver): update service matrix operation count

* refactor(route53resolver): add endpoint IP addresses with a single addAll

* fix(route53resolver): distinct IpIds for repeated entries; fail on missing IP record

ListResolverEndpointIpAddresses hashed only the endpoint id and the entry,
so two identical entries (two addresses in one subnet, both left for AWS to
pick, which IpAddressesRequest allows) shared an IpId. Include the entry's
position in the recorded list, which is normalised once at create and so
stable across reads.

An endpoint whose recorded IP requests are missing returned an empty list
beside a nonzero IpAddressCount. Throw the modeled
InternalServiceErrorException instead.

* test(route53resolver): import List/HashSet instead of fully qualifying (checkstyle NoFqcn)

* fix(route53resolver): return InternalServiceErrorException as HTTP 400

The Route 53 Resolver model gives InternalServiceErrorException no
httpStatusCode, so clients expect the awsJson default of 400, as with
every other Resolver error.
2026-10-15 16:44:58 -04:00
Allen Sanborn 5544a119d3 fix(ec2): ignore NoDevice block device mappings at launch (#5739)
A RunInstances or CreateFleet BlockDeviceMapping with NoDevice set removes
its device regardless of the other values it carries. The root volume type
resolution and the VolumeType validation read Ebs on such entries, so a
request that removed a template's gp3 root still got gp3, and a removed
mapping naming an unknown VolumeType failed with InvalidParameterValue.
Drop NoDevice entries before both, on the request-only and template-merged
paths alike.
2026-10-15 16:39:12 -04:00
XuJian 0eee5ee28d fix(scheduler): validate replacement cleanup addresses (#5713)
* fix(scheduler): validate replacement cleanup addresses

* fix(scheduler): share schedule name validation
2026-10-15 15:51:14 -04:00
Aniket Shukla fb6adc00d8 feat(rds-data): opt into retryable database resume errors (#5703)
* feat(rds-data): opt into retryable database resume errors

* fix(rds): keep lease release safe after timer shutdown

* refactor(rds): share pause cancellation between acquisition modes

* docs(rds-data): list resume errors in configuration references
2026-10-15 15:15:11 -04:00
Ridwan ac83817802 fix(bedrock): resolve the KMS key before updating a guardrail (#5710)
UpdateGuardrail set the name, description and blocked messaging on the
stored DRAFT before resolving kmsKeyId. getGuardrail returns the live
stored object, so a request rejected for an unusable key still left those
fields applied, while updatedAt, the policies and kmsKeyArn kept their old
values.

The key is now resolved into a local before any setter runs, the same
validate-before-mutate order #2501 gave UpdateMemory. It stays after the
guardrail lookup, so an unknown guardrail is still reported as
ResourceNotFoundException first.

Fixes #5654
2026-10-15 14:16:04 -04:00
Allen Sanborn 1e423420ed fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated (#5622)
* fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated

CreateNatGateway gave each gateway address a networkInterfaceId of
"eni-" + randomHex(17), but nothing else knew about that interface:
DescribeNetworkInterfaces had no NAT arm, so the id DescribeNatGateways
publishes (aws_nat_gateway.network_interface_id) answered
InvalidNetworkInterfaceID.NotFound. The Elastic IP the gateway took was
also never marked associated, so DescribeAddresses showed a held
allocation as free.

The interface id is now derived from the gateway id, as endpoint ENIs
are, and DescribeNetworkInterfaces reports one requester-managed
nat_gateway interface per gateway address, built from the stored
address so the two reads cannot disagree. CreateNatGateway records the
association, interface and private address on the allocation (no
instanceId), and DeleteNatGateway clears them if the association is
still the gateway's.

* fix(ec2): refuse a NAT gateway on an occupied Elastic IP, keep its association, scope its ENI lookup to the account

CreateNatGateway rejects an allocation already held by an instance or another gateway
(Resource.AlreadyAssociated) under the lock that writes the association. DisassociateAddress
rejects an association owned by a NAT gateway. The NAT arm of DescribeNetworkInterfaces reads
gateways and subnets for the account asked about.

* fix(ec2): lock NAT gateway EIP release, treat a legacy gateway's EIP as held

DeleteNatGateway releases the Elastic IP under the lock CreateNatGateway
takes. CreateNatGateway also refuses an allocation any live gateway
references, covering gateways persisted before Address records were
marked. The CloudFormation networking test gives the replacement NAT
gateway a new EIP: replacement creates before it deletes, and AWS's
CreateNatGateway refuses an EIP still associated elsewhere.

* fix(ec2): AssociateAddress refuses a NAT gateway's Elastic IP; legacy gateways hold theirs

AssociateAddress checks for a gateway holding the allocation and writes
under the allocation lock CreateNatGateway and DeleteNatGateway take, so
an instance cannot take over an address the gateway still claims. The
gateway scan behind that check, and CreateNatGateway's, now includes
unmigrated pre-account-isolation gateway records for the default
account, never another account's.

* fix(ec2): scope NAT gateway ownership checks to the caller's records

callerNatGateways scanned every account's gateways before filtering. Read
the caller's own records, plus unprefixed legacy records only for the
default account.

* fix(ec2): create a NAT gateway failed on an Elastic IP already in use

CreateNatGateway with an allocation another gateway or an instance holds
no longer answers 400. As the NatGateway shape documents, the gateway is
created in state failed with FailureCode Resource.AlreadyAssociated and
FailureMessage "Elastic IP address <alloc> is already associated". It
gets no interface, claims nothing, and does not count as a holder.
AWS::EC2::NatGateway fails the resource and deletes the failed gateway.

ReleaseAddress on an allocation a NAT gateway holds, legacy gateways
included, answers InvalidIPAddress.InUse. DisassociateAddress and
ReleaseAddress run under privateIpAllocationLock. The NAT interface lookup
reads legacy unprefixed gateways and subnets for the default account. It
also loads the interface's tags, and DeleteNatGateway deletes them.
endpointEniId and natEniId become one helper, eniIdFromSeed.

* test(cloudformation): say why the replacement template keeps NatEip

The replacement template keeps NatEip for two reasons. On AWS a gateway
given an Elastic IP the displaced gateway still holds is created failed.
And Floci update cleanup deletes removed resources before the old copies
of replaced ones, so dropping the EIP while replacing its gateway would
try to release it while it is still held.

* fix(ec2): a failed NAT gateway does not pin its subnet or VPC

#5503 made DeleteSubnet and DeleteVpc refuse while a NAT gateway that is
not deleted sits in the subnet. A failed gateway was never created and
holds no interface, so it no longer counts, matching the Elastic IP
holder check.
2026-10-15 13:53:49 -04:00
Vũ Thế Huy d3fce14256 feat(redshift-serverless): add release track, managed workgroup and reservation reads (#5691)
* feat(redshift-serverless): add release track, managed workgroup and reservation reads

Add GetTrack, ListTracks, ListManagedWorkgroups, ListReservations,
ListReservationOfferings, GetReservation, GetReservationOffering and
CreateReservation so SDK, CLI and IaC clients no longer get an unknown
operation error. Floci models no zero-ETL managed workgroups and sells no
reservations, so the lists are empty and the reservation lookups answer
ResourceNotFoundException. The two release tracks are current and trailing.

Required members, patterns and lengths come from the AWS model through
RedshiftServerlessRequestShapes; only the track names, which the model leaves
unenumerated, are checked by hand.

* refactor(redshift-serverless): reuse Pagination.paginate and remove unused admin handle method

Rely on Pagination.paginate for maxResults and nextToken validation in listTracks and listWithoutItems, matching the other Redshift Serverless lists. Remove the unused handle method and its duplicate unknown-operation response in RedshiftServerlessAdminJsonHandler.
2026-10-15 13:46:35 -04:00
Langning Zhang ea45f81a81 fix(s3): reject undersized multipart upload parts (#5718)
* fix(s3): reject undersized multipart upload parts

Signed-off-by: boulea7 <zln1905391059@163.com>

* fix(s3): reuse multipart size error helper

Signed-off-by: boulea7 <zln1905391059@163.com>

---------

Signed-off-by: boulea7 <zln1905391059@163.com>
2026-10-15 12:55:58 -04:00
Vũ Thế Huy b4c012fba4 fix(ecs): apply EFS access point PosixUser and CreationInfo to task volumes (#5606)
* fix(ecs): apply EFS access point PosixUser and CreationInfo to task volumes

An ECS task mounting EFS through an access point ignored the access
point's own settings, so the volume stayed root:root 0755 and a non-root
task could not write to it. Resolve the access point from EfsService and
initialise the volume root from RootDirectory.CreationInfo, and run the
container as PosixUser (uid:gid plus secondary gids). Each part falls
back independently to floci.storage.efs.*. An access point on another
file system, or with incomplete CreationInfo/PosixUser, rejects the launch.

Owner ids use long so unsigned 32-bit POSIX ids are not narrowed.

Closes #5480

* fix(ecs): attach PosixUser groups as supplementary groups instead of replacing container user

Preserve the container definition or image user when mounting an EFS access point, and attach the PosixUser gid and secondary gids as supplementary groups instead of overriding the container user.

Also stabilize ElbV2PreserveHostHeaderIntegrationTest socket connection to avoid public DNS resolution timeouts in CI.

* fix(ecs): validate CreationInfo permissions and filter null secondary GIDs

* revert(elbv2): revert listener test wait and loopback address change

* fix(ecs): share octal permissions check with ContainerLifecycleManager
2026-10-15 12:01:04 -04:00
danielxoi fa682b2d62 fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types (#5503)
* fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types

A CidrBlock change, or a tenancy change other than dedicated to default,
replaces the VPC, but the provisioner never recorded the displaced one and had
no delete arm, so the old VPC was left behind; in-place Tags, EnableDnsSupport
and EnableDnsHostnames changes were not snapshotted, so a later failing
resource left the VPC changed and reported rollback as not implemented.

Ec2VpcCfnProvisioner now follows Ec2NetworkCfnProvisioner: ReplacementCleanup
records the displaced VPC and deletes it after the update commits or restores
it on rollback; a prior-state snapshot restores DNS attributes, tags and a
dedicated-to-default tenancy change on rollback, eagerly when provision itself
fails; and a delete arm through CfnDeletes.safeDelete removes the VPC on stack
teardown, tolerating only InvalidVpcID.NotFound so stack-external dependents
fail the delete with DependencyViolation, as on AWS.

* refactor(cloudformation): use the shared CfnRollback.guarded in the VPC provisioner

* fix(ec2): count instances and NAT gateways as subnet and VPC dependents

DeleteSubnet and DeleteVpc checked subnets, security groups, route tables,
ACLs, gateways and endpoints but not the instances and NAT gateways living in
a subnet, so a stack teardown could remove a subnet and its VPC out from under
an instance launched into it out of band. Both now fail with
DependencyViolation while an instance that is not terminated (shutting-down
still holds its interface) or a NAT gateway that is not deleted sits in the
subnet, as on AWS. The rollback integration test also pins Boom after the VPC
with DependsOn so the scenario cannot pass by ordering alone.

* fix(cloudformation): keep the VPC and subnet rollback snapshot until the restore succeeds

rollbackUpdate removed the in-place snapshot before restoring; a restore that
threw left the resource persisted as UPDATE_FAILED with no prior state for a
ContinueUpdateRollback retry. Ec2VpcCfnProvisioner and the pre-existing
Ec2NetworkCfnProvisioner now restore first and remove after, as the AgentCore
provisioner already did. The describeTags loop shared by Ec2Tags.reconcile and
the VPC snapshot moves to Ec2Tags.current.

* fix(ec2): count standalone network interfaces and interface endpoints as subnet dependents

A subnet is pinned by any network interface in it, not only the ones an
instance or NAT gateway owns: a standalone interface from
CreateNetworkInterface and an interface or Gateway Load Balancer endpoint
keep DeleteSubnet at DependencyViolation on AWS too. The endpoint test that
deleted a subnet out from under a live endpoint relied on that state being
reachable; it now asserts the refusal and that the published interface ids
are unchanged.

* fix(cloudformation): wait for terminated on instance delete and resolve VPC properties before creating

With real containers an instance is still shutting-down when the stack's
instance delete returns, so the subnet delete that follows was refused by the
new resident check and the stack ended DELETE_FAILED. The instance provisioner
now polls until the instance is terminated or gone, as CloudFormation does.

The VPC provisioner created the VPC before EnableDnsSupport, EnableDnsHostnames
and Tags were resolved, so a resolution failure left it untracked; the resolves
now run first, as the subnet provisioner does. Ec2Tags.current drops reserved
aws: keys so a rollback snapshot never tries to write one, and the replacement
integration test waits in the stack's own region.
2026-10-15 11:14:56 -04:00
dkatavic a318dc7b90 fix(msk): publish a host listener when Floci runs in a container (#5651)
* fix(msk): publish a host listener when Floci runs in a container

* fix(msk): list both listeners in GetBootstrapBrokers when a bootstrap hostname is set

With floci.services.msk.bootstrap-hostname set, GetBootstrapBrokers
returned only the host listener's address, <hostname>:<port>. Inside a
sibling container that is usually the container itself, so the setting
broke broker discovery for containers on the Docker network, the case the
Docker-network default exists to keep working.

It now returns both listeners, <container-name>:9092,<hostname>:<port>.
Kafka clients try bootstrap entries until one connects, and the broker then
advertises the address of the listener they came in on, so host and
sibling-container clients can each discover the broker through the MSK
API. The broker's listeners and advertised addresses are unchanged; only
the API response is.

The container name is used rather than its IP because it fails fast on the
host, where it does not resolve, while an IP the host cannot route to waits
for a connect timeout. It goes first for callers that read only the first
entry, such as isReady's fallback after a restart.

A blank bootstrap hostname is now treated as unset in both places that read
it. Before, the advertised address fell back to localhost while the
bootstrap response still switched to the host form.

* fix(msk): resolve broker readiness from the container id, not an in-memory map

* fix(msk): release the Kafka host port when setup fails before the container starts

* docs(msk): document the bootstrap-hostname setting

* fix(msk): probe broker readiness on the broker's own Docker network

* test: import LinkedHashMap instead of qualifying it inline

* fix(msk): try the next Kafka host port when Docker reports it in use

When Floci runs in a container, PortAllocator.allocate() probes ports in
Floci's own network namespace, so it cannot see a host process that
already holds one, such as a local Kafka or a second Floci. Docker then
refuses the bind, and startContainer released the port and failed the
cluster even though the rest of the kafka-host-port range was free.
Before the host listener, container mode published no Kafka port, so
this is new with it.

startContainer now goes through PortAllocator.allocateAndStart, as the
ECR registry and EC2 instances do: a port Docker reports as in use moves
on to the next one, and the Redpanda listener args and container spec
are rebuilt for each candidate. allocateAndStart also releases the port
on any other failure before the container runs, volume setup included,
so it replaces the hand-written try.
2026-10-15 11:06:27 -04:00
XuJian 7f8383db38 feat(cloudformation): provision SES email identities (#4812)
* feat(cloudformation): provision SES email identities

* fix(cloudformation): retry pending SES update rollback

* fix(cloudformation): keep recovered SES resource complete

* fix(cloudformation): retain recovered SES state on failed replacement

* test(cloudformation): use shared waiter for SES DKIM verification
2026-10-15 10:26:40 -04:00
Daniël van Ziel fdfc74146e fix(config): scope recorder and rule timing state by account (#5719) 2026-10-15 10:19:49 -04:00
Daniël van Ziel 3ad8c25a4f fix(cognito): validate email attributes before storing users (#5460)
* fix(cognito): validate email attributes before storing users

* fix(cognito): reject escaped and quoted email separators

* fix(cognito): preserve blank attribute deletion on updates

* test(cognito): use inline mocks for final verification services
2026-10-15 09:52:59 -04:00
XuJian 15fb050d91 fix(eks): scope pod identity to the cluster account (#5696)
* fix(eks): scope pod identity to the cluster account

* test(eks): remove invalid cross-account pod identity association
2026-10-15 09:39:54 -04:00
Vũ Thế Huy 77384dc3de feat(redshift-serverless): validate requests against the AWS model constraints (#5641)
* feat(redshift-serverless): validate requests against the AWS model constraints

Generate the input constraints (required members, length, pattern, enum,
number range, list size) from botocore's Redshift Serverless model with
tools/aws/regen_redshift_serverless_shapes.py and vendor them under
src/main/resources/aws, like the DynamoDB request shapes. A new
RedshiftServerlessRequestShapes check runs before dispatch and answers a
ValidationException. Pagination members are left to the services, which keep
reporting InvalidPaginationException.

Move the request parsing and error helpers that the JSON handler, the usage
limit service and the service each carried a copy of into ServerlessSupport,
so the resource families that follow share one implementation.

* fix(redshift-serverless): address review findings on request validation

- Match a model pattern against the whole value, so an unanchored pattern such
  as the account id no longer accepts a value that merely contains a match.
- Count string lengths in Unicode code points, so a tag of 200 supplementary
  characters is not rejected for exceeding 256 UTF-16 units.
- Validate only the actions the handler implements, so a modeled but
  unsupported action keeps answering UnknownOperationException.
- Read every string member through ServerlessSupport.text and reject a tag key
  or value that is not a string, so a numeric nextToken or tag member is a
  ValidationException instead of being treated as absent or coerced.
- Regenerate the vendored shapes from botocore 1.43.113, the version
  tools/aws/requirements.txt pins.
- Cover the rejected-request case with a state check, and add the pattern, code
  point, page token and tag regressions.

* refactor(redshift-serverless): use VendoredResources, ServerlessSupport.notFound and update docs
2026-10-15 09:06:46 -04:00
Matheus Oliveira 340e727ede fix(ec2): prevent deleting the local VPC route and return InvalidRoute.NotFound for missing routes (#5603)
DeleteRoute removed the local route CreateRouteTable seeds for the VPC CIDR
and reported success. Since CreateRoute answers RouteAlreadyExists for that
destination, the route table was left without intra-VPC routing and with no
way to put the route back. DeleteRoute also reported success for a
destination the table does not hold, hiding caller mistakes.

Reject the seeded local route with InvalidParameterValue and report an
unknown destination with InvalidRoute.NotFound, matching AWS. The route is
identified by its CreateRouteTable origin, so a route repointed by
ReplaceRoute stays undeletable while repointed.

The CloudFormation route restore path now tolerates the already-gone
InvalidRoute.NotFound case through CfnDeletes.safeDelete.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-15 07:34:56 -04:00
andrei-fabricdata fc5e1aea0a feat(stepfunctions): emit execution status change events to EventBridge (#5567)
* feat(stepfunctions): emit execution status change events to EventBridge

STANDARD executions now publish "Step Functions Execution Status Change"
events (source aws.states) to the default EventBridge bus on RUNNING,
SUCCEEDED, FAILED, TIMED_OUT and ABORTED, so rules matching aws.states
fire as they do on AWS. EXPRESS executions emit nothing, as on AWS.

StepFunctionsEventPublisher follows the EcsEventPublisher pattern.
RUNNING is published when StartExecution creates the execution, terminal
statuses from the worker's completion callback, and ABORTED from
StopExecution only, so a stopped execution emits exactly one ABORTED.
An idempotent StartExecution and the startup sweep of executions
abandoned by a restart emit nothing.

* fix(stepfunctions): match the documented execution status change event

Address review feedback on the aws.states events:

- Always send stateMachineVersionArn and stateMachineAliasArn, null
  when unused, as AWS's documented events do.
- Report redrive status as the documented examples do: FAILED and
  TIMED_OUT are REDRIVABLE with "Execution is <status> and is
  redrivable"; RUNNING, SUCCEEDED and ABORTED are NOT_REDRIVABLE with
  "Execution is <status> and cannot be redriven".
- Name States.Timeout as the error of a TIMED_OUT event.
- Apply the 248 KiB rule: input is left out when the escaped input
  and output together exceed it, output when the escaped output alone
  does, and inputDetails/outputDetails.included report it.

* test(stepfunctions): check event absences without waiting on empty queues

The integration test long-polled SQS for 2 s after each case to show
nothing more arrived, so the class waited about 10 s by design. It now
asserts only the events that should arrive. The absences that matter
are checked in StepFunctionsServiceExecutionEventsTest: it captures the
completion callback from a mocked AslExecutor and verifies that an
EXPRESS execution publishes nothing and that the worker's callback
after StopExecution adds no second ABORTED.

Add StepFunctionsExecutions.waitForTerminalState to the shared testing
package and use it here; moving the other Step Functions integration
tests onto it is left for a separate PR.
2026-10-15 07:03:30 -04:00
David ad1b225591 feat(cloudformation): apply AssociatedRoles on RDS clusters and instances (#5656)
* feat(cloudformation): apply AssociatedRoles on RDS clusters and instances

AWS::RDS::DBCluster and AWS::RDS::DBInstance ignored AssociatedRoles,
so a CDK DatabaseCluster with s3ImportBuckets deployed with no role on
the cluster.

The roles are now associated when the resource is created, through the
same checks as AddRoleToDBCluster and AddRoleToDBInstance; a list RDS
refuses fails the resource and deletes the new database. An update adds
the roles the template gained and removes the ones the previous
template declared and this one drops, so a role associated outside the
stack is kept. An Aurora cluster member carrying its own
AssociatedRoles is a ValidationError, as the schema calls the property
not applicable there. addRolesToNewDbCluster now also refuses a role
named twice in its own list.

Closes #5638

* fix(cloudformation): follow AWS on repeated roles, and check before changing a database

A renamed instance's predecessor was deleted before the new instance
took its roles, so a refused list left neither; the roles now go on
first. The property is resolved before it is read, so Fn::If around the
list or an entry works and AWS::NoValue leaves it out, and any other
value that is not a list is a ValidationError rather than "no roles".

Repeated roles follow AWS's handlers: an instance skips a role or
feature already associated (AWS ignores DBInstanceRoleAlreadyExists),
while a cluster's list is checked first on an update too, and a role
the template newly declares is always added, so one attached by hand
fails the update with DBClusterRoleAlreadyExists. A rolled back cluster
replacement also restores the record of which roles the stack declared.

* fix(cloudformation): undo a failed role update's own changes

An update changed roles one at a time, so when a later step was
refused the roles it had already added stayed on the database while
the stack restored its old record, and a retry failed on them with
DBClusterRoleAlreadyExists. A refused step now removes the roles the
update added and puts back the ones it removed before the error is
reported. The cluster check also takes the template's engine, now that
it checks feature names, and the roles record reader catches only the
JSON parse error.
2026-10-15 06:59:49 -04:00
Andre Kurait f08a443ec9 perf(lambda): avoid code-copy helper shutdown delay (#5646)
* perf(lambda): avoid code-copy helper shutdown delay

* test(lambda): scope the code-copy fixture threshold

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

* chore(ci): retry the EKS registry fixture check

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

---------

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-15 06:57:38 -04:00
Andre Kurait 5a72b4f561 fix(apigateway): validate imported models in their deployment context (#5645)
* fix(apigateway): resolve imported request model references

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

* fix(apigateway): snapshot request model schemas for deployments

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

* fix(apigateway): match the default body validation error

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

* test(apigateway): expect the AWS default validation message

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

* fix(apigateway): address model snapshot review findings

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

* fix(apigateway): resolve model URLs from deployment snapshots

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

* test(apigateway): make model reference cases collectable

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

* fix(apigateway): accept canonical model URLs in every partition

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

---------

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-15 06:50:46 -04:00
TATSUNO “Taz” Yasuhiro 6f78083080 feat(lambdaweb): Lambda Web Functions control plane (#5706)
* feat(lambdaweb): Lambda Web Functions control plane

The lambda-web service model (apiVersion 2025-03-07) signs as lambda, so
it is served under the lambda service at /2025-03-07/... with the AWS
wire shapes, state words and error wording of the 20 operations on web
functions, revisions, endpoints, tags and the resource policy.

Revisions and endpoints converge at once. They are stored Active and an
endpoint update is stored Successful, while the create and update
responses report the transitional state AWS reports, so a CLI waiter
settles on its first poll. Code comes from an S3 object that must exist.
IamAuth, the resource policy and the endpoint domain are stored but not
served yet.

Part of #5699

* fix(lambdaweb): carry the page position in the token

The nextToken of a list operation was a UUID keyed into an in-memory
anchor map that only grew and was not scoped to the account. The token
is now a core Pagination cursor that encodes the request (operation,
region, account, function, filters and page size) and the cursor of the
item the page ended on. A token reused with other parameters gets the
AWS "does not match the request" error and any other token the AWS
"invalid or has expired" error.

AWS issues UUID tokens and rejects any other shape, so Floci no longer
reproduces the pattern error for a malformed token.

* fix(iam): resolve a Lambda Web revision or endpoint named by its ARN

The route resource for IAM enforcement took the path segment after
revisions or endpoints as the id. A revision or endpoint ARN in that
position carries slashes, so the resource ARN ended in the ARN's first
segment and a policy scoped to the revision or endpoint did not apply.
The id is now the last segment of such an ARN.

* fix(lambdaweb): add the values of a repeated state filter

AWS lists a function when any state filter in the request names its
state. A later state filter replaced the earlier one, so a request with
state=Active followed by state=Failed listed nothing.

* fix(lambdaweb): refuse empty arrays in a resource policy

AWS answers an empty Action or Resource array with the policy syntax
error and an empty principal array with the invalid principal error,
which wins when all three are empty. Floci stored such a policy.

* fix(lambdaweb): judge a wildcard principal by the operator and value of its condition

A trusted condition key alone kept an Allow for every principal out of
the public check. AWS blocks the policy unless a positive operator pins
the key: StringNotEquals and the IfExists forms do not count, nor does a
wildcard in an account value or in the account field of an ARN value,
while a wildcard elsewhere in an ARN and a literal * under StringEquals
do.
2026-10-15 06:46:52 -04:00