Commit Graph
3406 Commits
Author SHA1 Message Date
Mario Toffia ba353021e1 feat(sqs): publish AWS/SQS queue metrics to CloudWatch (#6280)
* feat(sqs): publish AWS/SQS queue metrics to CloudWatch

Every active queue now reports the AWS/SQS metrics once a minute on the
QueueName dimension: the depth gauges, ApproximateAgeOfOldestMessage, the
send, receive, delete and empty-receive counters, SentMessageSize, and for
FIFO queues the in-flight groups and deduplicated sends. The samples follow
what SQS sends on AWS, so alarms, GetMetricData and GetMetricStatistics see
queue metrics without PutMetricData.

The CloudWatch metric store is now journaled under persistent mode, as the
CloudWatch Logs event store is, since it takes a write per metric per active
queue every minute.

Closes #6275

* fix(sqs): stamp queue metrics with the minute that ended

The publisher now ticks just after each minute boundary and stamps its
samples with the minute that ended, so a call counts in the minute it was
made instead of the minute of a startup-relative tick. A queue whose write
fails no longer stops the others, and the log names it. A queue deleted and
created again between the snapshot and the lookup is skipped instead of
reporting the old queue's depth under the new one.

* fix(sqs): bound AWS/SQS metric history and finish the tick on shutdown

The publisher now drops AWS/SQS datapoints older than the 15 days AWS keeps
one-minute data, once an hour, so the history it generates for an active
queue stays bounded. On shutdown it stops before the storage flush and waits
for a running tick, so the last minute is not written after the store closed.

* test(sqs): keep the scheduled metrics tick out of the test run

The acceptance test publishes its own ticks, but the scheduled one could
still stamp the test queue's depth into a complete period newer than them,
since a tick stamps the minute that just ended. floci.services.sqs.
cloudwatch-metrics-enabled now turns the tick off, and the test
configuration does, as it does for the S3 lifecycle sweep. It also lets a
user opt out of the AWS/SQS metric volume.

* test(sqs): build the metrics test's queue service with SqsServiceFactory
2026-10-23 06:57:51 -04:00
Robin BaeckmanandRobin Baeckman 204231d4b3 fix(eks): restore persisted clusters at startup (#6214)
EksService restores persisted clusters in @PostConstruct, but CDI creates
the bean on first use. After a restart no cluster's k3s container came
back until something called the EKS API, so workloads on it stayed down.
EmulatorLifecycle now calls EksService.restorePersistedRuntime from
onHttpStart, after the start and ready hooks. It waits for the IMDS server
to start, because a recreated cluster's Pod Identity and IMDS relays probe
Floci's HTTP port and IMDS before they route pod traffic there. It runs
after the hooks so they and the ready line don't wait minutes for k3s.
If the restore throws, it is logged and the emulator stays up; EKS
requests retry creating the service, as before.

EksBootRestoreIntegrationTest boots a fresh application with EKS out of
mock mode and checks EksService was created without an EKS request, as
EcsBootReconcilerIntegrationTest does for ECS. Its profile pins the HTTP
port, since onHttpStart acts only on quarkus.http.port.

Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
2026-10-23 06:55:02 -04:00
Aniket Shukla bc760f743d fix(ec2): list requested launch template versions (#6329) 2026-10-23 06:51:28 -04:00
Alessandro Lattao 3944d6edc2 fix(dsql): enforce IAM and the cluster's policy on the control plane (#6328)
* fix(dsql): enforce IAM and the cluster's policy on the control plane

A cluster's resource-based policy governs DSQL's control plane as well as
its connections (measured, eu-west-1): a Deny of dsql:GetCluster,
UpdateCluster, TagResource or GetVpcEndpointServiceName refuses that call,
and a call it does not name still answers. With IAM enforcement on, Floci
left every DSQL control plane route unchecked: no rule in
IamActionRegistry mapped one, so the policies, identity or resource, were
never read there.

IamActionRegistry maps every operation of DSQL's model to its action, the
stream operations Floci does not serve included, and
IamRestRouteCoverageTest now checks all of them against botocore's routes,
vendored for DSQL by regen_rest_routes.py. ResourceArnBuilder names the
resource each call is checked against, as the Service Authorization
Reference gives it: the cluster, the stream, or the ARN a tagging route
names, minted in the request's partition. CreateCluster and ListClusters
are checked against cluster/*, as DSQL checks them (measured; the
reference lists ListClusters with no resource). The enforcement filter
then reads the cluster's policy through DsqlResourcePolicyProvider, as it
reads a topic's or a function's.

* fix(dsql): check tagging at /tags too, where the ARN is in the query or body

Asked in review: Floci serves DSQL's tagging at /tags as well as at
/tags/{arn}, naming the ARN in the resourceArn query parameter or body field,
and the rules matched only the path form, so a bare /tags call reached DSQL's
tag handler unchecked. The rules now match both, as Scheduler's do, and the
control plane test tags, lists and untags through each form.
2026-10-23 06:51:19 -04:00
Kenshin Okinaka eea87ca998 fix(ses): answer SES v2 wire-type errors with AWS's messages (#6330)
* fix(ses): answer SES v2 wire-type errors with AWS's messages

A scalar for a map member is "Expected map or null", a string, boolean,
object or list for an integer member gets the Integer conversion message,
and a number is narrowed to an int the way AWS reads it (1.5 is accepted,
a value above the int range saturates before the range check). A body that
is not a JSON object is a SerializationException instead of a BadRequest.

* test(ses): give the new SES v2 tests their own order and share the non-object bodies
2026-10-23 06:51:16 -04:00
Robin BaeckmanandRobin Baeckman b806f76f1b fix(rds): forward a PostgreSQL CancelRequest to the backend (#6127)
A client cancels a running query by opening a second connection and
sending a CancelRequest: the backend's process id and secret key from
the BackendKeyData it received at login. The RDS proxy only knew
SSLRequest and StartupMessage, so it logged "Unexpected PostgreSQL
startup protocol version: 80877102" and closed the connection. The
cancel never reached PostgreSQL and the query kept running.

The client already holds the backend's own key, because the proxy
relays BackendKeyData unchanged. So the proxy now passes the 16 bytes
to the backend on a connection of its own and closes, as the server
does. A cancel of any other length is dropped with its own warning.
Redshift clusters share this handler, so they forward cancels too.
A DB proxy endpoint drops a cancel, because RDS Proxy does not support
one.

The RDS integration tests now share their Docker check and their
CreateDBInstance and DeleteDBInstance calls in RdsRequests. The Docker
check uses DockerAvailability, so only a missing daemon skips a test.

Limits: a cancel still takes one of the proxy's connection permits, so
a proxy at its connection limit refuses it, where PostgreSQL itself
would not. And on an auto-paused Aurora backend, a cancel resumes it,
as any other connection does.

Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
2026-10-23 06:46:59 -04:00
Andre Kurait 686d0b5f02 fix(storage): publish replacement batches atomically (#6324)
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-23 06:46:52 -04:00
TATSUNO “Taz” Yasuhiro 80e5df933b fix(dynamodb): show table creation times to the millisecond (#6325)
* fix(dynamodb): show table creation times to the millisecond

* chore(dynamodb): share the time range check between the tests
2026-10-23 06:46:49 -04:00
Aniket Shukla 33620a59c0 fix(logs): preserve and filter log group classes (#6312)
* fix(logs): preserve and filter log group classes

* fix(logs): format class validation with Smithy errors
2026-10-23 06:43:37 -04:00
TATSUNO “Taz” Yasuhiro e7ca14b03b fix(lambdaweb): apply a revision's NODE_OPTIONS as AWS does (#6290)
* fix(lambdaweb): let heap flags in NODE_OPTIONS replace the defaults as AWS does

AWS drops both of its heap flags when NODE_OPTIONS names
--max-old-space-size or --max-semi-space-size, and puts those on the
command line in their place. Floci kept its own flags, so a larger heap
set in NODE_OPTIONS lost to --max-old-space-size=1024.

* test(lambdaweb): copy a quoted heap value from NODE_OPTIONS as AWS does

AWS puts --max-old-space-size="1536" on the node command line with its
quotes. Node refuses that value, so the start fails with
Runtime.ExitError.

* docs(lambdaweb): put the NODE_OPTIONS sentences after the require.main one

* test(lambdaweb): share the default heap flags in the NODE_OPTIONS tests
2026-10-23 06:43:27 -04:00
Andre Kurait 238d16e541 feat(lambda): initialize provisioned concurrency environments (#6320)
Initialize and route qualifier-owned provisioned environments without invoking handlers during initialization. Keep configuration outcomes committed while failed removal remains owned for retry, and bound cleanup after late invocation release. Preserve on-demand spillover and the separate alias-retargeting stage.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-23 06:35:02 -04:00
Alessandro Lattao f60cf120c6 fix(dsql): evaluate the cluster's resource-based policy on connect (#6319)
DSQL evaluates a cluster's resource-based policy when a client connects
(measured, eu-west-1): an explicit Deny that applies to the caller refuses
the connection with the hint "User: <caller> is not authorized to perform:
dsql:<action> on resource: <cluster ARN> with an explicit deny in a
resource-based policy", under the statement's conditions, aws:PrincipalArn
and aws:SourceIp among them, and a statement that does not apply leaves the
caller's own policies to decide. With IAM enforcement on, the endpoint
checked only the caller's identity policies.

DsqlResourcePolicyProvider supplies a cluster's policy through
ResourcePolicyProviders, as the SNS and Lambda providers do, and the
endpoint evaluates it with the caller's policies and SCPs as
LambdaTaskAuthorizer and LambdaWebIamAuth evaluate a function's policy:
evaluateResourcePolicyFor, then evaluateResolvedResourcePolicy, with the
client's address as aws:SourceIp. With enforcement off nothing is
evaluated, as for every other policy in Floci.

DsqlService already built the cluster policy's context for the lockout
check and the "is not authorized" sentence for the tag refusals; both now
come from DsqlPrincipals (policyContext, notAuthorized), which the endpoint
uses too, instead of a third copy.

The policy also governs control plane calls on DSQL (measured), but Floci's
IAM enforcement names DSQL's control plane resources as *, so that is left
as it is.
2026-10-23 00:01:44 -04:00
TiM 212a424ed2 fix(s3): keep Object Lock buckets versioning-enabled (#6322)
A bucket with Object Lock is versioned for good. PutBucketVersioning
with Suspended on such a bucket now answers 409 InvalidBucketState and
leaves it Enabled, and PutObjectLockConfiguration on a bucket whose
versioning is unset or suspended answers 409 InvalidBucketState and
enables nothing, matching the AWS-recorded messages. CloudFormation goes
through the same PutBucketVersioning path, so an update that suspends a
locked bucket rolls back.

Both checks run with the write under the bucket monitor, and CreateBucket
with Object Lock now enables versioning and the lock in one step, so no
concurrent request can leave a locked bucket suspended.

Buckets stored in either state by an earlier release load as they were;
the null-version protection for them is unchanged, and its tests now set
that state on the stored bucket.
2026-10-23 00:00:01 -04:00
Priamo Germosen 63d577a245 feat(emr-serverless): tag job runs and report their attempts (#6297)
TagResource, UntagResource and ListTagsForResource now take job run ARNs
(.../applications/<id>/jobruns/<id>), which the model's ResourceArn
allows ("the supported resources are Amazon EMR Serverless applications
and job runs"). They work on the tags StartJobRun stores, so GetJobRun
reports the current set, under the same rules as an application's: at
most 50 tags, no "aws:" prefix. An ARN must be the run's own, so one of
another application or account names nothing, and once an application
is deleted its runs' ARNs name nothing, as its own ARN already does. A
session ARN, which the pattern also allows, now answers
ResourceNotFoundException rather than ValidationException, as sessions
are not emulated.

ListJobRunAttempts (GET .../jobruns/{jobRunId}/attempts) and GetJobRun's
attempt parameter report attempts. Nothing runs, so no run fails and
none is retried: every run is one attempt, number 1, created and updated
with the run. GetJobRun, ListJobRuns and ListJobRunAttempts carry it.
GetJobRun with attempt 1 or none returns the run; another attempt
answers ResourceNotFoundException, in Floci's words, as no source shows
AWS's answer for an attempt a run never made, and leaves the run as it
was.

Also from the #6202 review:

- From release emr-7.11.0 a BATCH run's executionTimeoutMinutes must be
  1 to 10080. The model: "the maximum value is 10080 minutes (7 days)
  starting with Amazon EMR release 7.11. Setting a value of 0 to disable
  the timeout is no longer supported for BATCH mode job runs." Earlier
  releases and STREAMING runs keep 0 to 1,000,000. No source gives the
  error; ValidationException, in Floci's words. The check runs before
  auto-start, under the application's lock, so a refused run leaves the
  application as it was.
- ListJobRuns refuses a state or mode that does not exist and more than
  8 states, and ListApplications a state that does not exist and more
  than 7, with the framework ValidationException. A typo listed nothing
  before. ListApplications' maxResults outside 1 to 50 now answers the
  same framework message, joined with any states violation.
- EmrServerlessRegionIntegrationTest uses EmrServerlessRequests, which
  gains tagsPath, and pins a job run ARN across Regions;
  EmrServerlessTagIntegrationTest moves onto the same helpers.

The enum and range violations are now SmithyValidationErrors.notInEnum,
notAllInEnum and outOfRange, which EMR Serverless uses.

Part of #6046 (part 9).
2026-10-22 22:22:03 -05:00
Priamo Germosen 581cd62790 perf(codeartifact): parallelize per-version metadata fetches in ListPackageVersions (#6262)
Qodo follow-up from #6204: PypiserverSidecarClient and ReposiliteSidecarClient each made
one sequential HTTP request per version (a HEAD per pypi release, a details GET per Maven
version) before CodeArtifactService paginated, so even a one-result page waited on every
version's own round trip.

Both now run their per-version requests through a new shared SidecarConcurrency.mapBounded,
capped at 8 concurrent requests per sidecar container. The cap is enforced by a shared,
per-container permit (keyed by pypiserver's repositoryContainerId, or a single constant for
Reposilite's one shared container) rather than a per-call-only limit, so two simultaneous
listPackageVersions calls against the same container still can't exceed 8 requests between
them. Tasks run on a virtual-thread-per-task executor, not a platform-thread pool: mapBounded
submits every item up front and lets the semaphore do the real gating, so a package with
thousands of versions doesn't start that many platform threads per call, each just parked in
Semaphore.acquire(). A failure (or the caller being interrupted) also cancels the rest of the
call's work, instead of leaving it running against the sidecar after the call has already
failed. Results stay in input order and a failing item still fails the whole call, matching
the original sequential behavior exactly.

Verified with unit tests for the helper (ordering, the per-container concurrency cap, the
cap holding across two simultaneous calls sharing a container, exception propagation,
cancellation of the rest of the work after an early failure) and a 12-version Docker-gated
test per format against the real pypiserver and Reposilite sidecars, on top of the existing
single-version coverage.
2026-10-22 22:21:52 -05:00
Andre Kurait 6bc598fbfd feat(lambda): add provisioned concurrency configuration APIs (#6317)
Add the requested control-plane stage: Put/Get/Delete validation, persistent desired configuration, qualified IAM resources, and cleanup on version, alias, and function deletion. Share the function concurrency lock with reservation changes. Runtime initialization and invocation routing remain separate.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-22 23:19:11 -04:00
Priamo Germosen 27338a62b7 feat(iam): answer GetHumanReadableSummary for a delegation request (#6298)
The ninth and last operation of IAM temporary delegation, and the last one the
model publishes that is not an M3 404: a delegation request now comes back as a
Markdown summary instead of UnsupportedOperation, which takes IAM to 177 of the
180 operations botocore 1.43.113 publishes.

AWS generates that text with a large language model, so this is the one piece of
the family that cannot be its answer. What is sourced is the format, the
reference's own example answering "Human readable summary in Markdown format",
and the shape: EntityArn 20 to 2048, Locale 2 to 12, SummaryContent up to 10000
characters and the four SummaryState values. Every line is read off the record,
so one request summarizes the same way twice: what is being asked for, by whom,
for how long, and where it has got to. The services and actions the console
credits its AI summary with are the one half missing, for the same reason
nothing renders a PermissionPolicy here, that no API registers the template AWS
resolves one from, so the template and its parameters are named instead.

Who may read a summary is who may read the request, which the reference states
outright, so the lookup is GetDelegationRequest's and so is the NoSuchEntity it
answers. The request is authorized against the ARN Floci mints around the id
EntityArn names, which is the one its five by-id siblings already resolve: a
policy naming one request authorizes that request alone, and a deny on it holds
however the caller respells the ARN. An ARN of another service names no request
of IAM's to summarize.

Four answers are chosen rather than read, each recorded in docs/services/iam.md:
an ARN of another entity type is NOT_SUPPORTED, a locale Floci does not write is
NOT_AVAILABLE with no content, a value that is no ARN at all is the modeled
InvalidInput, and an id inside a well formed ARN that no id could match is
NoSuchEntity rather than a constraint failure.

The text is the requester's, and the summary is Markdown, so it is escaped
rather than passed through: the model lets a description, a message and a
parameter value carry newlines and backticks, which would otherwise forge a
heading, a bullet or a code span inside a document read as Floci's own account
of the request. A parameter value the record does not hold is left out, and an
indexed value arriving as a key with nothing under it is no longer stored as
one.
2026-10-22 21:55:05 -05:00
Priamo Germosen 27caa82349 refactor(core): move the Query list member pattern into a shared helper (#6306)
PassedRoles, in core.common, read a Redshift cluster's roles through
RedshiftQueryHandler.memberKeyRegex, so core depended on a service class.
The pattern now lives in core.common.AwsQueryLists, and both call it.

AwsQueryLists reads a list's numbered members in the three forms the
Redshift and RDS handlers accepted: the generic List.member.N, List.Name.N
when the list's shape names its member, and a bare List.N, every N in
numeric order with no stop at a gap. memberKeys gives the key pattern,
values the non-blank values, and memberIndex the number a key ends in,
which the Redshift handler also sorts its integration filters and
parameters by.

The Redshift and RDS handlers each keep their table of the names their
list shapes give their members (Redshift's SubnetIdentifier and
IamRoleArn, RDS's OptionName and AttributeValue, and so on) and pass the
name in, so the helper holds nothing specific to either. RDS had its own
copy of the reader, memberKeyRegex and numericSuffix included, and now
calls the helper too. PassedRoles names IamRoleArn for IamRoles and
AddIamRoles, the way its other cases name the members the handlers read.

No behaviour changes: the same keys are matched, in the same order, and
the same values read.
2026-10-22 21:54:54 -05:00
Suja Shaj d3c2dbb1d9 fix(ec2): skip addresses stored resources hold when the VPC network allocates (#6284)
* fix(ec2): skip addresses stored resources hold when the VPC network allocates

The VPC network's allocator reads only its lease table, but a launch that
names an address while a failed launch is still giving it back keeps the
address without a lease, and so does a network interface created with its
own address. assignPrivateIp now asks for another address while the one it
got is held by a stored instance, network interface or NAT gateway in any
account, so a later launch's Docker attach no longer fails on an address
that is already in use. The addresses it walks past are given back once it
is done, since their holders took no lease of their own.

Closes #6283

* fix(ec2): keep the fallback off addresses the VPC network walk skipped

When the walk past held addresses runs the Docker-backed allocator dry,
the synthesised fallback checked only the caller's account, so on a shared
default subnet it could hand out the address another account's resource
holds. It now skips the addresses the walk found held as well.

* test(ec2): share the mocked-network and RequestContext setup in Ec2ServiceTest

requestContexts builds the RequestContext CDI mock that four helpers and
tests each built for themselves, and mockedVpcNetworkService replaces the
mock-mode new Ec2Service(..., vpcNetworks) the private-address tests
repeated. The comment on why jakarta.enterprise.inject.Instance is written
out in full lives in requestContexts.
2026-10-22 22:33:30 -04:00
Aniket Shukla 95387d1906 fix(s3): include bucket regions in parameterized listings (#6315) 2026-10-22 22:29:38 -04:00
Ben Wart 4c49f23c80 feat(dynamodb): journal per-table items one record per item in wal mode (#6310)
* feat(dynamodb): journal per-table items one record per item in wal mode

With the per-table item layout, wal mode still kept the single-file
WalStorage, whose log record for any item write is the whole table and
whose compaction rewrites a snapshot of every table.

Give the partitioned item store a journal mode for wal. Each write
appends one record per changed item to dynamodb-items/journal.wal, and
compaction, on the WAL compaction interval, rewrites only the shards
changed since the last one and then empties the journal. Load replays
the journal over the shard files.

- Writes hold off compaction while they change memory and append their
  record, so the journal never drops a record whose change is not yet
  in a shard file; compaction waits until load has replayed the journal
- A change the journal cannot take is compacted into its shard at once,
  and the write fails if that fails too
- Replay stops at a torn or unreadable record, including one that
  decodes to null, and cuts it off
- A journal that cannot be emptied is reopened, so later writes are
  still appended

Part of #6293

* fix(dynamodb): journal changes to one key in the order they were applied

Changes held only the shared side of the compaction lock, so a second
write to the same item could update memory after the first and still
append its record ahead of it. Replay follows the journal, so a restart
before compaction restored the older value.

Hold a per-key lock across the in-memory update and the journal append.
Changes to different keys commute and stay concurrent.

* fix(dynamodb): stop appending to a journal after a failed write

A failed append could leave part of its record in the file while the
writer stayed open. If the fallback compaction also failed, the next
append succeeded behind the torn record, and replay cut it off with it,
losing a write the caller saw succeed.

Close the writer when a write fails, so every later change falls back to
compaction until a compaction replaces the file and reopens the journal.

* fix(dynamodb): treat a journal key that is not UTF-8 as unreadable

Replay decoded keys leniently, so corrupt key bytes became U+FFFD and
the record was applied to a different key, then kept by the next
compaction.

Decode journal strings with a strict UTF-8 decoder and end replay at a
record whose key or entry key does not decode, like any torn record.

* fix(dynamodb): fail load when the journal cannot be read

Replay logged an I/O error (or a failure to read the journal's size)
and returned normally, so load marked the store ready with records left
unapplied. The next compaction then wrote the partial state to the shard
files and emptied the journal, deleting writes that had been
acknowledged.

Replay now throws on any failure other than a torn or undecodable tail,
and load turns that into a startup failure that leaves the journal
untouched, as a failed migration does. A directory where the journal
goes still counts as holding no records.

* fix(dynamodb): fold a leftover wal journal when per-table runs in another mode

Only wal mode read journal.wal. A wal-mode run that ended without
compacting left its changes there, and a restart in persistent or
hybrid mode ignored them: they were lost, and a later return to wal
replayed them as stale changes over newer shard files.

On load in another mode, replay a non-empty journal.wal, write the
shards it changed and remove it. Fail to start, keeping the file, if a
shard cannot be written or the file cannot be removed.
2026-10-22 22:27:08 -04:00
Ben Wart 4f45541d44 fix(dynamodb): save each batch item inside its own item lock (#6314)
With a store that writes single items, BatchWriteItem saved its items
in one pass after the item locks were released. That pass could read
an item, lose the race to a concurrent write of the same key, and then
save the stale copy over it. Save each item inside its write, as
PutItem and DeleteItem do; a whole-table store still saves once at the
end.
2026-10-22 22:26:04 -04:00
Andre Kurait 2babe62ce4 fix(stepfunctions): retain claimed callback outcomes (#6311)
Retain accepted outcomes under the token lock without waiting for callback-thread completion. Retire tokens registered throughout reset, including overlapping resets, and complete futures outside the lock. Cover callback, reset, discard and timeout interleavings.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-22 22:17:45 -04:00
Andre Kurait d7db2276df fix(stepfunctions): atomically close expired callback tokens (#6307)
Select timeout and retire its token under the callback and heartbeat lock. Preserve an already-claimed callback and heartbeat extensions; cancel outside the lock.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-22 21:35:04 -04:00
floverfelt a29df66d33 fix(ecr): never start the registry container while ECR is disabled (#6281) 2026-10-22 21:29:53 -04:00
Ben Wart 7635345474 feat(dynamodb): opt-in per-table item files, split into shards (#6303)
* feat(dynamodb): opt-in per-table item files, split into shards

Every table's items live in one dynamodb-items.json, and any item write
rewrites all of them. A small table that changes often, such as a node
heartbeat table, then keeps rewriting every large table beside it.

Add an opt-in item layout. With item-layout: per-table, items are stored
under dynamodb-items/ as item-shards files per table, and a write saves
only the items it touched:

- persistent rewrites the one shard file that holds the item before the
  write returns, and fails the write when that file cannot be written
- hybrid marks the shard dirty and writes dirty shards on the flush
  interval; an explicit flush or shutdown reports shards it could not
  write
- wal keeps the single-file layout for now and logs a warning

The default, single-file, is unchanged.

On first start, an existing dynamodb-items.json, or a wal snapshot and
log, is migrated through a staging directory moved in place in one step
and then renamed .migrated; a failed migration stops startup and leaves
the old files untouched. DynamoDbService writes single items through the
new MapEntryWriter, and the TTL sweeper removes each item under its item
lock.

Part of #6293

* test(storage): skip read-only directory tests where POSIX permissions are missing
2026-10-22 21:27:19 -04:00
Aniket Shukla 201ce60b61 fix(organizations): accept documented management policy types (#6305) 2026-10-22 21:16:29 -04:00
Aniket Shukla 133ad743ae fix(rds): include ARNs for default cluster parameter groups (#6287)
* fix(rds): include ARNs for default cluster parameter groups

* test(rds): share SDK client fixture
2026-10-22 21:15:50 -04:00
TiM e01fbd8bf8 fix(s3): preserve archived null versions (#6104)
* fix(s3): preserve archived null versions

* fix(s3): address null version archive review

Preserve locked null versions under new versions and markers while checking protection before suspended cleanup. Avoid locking never-versioned body reads, reject reserved service keys, and recover original null bodies and metadata after failed publication.

Remove obsolete marker bodies and retry reads that race marker creation. Refresh promoted null generations so archival and configuration rollback cannot hide a body replacement.

* fix(s3): serialize null version metadata updates with promotion

Hold the bucket monitor while resolving, validating and persisting retention, legal hold and ACL changes so promotion cannot discard an acknowledged update. Cover the race with a two-thread regression and preserve numbered-version references during demotion.

* fix(analysis): protect null history after bucket configuration rollback

Apply archived-null protection and cleanup in every non-enabled mutation path so restoring an unversioned bucket configuration cannot erase locks or leave stale history. Cover replacement, deletion and protected annotations in memory and disk modes.

* fix(analysis): assert preservation immediately after each denied operation

Check current and archived bytes before another request can repair corruption, use a distinct copy source, and compare replacement metadata with the listed null entry.

* fix(analysis): compare listed null history with replacement metadata

Assert the null listing identifies the latest replacement and its ETag so stale history cannot satisfy the count-only check.

* fix(analysis): qualify missing null version documentation

Describe keys that have no null version without excluding keys that gain one after versioning is suspended.

* fix(s3): retain archived null history until replacement publication succeeds

Keep the archived body, metadata and annotations when a non-enabled replacement metadata write throws, including after configuration rollback. Clean history after successful publication under the bucket monitor and cover failures before and after publication in memory and disk modes.

* fix(s3): restore the current pointer after archived null publication failures

Recover the prior current body and metadata when a non-enabled PUT with archived null history fails publication. Handle numbered versions, promoted null versions and markers with a fresh read generation, and keep archive annotations publicly associated with their original version. All 199 focused tests pass.

* test(s3): prove reads retry across failed publication recovery

Observe replacement bytes during a publication fault and require latest and explicit-null reads to retry against the restored promoted null version. Both new cases and all 27 archive/read tests pass.

* docs(s3): use repository punctuation style

Replace existing em dash punctuation in the touched S3 service documentation as required by the repository documentation rules.

* fix(analysis): assert canonical cleanup when failed publication restores a marker

Check memory payloads and the disk canonical path before retrying, so the marker-before-publication cells detect orphaned replacement bodies as well as metadata restoration. All 27 archive/read cases pass.
2026-10-22 21:12:45 -04:00
Andre Kurait 4a0650467a fix(lambda): bound on-demand container shutdown (#6299)
Close admission during drain and retain failed removal ownership. Retry late releases within a separate bounded cleanup attempt, validate drain configuration at startup, and safely reopen after reset.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-22 21:08:46 -04:00
Andre Kurait 504e0dfde7 fix(lambda): retain event source qualifiers at invocation (#6288)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-22 20:55:44 -04:00
Ben Wart 2ae6d16936 fix(storage): reopen the WAL when compaction cannot delete the old log (#6302)
* fix(storage): reopen the WAL when compaction cannot delete the old log

WalStorage.compact closed the log writer, deleted the log and reopened
it. When the delete failed, the IOException skipped the reopen, so the
writer stayed null and every later write lived only in memory until the
next successful compaction; a crash in between lost them.

Reopen the writer in a finally block, so appends continue even when the
old log could not be removed.

* test(storage): skip the read-only WAL test where POSIX permissions are missing
2026-10-22 20:50:18 -04:00
Ben Wart 9640dabe0f refactor(storage): share the atomic write and flush scheduler helpers (#6301)
HybridStorage, PersistentStorage and WalStorage each carried their own
copy of two steps: writing a file through a sibling .tmp file that is
then moved over it, and running a periodic flush or compaction on a
daemon thread that shutdown waits up to 5 s for.

Move both into a package-private StorageFiles helper
(writeAtomically, scheduleEvery, stop) and use it from all three.
Behaviour is unchanged: same temp-file name, same move options, same
thread names and the same 5 s shutdown wait.
2026-10-22 20:47:28 -04:00
Vũ Thế Huy 99ef36998c feat(firehose): retry failed Redshift COPY loads every five minutes (#6111)
* feat(firehose): retry failed Redshift COPY loads every five minutes

Retry failed Redshift loads oldest-first against the staged object every 5 minutes until RetryOptions.DurationInSeconds has passed, preserving the staged batch in S3 and dispatching retries to the delivery executor.

* fix(firehose): harden Redshift staged COPY retries and queue concurrency

- Throttle pending COPY drain tasks per stream using single-flight execution
- Check retry window expiration before executing subsequent COPY attempts
- Measure retry backoff interval from failure completion rather than attempt start
- Atomically enqueue pending batches to prevent detached queues during empty cleanup
- Stop draining immediately if the stream is deleted

* fix(firehose): drop pending Redshift COPY retries if destination is removed

* fix(firehose): measure retry window from attempt start and consolidate retry tests

* docs(firehose): clarify Redshift retry window starts with first attempt
2026-10-22 20:42:54 -04:00
Andre Kurait 433ab5aefc fix(iot): release rule capacity when worker evaluation ends (#6272)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-22 20:05:15 -04:00
TATSUNO “Taz” Yasuhiro 9790b5fe46 fix(dynamodb): check backup ARNs as AWS does (#6291)
* fix(dynamodb): check the account of a backup ARN before the rest of it

* fix(dynamodb): check the table name and partition of a backup ARN

* fix(dynamodb): check the ListBackups ExclusiveStartBackupArn as AWS does
2026-10-22 20:03:07 -04:00
Alessandro Lattao 1f25fd88cf fix(dsql): take TLS started with no SSLRequest, as DSQL does (#6296)
DSQL's own connectors, and libpq's and pgjdbc's sslnegotiation=direct, start
TLS at once with no SSLRequest. The endpoint read their ClientHello as a
plaintext startup packet and refused it as not TLS.

The endpoint now reads a connection's first byte. A TLS handshake record goes
straight to the handshake with that byte handed back, and anything else takes
the SSLRequest path as before. The byte is TlsProxyServer's TLS_HANDSHAKE, now
public, the one the TLS proxy already tells TLS apart by; its peek runs on a
Vert.x socket, the endpoint's on a blocking one, so only the constant is
shared.

As DSQL does (measured, eu-west-1): the endpoint picks the ALPN protocol
postgresql whenever a client offers it, after an SSLRequest too, and none
otherwise; a direct handshake that does not end with postgresql picked
completes and the connection closes without a message.

DsqlWireClient opens TLS through one handshake helper, with an ALPN list,
after an SSLRequest (tls) or at once (direct), and signs in separately.
2026-10-22 19:47:44 -04:00
Andre Kurait d3359662e5 fix(stepfunctions): preserve callback token ownership (#6271)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-22 19:39:20 -04:00
Aniket Shukla efc693ad17 fix(ssm): include parameter ARNs in describe metadata (#6289) 2026-10-22 19:39:16 -04:00
Dmitriy Polomoshnov f94e0583b7 fix(dynamodb): evaluate legacy Expected under the item lock (#6278)
* fix(dynamodb): evaluate legacy Expected under the item lock

PutItem, UpdateItem and DeleteItem evaluated a legacy Expected condition
in the request handler, against an item read before the per-item lock was
taken, and only then called the locked write. Concurrent writers holding
the same version could all pass the check, so an optimistic-locking
client saw several of them accepted where DynamoDB accepts exactly one.

The handler still validates the Expected map, but now hands its
evaluation to the service, which runs it against the stored item under
the same lock as the write, beside ConditionExpression. PutItem with
ReturnValues ALL_OLD now returns the item the put replaced instead of
that earlier read.

Closes #6276

* fix(dynamodb): report key errors before legacy Expected errors

Validate the table and the key a write names before the legacy Expected
map, as the handler's earlier unlocked read did, but without reading the
stored item. UpdateItem and DeleteItem keep their key-argument wording;
PutItem now reports its item-body wording whether or not the request
carries Expected or ReturnValues ALL_OLD, matching a plain PutItem.

* test(dynamodb): share the round loop of the legacy Expected race tests

Rename the class to DynamoDbLegacyExpectedIntegrationTest now that it
also covers error precedence.

* test(dynamodb): share the start-gate helper and the DynamoDB request helper

Move the start-gate thread pool from DynamoDbConcurrencyIntegrationTest
into testing/StartGate, which returns each task's result along with any
errors, and use it from DynamoDbLegacyExpectedIntegrationTest too. The
legacy Expected test now sends its requests through DynamoDbRequests.ddb
instead of its own copy.
2026-10-22 19:20:46 -04:00
Priamo Germosen 94c4572fed feat(stepfunctions): add the elasticmapreduce optimized integrations (#6261)
A Task can now use the optimized EMR integrations the Step Functions
guide lists: createCluster, setClusterTerminationProtection,
terminateCluster, addStep, cancelStep, modifyInstanceFleetByName and
modifyInstanceGroupByName, with .sync for createCluster, terminateCluster
and addStep. Each calls Floci's EMR in the state machine's Region under
the guide's field names: ClusterId for JobFlowIds or JobFlowId, a single
Step or StepId, and the instance fleet or group found by name through
ListInstanceFleets or ListInstanceGroups. They failed with "Unsupported
resource" before.

A .sync Task records TaskSubmitted with the call's result and polls
DescribeCluster or DescribeStep under the Task's TimeoutSeconds and the
execution's budget, as ecs:runTask.sync does. Its result is the describe
response with the call's result after it, which is the createCluster.sync
output recorded on AWS (Cluster, then ClusterId). A step that ends FAILED,
CANCELLED or INTERRUPTED, or a cluster that terminates before WAITING,
fails the Task with States.TaskFailed and the describe response as the
cause. A wait that ends early cancels the step of an addStep.sync; a
cluster is left running, as the guide says Step Functions does.

An EMR error is named after the SDK exception class under EMR.:
InvalidRequestException and InternalServerException keep their names,
and any other code is EMR.AmazonElasticMapReduceException, as AWS reports
a ValidationException. createCluster refuses
KeepJobFlowAliveWhenNoSteps other than true and Steps, as the guide
requires, with States.TaskFailed and the guide's wording for each rule.
A Task without the ClusterId its API acts on, a cancelStep without a
StepId and a ByName request without its name fail the same way.

AddJobFlowSteps on an unknown cluster, or on one in another Region, now
answers ValidationException "Specified job flow ID does not exist.", as
AWS does: a botocore ClientError (raster-foundry/raster-foundry#352) and
a CloudTrail record on AWS re:Post show it. It answered DescribeCluster's
InvalidRequestException. That re:Post record is an addStep.sync failing
on an unknown cluster with EMR.AmazonElasticMapReduceException, which
addStep now reports as well.

ModifyInstanceGroups and ModifyInstanceFleet on a terminated cluster,
which modifyInstanceGroupByName and modifyInstanceFleetByName reach, now
answer as AWS does too: ValidationException "An instance group may only
be modified when the cluster is running or waiting."
(hashicorp/terraform-provider-aws#1355 and hashicorp/terraform-provider-aws#9400)
and InvalidRequestException "A job flow that is shutting down,
terminated, or finished may not be modified." with ErrorCode
INVALID_JOB_SHUT_DOWN (hashicorp/terraform-provider-aws#31375). Both answered InvalidRequestException "Cluster <id> is
terminated.", which no AWS response shows, and EMR's error body now
carries an error's extra members such as ErrorCode.

TerminateJobFlows, the four Set* cluster setters and CancelSteps now
refuse a request without a member their model requires (JobFlowIds and
the setting, or StepIds) with AWS's framework ValidationException, as
RunJobFlow does for Name. They read a missing list as empty and a missing
setting as its default and answered success, which the
setClusterTerminationProtection and terminateCluster integrations reached
too. The "Member must not be null" violation is now one helper in
SmithyValidationErrors.

Part of #6046 (part 10).
2026-10-22 17:06:23 -05:00
Priamo Germosen c094ce3973 feat(sts): dispatch AssumeRoot and authorize centralized root access (#6251)
Floci dispatched the five operations that turn centralized root access on
and off and nothing that uses it, so the feature was half emulated:
AssumeRoot, the operation they exist for, answered UnsupportedOperation. The
five took no caller check of their own either, so any account could enable
or disable organization wide root features, and the record they wrote was
scoped to the calling account, which left the management account's toggle
invisible to a delegated administrator.

All five answer for one organization now, so all five check the caller, and
each refusal is a shape the reference models on them and on nothing else: no
organization is OrganizationNotFound, one without All features is
OrganizationNotInAllFeaturesMode, one without trusted access for IAM is
ServiceAccessNotEnabled, and a caller that is neither the management account
nor a delegated administrator is
AccountNotManagementOrDelegatedAdministrator. The two enable operations add
CallerIsNotManagementAccount, modeled on them alone, so a delegated
administrator may read the features and turn them off but not on. The
feature set belongs to the organization, so it is read and written in the
management account's scope whoever asks, and the OrganizationId the model
declares beside EnabledFeatures is answered now that the organization is
known. Organizations answers all of this through a provider interface in the
iam package, the way ScpProvider already does, so IAM still does not depend
on it.

AssumeRoot opens the session those features allow. It acts as the member
account's root user, which no identity policy grants or denies, scoped by
the TaskPolicyArn the request names: the five AWS managed policies the model
names, under the root-task path, each denying everything it does not name,
so the policy is the whole of the bound and is read beside the root's own
allow-all rather than as a session policy with nothing to allow. A customer-
managed policy can carry that path too and is refused, being the caller's
own document rather than one of AWS's. The caller must be able to manage
root access and have RootSessions enabled, the target must be a member
account other than the management account, and the audit reads those
policies allow name the member account's root user when they carry no
UserName, which is what their own arn:aws:iam::*:root asks for.

What is chosen rather than read is documented in docs/services/sts.md: the
operation models only RegionDisabled and ExpiredToken, so every caller,
target and feature refusal is AccessDenied 403 and a task policy outside the
root-task path is a ValidationError, the shape MinimumSessionTokenSize also
answers outside the 0 to 4096 the model declares for it, the size asked for
being the size issued. The guide's refusal of root user credentials covers
both credentials this emulator reads as the account root, one that resolves
to a root ARN and the bare account-id key the enforcement filter calls
floci's account-root principal, so a privileged session is opened by an IAM
user or role of the management account as it is on AWS. The global endpoint
is refused when the request arrives on that host, which is the only way a
request says so.
2026-10-22 17:06:12 -05:00
Priamo Germosen 812c95499d fix(iam): check iam:PassRole for Redshift, Redshift Serverless and AddRoleToInstanceProfile (#6250)
Under IAM enforcement a request that passes a role to a service needs iam:PassRole on that role,
but no Redshift or Redshift Serverless operation was checked for it. A caller allowed to create a
cluster or change its roles could attach any role to it, and Floci's COPY, UNLOAD and Spectrum
statements then run as that role; statements run through the Data API on a Redshift Serverless
workgroup can use its namespace's roles the same way.

Now checked, with iam:PassedToService as the Service Authorization Reference gives it:
- Redshift CreateCluster and RestoreFromClusterSnapshot pass the roles in IamRoles, and
  ModifyClusterIamRoles those in AddIamRoles, to redshift.amazonaws.com. The lists are read through
  the Redshift handler's own member pattern, so IamRoles.IamRoleArn.N, as the SDK sends it,
  IamRoles.member.N and IamRoles.N all count. RestoreFromClusterSnapshot is checked although
  Floci's restore attaches no role yet, as AWS checks it.
- Redshift Serverless CreateNamespace and UpdateNamespace pass the roles in iamRoles and the one
  in defaultIamRoleArn, and CreateScheduledAction and UpdateScheduledAction pass roleArn, to
  redshift-serverless.amazonaws.com.

The Redshift management guide: "To associate an IAM role with a cluster, a user must have
iam:PassRole permission for that IAM role." A role named only as a cluster's default,
DefaultIamRoleArn, is not checked on its own: the default is one of the roles the cluster holds, and
Floci does not act on it. A namespace's defaultIamRoleArn is checked, since Floci keeps it whether
or not iamRoles holds it.

COPY, UNLOAD and Spectrum now take a role only under the ARN IAM holds it under, path included, as
STS AssumeRole does. They looked the role up by its name alone, so a cluster given
role/sandbox/AdminRole, which a PassRole grant on role/sandbox/* allows, ran its statements as the
AdminRole IAM holds under another path.

IAM's AddRoleToInstanceProfile now passes the role it adds to ec2.amazonaws.com. Every instance
running with the profile gets that role's credentials from the instance metadata service, so adding
a role to a profile already attached to a running instance handed it any role. The IAM API
reference: "The caller of this operation must be granted the PassRole permission on the IAM role by
a permissions policy." RoleName names the role without its path, so the check uses the ARN IAM holds
the role under, or, for a role IAM does not hold, the ARN the name gives.

docs/services/iam.md lists the new operations, and docs/services/redshift.md the path rule.
2026-10-22 17:06:02 -05:00
Priamo Germosen 49ed87c815 fix(codeartifact): pypi can have more than one asset per version in ListPackageVersionAssets (#6259)
hectorvent's #5962 follow-up: the javadoc claimed npm/pypi/nuget each have exactly one
asset per version, but a pypi release can hold both a source distribution and a wheel.
listPackageVersionAssets already lists both correctly; only the comment was wrong.
Added a Docker-gated test confirming both files list with their own correct size and hash.
2026-10-22 17:05:52 -05:00
Ben Wart 107da3e75a fix(s3): check CompleteMultipartUpload conditions atomically with the write (#6286)
* fix(s3): check CompleteMultipartUpload conditions atomically with the write

CompleteMultipartUpload judged If-Match and If-None-Match only in the
controller, before any lock, and then stored the object with options that
carried neither header. The recheck storeObject does under the bucket
monitor for PutObject therefore never ran for a completion, so concurrent
completions with If-None-Match: * on one key could all return 200, the last
body winning.

completeMultipartUpload now takes ifMatch and ifNoneMatch and passes them on
the store options, so they are rechecked under the bucket monitor together
with the write. The controller's early check stays, to spare assembling
parts for a request that will fail.

* test(s3): race conditional CompleteMultipartUpload over HTTP

16 barrier-synced CompleteMultipartUpload requests with If-None-Match: *
on one key: exactly one 200, the rest 412, and the stored body is the
winner's. Mirrors the existing concurrent PutObject test.

* test(s3): share the barrier race harness between conditional-write tests

The concurrent PutObject and CompleteMultipartUpload If-None-Match tests
now use one raceStatusCodes helper for the barrier, executor, timeouts and
shutdown, so the two cannot drift.
2026-10-22 17:32:50 -04:00
Alessandro Lattao d20084ade3 fix(dsql): refuse a connection that sends no TLS server name (#6282)
DSQL knows the cluster only by the TLS server name, and refuses a connection
that sends none with FATAL 08P01 "unable to accept connection, sni was not
received" once its password is in, whatever the password (measured). The
endpoint fell back to the host in the token and let such a connection in. It
now refuses it as DSQL does, and admit takes the cluster from the server
name alone. The integration tests connected to 127.0.0.1 through pgjdbc's
NonValidatingFactory and sent no server name; DsqlClusterFixture now gives
pgjdbc a NonValidatingFactory that names the cluster, as the compatibility
test's factory does.
2026-10-22 17:10:51 -04:00
Aniket Shukla a9ceee1de6 fix(ssm): honor path parameter type filters (#6183)
* fix(ssm): honor path parameter type filters

Forward GetParametersByPath Type filters through the existing parameter-filter validation and matching rules. Retain path, recursion, region and public AMI selection, and document the remaining filter and pagination limitations.

* fix(ssm): validate path filter keys and apply key ids

Reject missing and action-invalid filter keys before selecting path results. Reuse the existing Type and KeyId matcher, and validate Label options while keeping label matching a documented gap.

Verify 264 focused SSM tests, Checkstyle, 95 docs tests, docs checks, and the partition gate. Regression tests fail before the fix and detect an inverted key allowlist.

* fix(ssm): reuse canonical invalid filter option errors

Share the existing AWS InvalidFilterOption message between DescribeParameters and Label path filters. Assert the complete HTTP message for invalid KeyId and Label options.

Verify 264 focused SSM tests, three CI-failing Lambda/SQS tests, Checkstyle, docs checks, 95 docs tests, and the partition gate. The two Label message assertions fail before the fix.
2026-10-22 17:06:23 -04:00
Allen Sanborn af3dc4866e fix(kms): page ListKeys and ListAliases with Limit and Marker (#6269)
* fix(kms): page ListKeys and ListAliases with Limit and Marker

Both handlers ignored Limit and Marker and always returned every entry with
Truncated=false. They now page the way ListGrants does: entries sorted by id
(KeyId, AliasName), Marker is the base64 id of the last entry returned, an
unknown or undecodable Marker is InvalidMarkerException, and Limit is clamped
to the documented range (ListKeys 1-1000, ListAliases 1-100). ListAliases
applies the KeyId filter before paging. Without a Limit both still return
every entry.

* fix(kms): resume ListKeys and ListAliases after the marked entry is deleted

The Marker named the last entry returned and was rejected with
InvalidMarkerException when that entry was gone, so deleting while listing
(as Terraform and cloud-nuke do) broke the listing. Markers are now signed
cursors from core/common/SignedMarkers, as IAM and Lambda layers use, and the
next page starts at the first id sorting after the cursor. Only a marker this
instance did not issue is InvalidMarkerException.

* fix(kms): reject a ListKeys or ListAliases Limit outside the model

Limit was read with asInt() and clamped, so 0, a negative number, a string
or a decimal came back as a one-item page. The model types Limit as an
integer in LimitType [1..1000]: a non-integer is now SerializationException
and an out-of-range value is ValidationException with Smithy's wording.
ListAliases still clamps a Limit above its documented 100 page size.

* fix(kms): refuse a blank ListKeys or ListAliases Marker

A present but blank Marker was treated as omitted and restarted the listing.
An empty Marker now fails MarkerType's length >= 1 with ValidationException,
and a whitespace-only one is InvalidMarkerException, as for any marker this
instance did not issue.

* fix(kms): accept a ListKeys or ListAliases Marker only in the listing that issued it

The signed cursor named only the last id, so a marker from one listing was
accepted by another action, region or KeyId filter and silently skipped
every entry sorting before it. The cursor now carries the action, region and
resolved KeyId filter, and a marker presented anywhere else is
InvalidMarkerException. Resuming after the marked entry is deleted still
works.

* fix(kms): resolve the ListAliases KeyId filter once per page

ListAliases resolved the KeyId filter twice, once to filter and once for the
marker context. If an alias given as KeyId was repointed between the two
lookups, the page held one key's aliases while NextMarker was signed for
another, and the next page skipped entries. The filter is now resolved once
and that key id is used for both.

* fix(kms): refuse a non-string ListKeys or ListAliases Marker

MarkerType is a string, but the handler coerced other JSON values with
asText: an object or array became an empty marker (ValidationException) and
a number or boolean an unissued one (InvalidMarkerException). A non-string
Marker is now SerializationException, matching how a non-integer Limit is
refused.

* fix(kms): bind ListKeys and ListAliases markers to the account

KMS keys and aliases are stored per account, but the signed cursor named
only the action, region and filter, so a marker issued in one account was
accepted in another and skipped its entries sorting before the cursor. The
cursor now carries the request account, and a marker presented in another
account is InvalidMarkerException.
2026-10-22 16:53:23 -04:00
Alessandro Lattao 564ae350a1 fix(dsql): refuse a startup packet or client message outside DSQL's limits (#6258)
* fix(dsql): refuse a startup packet or client message outside DSQL's limits

The endpoint took a client message up to 64 MB and dropped the connection
without a word past that; DSQL takes 10 MiB and answers FATAL 08P01
"invalid message length" as soon as a longer, or shorter than 4, length
arrives. Measuring the startup packet alongside showed it one byte off as
well: DSQL takes 9,999 bytes and answers "invalid length of startup packet"
from 10,000, where the endpoint took 10,000 and refused more in silence. Both
are DSQL's now, for the startup inside TLS, the password message and every
message after signing in. What the database sends is not DSQL's to limit, so
it is still read up to 64 MB. PostgresWire.checkedLength throws its own
InvalidLengthException, still an IOException, so a reader can tell such a
packet from a broken connection; the RDS proxy and Redshift's bridge end the
connection on it as before.

* fix(dsql): refuse any packet before TLS as not TLS, whatever its length

The first head capped the packets read before TLS at the startup limit too,
so a 10,000-byte plaintext startup packet, first or after a GSSENCRequest,
closed the connection in silence where it had been refused as not TLS; above
10,000 bytes main closed in silence as well. Measured on DSQL, it reads no
more than such a packet's length and code: a plaintext startup packet of any
length is refused with "SSL is mandatory", and one under 8 bytes ends the
connection without a word. The endpoint now reads the body only when it fits
a startup packet, so the refusal reaches the client in order, and refuses a
longer one unread.
2026-10-22 16:53:06 -04:00
Matheus Oliveira 34f592f7e7 fix(apigateway): answer an HTTP API proxy result without a Content-Type as text/plain (#6201)
* fix(apigateway): answer an HTTP API proxy result without a Content-Type as text/plain

Measured on AWS (eu-west-1, 2026-10-19): an HTTP API answers a Lambda proxy
result that carries a body and no Content-Type header of its own with
text/plain; charset=utf-8, in both payload formats. Floci fell back to
application/json, the REST API's default, so a client that trusts the
header read a plain body as JSON.

The fallback now follows the API kind: an HTTP API answers text/plain, a
REST API keeps answering application/json.

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

* test(apigateway): fold the Content-Type cases into the inference test

The three cases repeated the inference test's setup, route helper and
cleanup, so they join it: two results without a Content-Type in the two
payload formats, and one that names application/json. The docs say a
statusCode and a body, since a format 2.0 result without a statusCode
still takes the inferred JSON path, and the compatibility test's get
helper and parameterized name are back on one line each.

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

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-22 16:04:51 -04:00