Commit Graph
1712 Commits
Author SHA1 Message Date
Franklin G. Mendoza a0fd815366 feat(oam): emulate observability access manager (#3440)
* feat(oam): emulate observability access manager

* fix(oam): honor explicit deny statements
2026-09-12 08:59:21 -04:00
Ovidiu 6d6940bb8f fix(athena): read a projecting table's partition paths, not its whole location (#3415)
* fix(athena): read a projecting table's partition paths, not its whole location

A table that projects its partitions was read by globbing its location, so
anything else stored beside the data was read as though it were table data.
Athena does not do this: it builds the partition paths from the projection
configuration and reads only those, which is the point of projection.

The common way this bites is a workgroup whose results live under the
table's own root. The first query succeeds, its output CSV lands inside the
read path, and every query after it fails parsing that CSV as table data -
a data source that works once and then breaks, on a file the engine wrote
itself.

Derive the read path from storage.location.template when it is set, and
otherwise from the default column=value layout over the partition keys.
Values stay wildcards: narrowing them to the partitions a query actually
needs requires that query's predicates, which are not available where the
view is built, so the read stays wide and the query does the filtering. A
table that does not project its partitions is read exactly as before.

Also reject a query that names a projecting table but leaves an injected
partition column unmentioned. An injected column has no generatable range -
its values come from the query - so Athena requires an equality condition on
it. Deciding whether a condition is a static equality one needs the query's
predicate tree, so this checks only whether the column is mentioned at all:
strictly narrower than the real rule, never rejecting a query Athena would
accept, but catching the case that silently reads every partition.

* fix(athena): scope the injected-column check to WHERE clauses

The check matched the column name anywhere in the query text, so a query
that names the column without filtering on it passed. `SELECT tenant,
count(*) FROM audit_events GROUP BY tenant` has no WHERE clause at all and
still satisfied it, on the strength of the SELECT list and the GROUP BY -
which is the case the check exists to catch.

Look only inside WHERE clauses, a subquery's included. A clause runs from
the keyword to whatever ends it: the next clause keyword, the paren closing
the subquery that holds it, a statement terminator, or the end of the query.
Parentheses opened inside the clause are part of it, so a predicate carrying
its own subquery is not cut short.

Single-quoted literals and comments are blanked first. A column name spelled
inside either constrains nothing, and reading them as code made the same
false pass by another route. Double-quoted and backquoted identifiers stay:
those are references to the column.

Still narrower than Athena's rule, which wants a static equality condition
rather than a mention, so it continues to reject nothing Athena accepts.
2026-09-12 08:54:09 -04:00
Allen Sanborn a2285072c9 feat(ec2): capture the instance file system in CreateImage, and implement Deregister/CopyImage (#3306)
* fix(ec2): capture the instance file system in CreateImage

CreateImage recorded only metadata. It registered a new id and set

    image.setSourceImageId(resolveLaunchableImageId(region, source.getImageId()));

so the AMI pointed at the *base* image the source instance was launched
from. Launching it started that base image, and everything provisioned on
the source instance was silently discarded.

This was worse than an unimplemented operation. A full Packer amazon-ebs
build ran green against Floci -- keypair, security group, launch, SSH,
provisioner, stop, CreateImage, cleanup -- and produced an AMI reporting
state "available" that contained nothing:

    ==> amazon-ebs.floci: PROVISIONED_BY_PACKER
    ==> amazon-ebs.floci: AMI: ami-42ba1c3d9f8023703
    Build finished after 1 minute 41 seconds.

    $ # launch that AMI, then:
    $ cat /etc/floci-probe
    cat: /etc/floci-probe: No such file or directory

Anyone building a golden AMI locally would have believed it worked.

Per API_CreateImage, CreateImage "creates an Amazon EBS-backed AMI from an
Amazon EBS-backed instance that is either running or stopped", and the
resulting AMI is a point-in-time capture of the instance's volumes. The
contract is that state at capture time is preserved.

CreateImage now commits the source container to a Docker image
(floci-ami/<ami-id>:latest) and stores that reference on the Image.
RunInstances prefers it, walking the CreateImage chain so an AMI captured
from an instance that was itself launched from a capture still resolves.
The guest runtime (systemd vs minimal, cloud-init) still comes from the
ancestor, since committing a layer does not change how the guest boots.

Capture is best-effort by design: if the daemon refuses the commit, the
AMI keeps its sourceImageId and behaves exactly as before rather than
failing the API call. Skipped entirely in mock mode, where there is no
container.

Ec2ContainerManager gains commitInstance() and removeCommittedImage(); the
latter exists so captures can be reclaimed when the owning AMI is
deregistered, rather than accumulating on disk.

Verified end to end against a real Packer 1.16.0 build on this branch: the
build succeeds, and launching the resulting AMI and reading the file the
provisioner wrote returns PROVISIONED_BY_PACKER. The committed image is
visible as floci-ami/ami-295129250f0c23320:latest.

Tests cover the capture itself with a mocked Docker client: that the
reference is split into repository and tag (passing it whole would create
a repository literally named "floci-ami/ami-123:latest"), that a missing
container captures nothing, that a daemon failure yields null rather than
propagating, and that removing an absent or never-captured image is not an
error. 8 tests, all green.

Not addressed here: reclaiming the committed image on DeregisterImage,
which needs the DeregisterImage work to land first.

* feat(ec2): implement DeregisterImage and CopyImage

Both actions returned UnsupportedOperation:

    $ aws ec2 deregister-image --image-id ami-... --endpoint-url http://localhost:4577
    An error occurred (UnsupportedOperation) ... Operation DeregisterImage is not supported.
    $ aws ec2 copy-image --source-region us-east-1 ...
    An error occurred (UnsupportedOperation) ... Operation CopyImage is not supported.

The rest of the AMI lifecycle already worked -- RegisterImage, CreateImage,
DescribeImages, and RunInstances from a created AMI -- so the gap sat at the
end of it. DeregisterImage is what Packer calls under force_deregister to
clear the AMI holding the name it is about to reuse; without it the second
run of any iterative build dies on InvalidAMIName.Duplicate and the build is
one-shot. CopyImage is the build-in-one-region, promote-to-the-others
pattern that several Gruntwork AMI modules use.

The cause was only the missing `case` arms in Ec2QueryHandler's dispatch
switch, whose default is UnsupportedOperation. EC2_ACTIONS in
AwsQueryController is not on this path for a signed request: resolveService()
takes the service from the SigV4 credential scope and only falls back to
inferServiceFromAction() when that fails. CreateImage is likewise absent from
EC2_ACTIONS and works fine. All three are added anyway so the unsigned/raw
client fallback agrees with the dispatcher.

DeregisterImage. "Deregisters the specified AMI. A deregistered AMI can't be
used to launch new instances", and it does not delete "Instances already
launched from the AMI" (API_DeregisterImage). The image is therefore
tombstoned with the documented AMI state `deregistered` rather than dropped
from the store: DescribeImages stops reporting it, its name is released so
the rebuild can claim it, RunInstances rejects it with
InvalidAMIID.Unavailable, but an instance launched from it keeps resolving
its ancestry to a guest image, so a stop/start still comes back on the right
one. Keeping the tombstone is also what lets a repeat call answer
InvalidAMIID.Unavailable ("has been deregistered and is no longer available")
instead of InvalidAMIID.NotFound ("The specified AMI doesn't exist") -- a
retry can tell the two apart. Deregistering a catalog AMI, which is owned by
amazon rather than by the caller, is AuthFailure: "trying to use an AMI for
which you do not have permissions". Snapshots are kept unless
DeleteAssociatedSnapshots is set ("Default: The snapshots are not deleted"),
and one shared with another AMI is reported `skipped` rather than deleted,
since "if a snapshot is associated with multiple AMIs, it won't be deleted
even if specified for deletion, although the AMI will still be deregistered."

CopyImage. "The copy operation must be initiated in the destination Region",
and for a Region-to-Region copy "the destination Region is the Region in
which you initiate the copy operation" (API_CopyImage) -- so the request's
own region is the destination and only the source is looked up under
SourceRegion. That matters here because Floci keys registered AMIs by
(region, id) and describeImages filters on the stored region, so a source id
that exists in us-east-1 is genuinely absent when SourceRegion names another
region; that case is InvalidAMIID.NotFound. The copy is an independent image:
its own id, its own snapshot ids (sharing the source's would make deleting
either look like it took the other's backing with it), owned by the caller.

State: AWS reports the copy as `pending` until the backing snapshots finish.
Floci's store is in-memory and the copy completes inside the call, so it is
`available` immediately -- matching what CreateImage and RegisterImage
already return rather than inventing a state machine that nothing would ever
advance. A caller polling for `available` returns on its first poll.

Concurrency. registerImage's duplicate-name check is a read-modify-write over
the whole image store, and CopyImage now reaches it too. The stripe is taken
on (region, name), not on an image id -- the id does not exist yet and is
unique by construction, whereas the name is the invariant. deregisterImage's
check-then-tombstone takes the (region, id) stripe. Both are the striped-lock
pattern already used by modifyVpcEndpoint.

Tests are driven through the service, not over HTTP, for the concurrency
cases: requests through the test server serialize enough to hide a lost
update, the same trap called out in
Ec2ModifyVpcEndpointTest.concurrentAssociationsAllSurvive. Both race tests
were confirmed to fail with their lock removed -- 6 of 24 concurrent copies
claimed one name, and one AMI was deregistered twice -- which is also why the
name race pads the store first: the window that has to be hit is the scan,
and against an empty store the test passes with or without the lock.

The rest of the coverage is over HTTP: that DeregisterImage answers
return=true and the AMI then vanishes from DescribeImages, that unknown,
already-deregistered and not-owned ids get the three distinct documented
errors, that the freed name can be registered again (the force_deregister
loop), that an instance launched from the AMI keeps running while a new
launch is refused, snapshot retention and the shared-snapshot skip, and for
CopyImage that the copy lands in the caller's region and not the source's,
is available and owned by the caller, gets its own snapshots, is launchable
where it landed, and rejects a missing or deregistered source.

Not implemented: the Encrypted/KmsKeyId, CopyImageTags, TagSpecification and
ClientToken parameters of CopyImage, and Outpost/Local Zone destinations.

* fix(ec2): release an AMI's captured image when it is deregistered

CreateImage captures the source instance's file system as a committed
Docker image (floci-ami/<ami-id>:latest). Those are real disk. Nothing
released them, so an iterative build -- Packer with force_deregister, or
any loop that rebuilds the same AMI -- left one committed layer behind per
iteration, indefinitely.

DeregisterImage now releases the capture. The AMI record itself is still
kept as a tombstone, as the DeregisterImage implementation requires for
ancestry resolution; only the Docker image is reclaimed.

The exception is the one that matters for correctness. AWS keeps instances
launched from a deregistered AMI running, and DeregisterImage's own
documentation notes that already-launched instances are unaffected -- they
can still be stopped and started. Removing the layer such an instance
boots from would break exactly that, so reclamation is skipped while any
non-terminated instance still resolves to the capture, and the tombstone
keeps its reference. Correctness before disk: the worst case is a layer
that outlives its AMI, not an instance that cannot start.

Terminated instances deliberately do not pin a capture. They can never
boot again, and treating them as live would mean nothing is ever reclaimed
in a long-running emulator.

Tests drive the real CreateImage path rather than building a fixture by
hand -- the image store returns detached copies, so setting the captured
reference on a returned Image never reaches the store and the test would
silently assert nothing. They needed two further pieces of care worth
noting:

  - The shared test configuration sets floci.services.ec2.mock=true, which
    skips all container work, so both capture and reclamation would be
    dead code under test. A QuarkusTestProfile turns it off; the container
    manager is still mocked, so no Docker is involved.
  - Outside mock mode, termination is delegated to the container manager.
    With that mocked, an instance stays "running" forever, which would
    have made the terminated-instance assertion vacuous. The mock now
    performs the same state transition the real path does.

* fix(ec2): make a capture survive the copy, and fail loudly when it cannot

Six review findings on the image-capture stack, all of which end in the same
place: an AMI that reports itself available while its file system is not what
the caller asked for.

CopyImage copied the flattened ancestry but not the capture, so launching a
copy silently started the base image. The copy now carries the reference, and
because a Docker reference is global to the daemon, reclamation counts another
AMI carrying the same tag as a live user.

A capture that could not be made was reported the same way as "there was
nothing to capture", so a refused commit produced an immediately-available AMI
that booted the ancestor. commitInstance now throws, and CreateImage drops the
half-built AMI and fails: InternalError when the commit was refused,
IncorrectInstanceState when the instance has no container to capture. Floci
commits inline, so there is no later state transition a poller could observe
and no honest way to report this asynchronously.

Two races shared one cause: the invariants over the image registry are whole
set scan-then-mutate sequences, and the three operations that hold them ran
under three different monitors. RegisterImage locked a name stripe while
DeregisterImage locked an id stripe, so a registration could reuse a snapshot
between the shared-reference scan and the delete. RunInstances took no image
lock at all, so a launch could resolve a captured tag, pause before storing its
instance, and have deregistration remove the tag underneath it. Both now run
under one imageRegistryLock; RunInstances holds it only to resolve the AMI and
publish its instances, with the container launches outside it. The lock is
single rather than striped because the capture invariant is not region-scoped:
a copy shares its source's layer across regions.

removeCommittedImage suppressed docker errors while the caller cleared the
reference regardless, so a transient failure leaked the layer permanently.
It now reports whether the layer is gone, and the reference survives a refusal.

Finally, a capture retained for a live instance was never reclaimed, because
reclamation only ran during deregistration and a second deregistration is
rejected. Termination now reclaims what deregistration had to keep.

Ec2ServiceTest builds a container-backed service with a bare container-manager
mock, so its instances have no container and every CreateImage there would now
be rejected for a reason those tests are not about; they get a commit stub.

* fix(ec2): reject a mid-launch deregistration before the launch persists anything

RunInstances checks the AMI tombstone twice: once on entry, and once under the image
registry lock, because DeregisterImage releases the captured layer as soon as no live
instance resolves to it, and a launch that had resolved the layer but not yet stored
its instance would lose it underneath.

The second check fired too late. By the time it ran, the launch had already written a
root volume per instance, the instance tags, a subnet IP, and the attachment on a
caller-supplied ENI. The reservation was never returned, so no caller had an id to
clean any of that up with, and the interface stayed in-use for good.

Move the build loop inside the same locked section, after the check, so the launch
persists nothing until it knows it is allowed to proceed. Rollback was the other
option and is worse: the subnet IP counter has no free list to return an offset to,
and a rollback path only runs once something has already gone wrong. The lock is not
meaningfully wider, since what moved inside it is in-memory record construction; the
slow part, the container launch, still runs outside.

The regression test holds the registry lock itself, so the launch parks at a known
point and the tombstone lands there on purpose rather than racing for the window.
Its file is renamed to *IntegrationTest, matching what the rest of the repo calls a
@QuarkusTest.

* test(ec2): name the captured image reclaim QuarkusTest an IntegrationTest

607 of the 736 @QuarkusTest classes on main end in IntegrationTest, and this one
starts a full application like the rest of them. Ec2CreateImageCaptureTest is left
alone: it drives a plain Ec2Service with Mockito and is not an integration test.
2026-09-12 00:44:35 -05:00
XuJianandxujiantop-crypto ae580974cc fix(sfn): preserve Lambda function errors (#3456)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-12 00:31:13 -05:00
Franklin G. Mendoza 68c783b576 fix(rds): report backing container failures (#3455)
* fix(rds): reconcile dead backing containers

* fix(rds): report backing container failures
2026-09-12 00:25:39 -05:00
Priamo Germosen fe076212c2 fix(mwaa): also detect a crashed sibling Postgres container, not just Airflow (#3454)
hasAirflowContainerExited only inspected the Airflow container. If the
sibling Postgres container dies instead (out of memory, its volume
filling up), Airflow keeps running but never reports metadatabase
healthy, so the environment sat at CREATING exactly as before this
existed, the same failure mode #3446 fixed for the Airflow container
alone.

Generalized into hasAnyContainerExited, backed by a shared per-container
helper, checking both Environment.getDbContainerId() and
getAirflowContainerId(). checkReadiness and its log messages updated to
match; behavior for a lone Airflow-container failure is unchanged.

Follow-up from hectorvent's review on #3446.
2026-09-12 00:20:38 -05:00
XuJianandxujiantop-crypto 0a45d2e131 perf(apigateway): avoid repeated root resource scans (#3404)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-11 23:29:06 -05:00
Priamo Germosen a7902b97f3 fix(mwaa): reject a malformed configured AirflowVersion as ValidationException (#3453)
MwaaEnvironmentManager.pythonTagFor parses AirflowVersion with a bare
Integer.parseInt. resolveAirflowVersion only checked that the requested
version was present in the operator-configured supported-versions list,
so a misconfigured entry (e.g. a stray "latest") would pass that check
and reach pythonTagFor, surfacing as an internal NumberFormatException
out of container startup, well after Postgres had already been created
for the environment, rather than a clean 400 at CreateEnvironment.

resolveAirflowVersion now also validates the version's shape (a numeric
major.minor, with an optional patch) before checking list membership, so
a malformed value is rejected immediately as ValidationException.

Follow-up from hectorvent's review on #3445.
2026-09-11 23:20:41 -05:00
TATSUNO “Taz” Yasuhiro 6d43e16d0e fix(dynamodb): match AWS on UpdateItem results and request limits (#3447)
* fix(dynamodb): match AWS UpdateItem response and validation gaps

UPDATED_NEW on a nested SET returned the whole parent map. It now returns
only the changed fragment, and the diff recurses into maps.

A REMOVE with UPDATED_NEW returned an empty Attributes. AWS omits the
field, since nothing was set to a new value.

An invalid ReturnValues also reports one error rather than aggregating
with ReturnConsumedCapacity, which is what AWS answers.

Closes 2 TIER 1 and 1 TIER 3 cases in the dynamodb-conformance suite.

* fix(dynamodb): reject an empty binary value on a secondary index key

An empty binary index key value was stored. AWS rejects it the same way
as an empty string, with the put wording that names the index and key,
and the shorter update wording for UpdateItem.

Closes 3 TIER 3 cases in the dynamodb-conformance suite.

* fix(dynamodb): reject expressions over 4096 bytes

AWS caps every expression parameter at 4096 bytes and checks the raw
text before the table lookup and before syntax. Floci accepted any size.

The wording follows what eu-west-2 and us-east-1 return. Write APIs wrap
the error in the validation envelope, read APIs do not, and only the
Scan FilterExpression reports the measured size.

Closes 5 TIER 3 cases in the dynamodb-conformance suite.

* fix(dynamodb): reject arithmetic results outside the number range

SET with + or - and ADD stored any result. AWS rejects a result it
cannot store with "Number overflow. Attempting to store a number with
magnitude larger than supported range", and uses that one wording for a
magnitude that is too small or too many significant digits as well.

Closes 1 TIER 3 case in the dynamodb-conformance suite.

* fix(dynamodb): reject attribute values nested deeper than 32 levels

AWS counts a top-level attribute as level 1 and rejects an item or an
ExpressionAttributeValues entry whose leaf sits below level 32, before
the table lookup. Floci stored any depth. The check now runs on the
PutItem item and on ExpressionAttributeValues for PutItem, DeleteItem,
UpdateItem, Query and Scan.

Closes 2 TIER 3 cases in the dynamodb-conformance suite.

* fix(dynamodb): apply the size and nesting limits to batch and transact writes

BatchWriteItem and TransactWriteItems now reject a Put item nested deeper
than 32 levels, and TransactWriteItems rejects an oversized UpdateExpression
or ConditionExpression, all before the table lookup.

AWS reports these without the validation envelope, and the transact
ConditionExpression carries the measured size like the Scan filter does.
A too deep ExpressionAttributeValues entry in a transact Update is a
cancellation on AWS, not a top-level error, and is left as is.

* fix(dynamodb): cancel a transaction on a too deep Update value

AWS checks the depth of a transact Update's ExpressionAttributeValues as
part of that member. A leaf below level 32 cancels the transaction with a
ValidationError reason and the message "Nesting Levels have exceeded
supported limits". A ConditionCheck value is not checked, so its condition
simply runs.

A cancellation reason can now carry its own message. Reasons without one
keep "The conditional request failed".

* fix(dynamodb): validate request numbers before the table lookup like AWS

* fix(dynamodb): check nesting depth in legacy value containers like AWS

* fix(dynamodb): return UPDATED_NEW and UPDATED_OLD by touched path like AWS

* fix(dynamodb): check the TransactGetItems projection size before the table lookup

* fix(dynamodb): reject and cancel on a too deep PartiQL parameter like AWS
2026-09-11 23:27:54 -04:00
Matheus Oliveira bb58176974 fix(s3): authorize read on copyobject/uploadpartcopy source (#3450)
CopyObject and UploadPartCopy only checked s3:PutObject on the
destination, letting a write-only caller copy any source object it
could not otherwise read via x-amz-copy-source.

* Fix #2333

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-11 23:02:37 -04:00
Matheus Oliveira 35233787a8 fix(cloudfront): emit origin timeout fields (#3299)
CustomOriginConfig now echoes OriginKeepaliveTimeout and OriginReadTimeout
with their AWS-documented defaults (5s, 30s), and Origin always emits
ResponseCompletionTimeout (0 when unset). OriginSslProtocols parsing
validates Quantity against the Items it declares, matching the sibling
CustomHeaders parser. OriginReadTimeout (1-120s) and OriginKeepaliveTimeout
(1-300s) now fail with CloudFront's own InvalidOriginReadTimeout /
InvalidOriginKeepaliveTimeout error codes when out of range or malformed,
and the ResponseCompletionTimeout >= OriginReadTimeout cross-check now
falls back to the 30s default when OriginReadTimeout is omitted.

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

* Fix #3221
2026-09-11 21:54:47 -05:00
Priamo Germosen 2a682a6875 fix(mwaa): mark CREATE_FAILED when the Airflow container exits before becoming ready (#3446)
docker start only launches the entrypoint and returns immediately, so a
startup script or `airflow db migrate` failing partway through never
surfaced anywhere: the readiness poller only checked isReady() and had no
path back to a failure status, so the environment reported CREATING
forever instead of CREATE_FAILED.

MwaaEnvironmentManager.hasAirflowContainerExited inspects the container's
running state (docker-removed counts as exited too), and the readiness
poller (extracted into checkReadiness for direct testability) now marks
CREATE_FAILED when isReady() is false and the container has exited.

Two things this needed to stay safe under concurrency and partial
failure, both of which isReady() already handles and this had to match:

- isReady()/hasAirflowContainerExited() are blocking Docker/HTTP calls,
  wide enough for a concurrent DeleteEnvironment (which sets DELETING on
  the same Environment instance before tearing down its containers) to
  have moved the environment past CREATING in the meantime. checkReadiness
  re-checks the status immediately before writing, in both branches, so it
  can't resurrect a just-deleted environment into storage with a status
  decided from stale, pre-delete information.
- hasAirflowContainerExited only treats NotFoundException (the container
  is actually gone) as exited; any other Docker error is inconclusive and
  must not propagate, since the readiness poller shares one loop across
  every CREATING environment and an uncaught exception from one
  environment's check would otherwise skip every other environment for
  that poll tick, the same failure mode isReady()'s own catch-all already
  avoids.

Fixes #3437
2026-09-11 22:38:06 -04:00
Franklin G. Mendoza f482a2d15e fix(resourceexplorer2): reject invalid pagination tokens (#3444) 2026-09-11 22:37:57 -04:00
lex00andlex00 128d3ef181 feat(datasync): add the DataSync management plane (#3377)
* feat(datasync): add the DataSync management plane

Emulates the AWS DataSync management API over JSON (X-Amz-Target
FmrsService.<Action>, signing name datasync): agents, the eleven
CreateLocation/DescribeLocation/UpdateLocation trios plus the shared
ListLocations and DeleteLocation, tasks, and resource tagging.

Each DescribeLocation* projects the create request that produced the
location, so the configuration that went in is the configuration that comes
back, and LocationUri is derived from that request per the scheme AWS
documents for the type. DescribeAgent reports ONLINE and DescribeTask reports
AVAILABLE from the first read, which is what the Terraform provider's
aws_datasync_task waits on. Credential members (Password, SecretKey,
SasConfiguration, the Kerberos files and the nested Protocol.SMB.Password)
are dropped before the configuration is stored, as AWS never reads them back
either. Errors use InvalidRequestException, the only client error the
DataSync model declares.

The task-execution data plane (StartTaskExecution, DescribeTaskExecution,
ListTaskExecutions, CancelTaskExecution, UpdateTaskExecution) transfers real
bytes between real storage systems and keeps raising UnknownOperationException
rather than a stub success.

* fix(datasync): default VerifyMode from the task mode

The DataSync model documents two VerifyMode defaults, not one:
POINT_IN_TIME_CONSISTENT for a BASIC task and ONLY_FILES_TRANSFERRED for an
ENHANCED one, which also cannot use POINT_IN_TIME_CONSISTENT at all. CreateTask
applied the BASIC default to every task, so an ENHANCED task created without an
explicit VerifyMode read back wrong.

The default now follows TaskMode, and a VerifyMode the mode does not support is
rejected with InvalidRequestException, the only client error this API declares.
UpdateTaskRequest carries no TaskMode, so a task keeps the mode it was created
with and UpdateTask applies the same rule against the stored mode. An
unrecognized TaskMode is rejected rather than silently treated as BASIC.

* test(datasync): add the SDK compatibility test

Drives an agent, an S3 and an NFS location, both task modes and the tag round
trip through the AWS SDK v2 DataSync client, which is the one piece of real-SDK
verification the RestAssured tests do not cover. It asserts the VerifyMode
default for a BASIC and an ENHANCED task, and that an ENHANCED task rejects
POINT_IN_TIME_CONSISTENT on create and on update.

---------

Co-authored-by: lex00 <artigues.dev@gmail.com>
2026-09-11 22:30:02 -04:00
Priamo Germosen 473a26aad9 fix(mwaa): match real MWAA's Airflow/Python pairing for the emulated image tag (#3445)
Real Amazon MWAA runs every Airflow version through 2.10.x on Python 3.11,
and only 2.11.0 onward (and every 3.x release) on Python 3.12. Floci
hardcoded apache/airflow:<version>-python3.12 for every supported version,
so a requirements.txt built the way AWS documents (a --constraint file
matching the real Airflow/Python pairing, e.g. constraints-3.11.txt for
2.9.x) resolves dependencies for the wrong Python minor version.

Fixes #3438
2026-09-11 20:54:52 -05:00
Matheus Oliveira 924e35cefe fix(cloudformation): resolve dynamic references for all template values (#3301)
CloudFormationTemplateEngine#resolveNode now resolves {{resolve:ssm:...}}
and {{resolve:secretsmanager:...}} syntax in any textual result, not only
the RDS master-credential properties CfnDynamicReferences was previously
wired into. The dynamic-reference stage now lives inside resolve() itself,
so every scalar property resolution goes through it, including plain
property lookups such as ProvisionContext#resolveOptional that call
resolve() directly rather than through resolveNode. ssm-secure stays
rejected everywhere except RDS MasterUsername/MasterUserPassword, which
now skip the general dynamic-reference stage via
resolveWithoutDynamicReferences and resolve it separately with the
permission only those two properties are allowed.

* Fix #2213

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-11 20:38:29 -05:00
lex00 cae8f9a013 feat(bedrock): add guardrail lifecycle and versions (#3380)
* feat(bedrock): add guardrail lifecycle and versions

Amazon Bedrock control plane over REST JSON: CreateGuardrail through
DeleteGuardrail, CreateGuardrailVersion, ListGuardrails with pagination, and
resource tagging on /tagResource, /untagResource and /listTagsForResource.
Guardrails report READY on the first read, so the Terraform provider's status
poll for aws_bedrock_guardrail completes without a transition.

The control plane and bedrock-runtime both sign as "bedrock". The runtime
descriptor keeps that credential scope, and the new descriptor routes through
its resource class, which ServiceEnabledFilter checks first.

Policy blocks are stored under the read-shape member names, so a *Config
submitted on create or update reads back unsuffixed. ListGuardrails honours
maxResults and nextToken, and DeleteGuardrail rejects a guardrailVersion that
is not a GuardrailNumericalVersion.

* fix(bedrock): enforce guardrail length caps and resolve kmsKeyId to a key ARN

The AWS model caps description at 200 characters and both blockedInputMessaging
and blockedOutputsMessaging at 500, each with a minimum of 1. None of those were
checked, so an over-long value was stored and read back. name was already bounded
by its [0-9a-zA-Z-_]{1,50} pattern.

kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key
ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn,
which is only ever the full key ARN. The request value was echoed back verbatim,
so a bare key id or an alias produced a response that does not match the shape
GetGuardrail declares. It now resolves through KmsService.describeKey, the same
way RDS, DocDB and ElastiCache already resolve their KmsKeyId, and a key that is
missing, disabled or pending deletion is rejected with ValidationException.

* test(bedrock): drive the guardrail lifecycle from the AWS SDK v2 client

Adds the bedrock SDK module to the compatibility project, a BedrockClient
factory on TestFixtures, and a BedrockGuardrailTest covering create, read,
update, versioning, listing, tagging and delete. The test also submits kmsKeyId
as a bare key id and as an alias and asserts both read back as the same full KMS
key ARN.

* fix(bedrock): enforce the guardrail tag caps from the AWS model

The AWS model gives TagList a max of 200 items, and that shape backs the tags
member of both CreateGuardrail and TagResource. TooManyTagsException, declared
on both operations, documents a separate limit of 50 tags per resource counted
over the tags already on the resource together with the ones in the request.

parseTagList now rejects an array over 200 items with ValidationException, and
it moved to BedrockService so both entry points share it. CreateGuardrail and
TagResource raise TooManyTagsException once the total the guardrail would be
left holding passes 50, carrying resourceName as the model declares.
2026-09-11 20:36:45 -04:00
XuJianandxujiantop-crypto 78cf107fcb fix(sfn): preserve mocked response indexes (#3391)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-11 19:17:27 -04:00
Niels Kootstra ad9a88cf7e fix: parse S3 EventBridge notification XML (#3350) 2026-09-11 19:16:51 -04:00
Franklin G. Mendoza 07d6cabd8a feat(marketplace-discovery): emulate AWS Marketplace Discovery API (#3342) 2026-09-11 18:48:30 -04:00
lex00 137a39add3 feat(appintegrations): add data and event integrations (#3379)
* feat(appintegrations): add data and event integrations

Amazon AppIntegrations over REST JSON, registered under the app-integrations
signing name: event integrations on /eventIntegrations, data integrations on
/dataIntegrations, and resource tagging through the shared /tags/{resourceArn}
dispatcher. Terraform's aws_appintegrations_event_integration and
aws_appintegrations_data_integration now round-trip against Floci instead of
failing on an unimplemented signing scope.

Event integrations are keyed by name, data integrations by generated id, and
both accept their own ARN wherever the API takes an identifier. The two PATCH
operations apply only the members present in the request body, matching how AWS
treats an optional member the caller did not send. Both tag writes answer 200,
which is what the 2020-07-29 model gives them.

* test(appintegrations): add an SDK compatibility test

Adds the appintegrations AWS SDK v2 module, a TestFixtures client factory,
and an AppIntegrationsTest that drives both integration types and the tag
round trip through the real SDK client.
2026-09-11 17:55:48 -04:00
lex00andlex00 2e79f5c766 feat(globalaccelerator): add the Global Accelerator management plane (#3378)
* feat(globalaccelerator): add the Global Accelerator management plane

Emulates the AWS Global Accelerator management plane over JSON 1.1 under the
GlobalAccelerator_V20180706 target prefix, signing name globalaccelerator:
accelerators, listeners, endpoint groups, accelerator attributes and resource
tags, 22 actions in all.

Global Accelerator is a global service, so ARNs carry an empty region segment
and listener and endpoint group ARNs extend the accelerator ARN. Nothing is
keyed by the signing region, so a caller that signs outside us-west-2 sees the
same accelerators. Accelerators report DEPLOYED and endpoints HEALTHY from the
first read, so SDK and Terraform waiters complete on their first poll.

Enum and range members are validated against the API model, and
UpdateAcceleratorAttributes rejects an update that would leave FlowLogsEnabled
true with no destination bucket.

* fix(globalaccelerator): enforce the list caps and HealthCheckPath format from the API model

The scalar ranges were already checked against globalaccelerator/2018-08-08, but the
array-count caps were not. PortRanges, EndpointConfigurations and PortOverrides each
declare max 10, and IpAddresses declares max 2 for the BYOIP case. All four were
unbounded. HealthCheckPath declares max 255 and the pattern
^/[-a-zA-Z0-9@:%_\+.~#?&/=]*$, which was not checked at all.

The new failures reuse InvalidArgumentException and the message shape the existing
scalar validations already use, so they are indistinguishable in kind from those.

* test(globalaccelerator): add the SDK compatibility test

Adds the globalaccelerator SDK module, a TestFixtures client factory and a
GlobalAcceleratorTest that drives accelerator, listener and endpoint group
lifecycles through the AWS SDK v2 client, including the new PortRanges cap.

---------

Co-authored-by: lex00 <artigues.dev@gmail.com>
2026-09-11 16:53:22 -04:00
Abhigya a91d7becd1 fix(apigateway): return the full integration configuration on read-back (#3432)
GetIntegration returned only type, httpMethod, uri and passthroughBehavior,
and GetIntegrationResponse only statusCode and selectionPattern. The mapping
configuration Floci stores and honours at invoke time - requestParameters,
requestTemplates, integrationResponses, responseParameters and
responseTemplates - was never returned, so infrastructure-as-code tools that
diff against these reads saw it as absent and reported drift that never
converged.

Three further corrections in the same area:

- UpdateStage stored method settings under the JSON-Pointer-escaped resource
  path ("~1pets/GET"), so the escaped spelling AWS sends produced a key that
  nothing could look up. Both spellings now normalise onto "pets/GET", which
  is what AWS reports.
- An integration.response.header.X-Foo mapping was resolved case-sensitively,
  so it silently yielded null whenever the backend used different casing.
  Header names are case-insensitive per RFC 9110.
- An integration with no "type" - which an OpenAPI import can produce - threw
  a NullPointerException inside the dispatch switch instead of reporting the
  misconfiguration.
2026-09-11 16:42:22 -04:00
Vũ Thế Huy 9c9aa670e4 fix(dynamodb): partition parallel scan by partition key hash (#3225) (#3429)
Partition parallel scans by hashing the partition key attribute rather than filtering by result list index. This ensures stable, deterministic segment assignment that is unaffected by concurrent mutations or deletions in earlier segments.
2026-09-11 16:31:57 -04:00
Matheus Oliveira e3766eac6f feat(kinesis): implement UpdateShardCount API (#3200)
Adds uniform-scaling reshard support via existing splitShard/mergeShards
machinery, with the documented double/half, 10000-shard, and 10-scales-per-24h
limits enforced as LimitExceededException/InvalidArgumentException/ValidationException.
The half-shard-count minimum rounds up for an odd current count, which is
Floci's own call since AWS documents only "below half" with no stated
rounding direction; the separate 10 TPS call-rate limit AWS documents on this
action is not simulated, matching Floci's lack of real-time request
throttling elsewhere. Both are now called out explicitly in the docs and code.

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

* Fix #3064
2026-09-11 16:25:49 -04:00
Niels Kootstra 43eace4e02 fix(transfer): isolate servers and users by account and region (#3403)
* fix(transfer): isolate servers and users by account and region

* ci: retrigger transfer checks

* fix(transfer): migrate legacy resources by scope

* test(transfer): cover unscoped legacy tags
2026-09-11 16:21:24 -04:00
Niels Kootstra d92211d1c1 fix(storage): migrate legacy entries by exact key (#3408)
* fix(storage): migrate legacy entries by exact key

* fix(storage): use legacy migrator for bulk scans

* chore: retrigger CI
2026-09-11 14:20:28 -04:00
Ovidiu ebe9cf2264 fix(athena): project the column names the Glue table declares (#3414)
Views built from the Glue catalog selected *, so the column names came from
whatever the underlying files happened to spell rather than from the table.
For a JSON table whose bodies use camelCase keys, a view over a table
declaring lowercase columns still reported camelCase, and a client reading
the declared names found nothing.

Athena reports a table's declared column names: the catalog owns the schema
and the SerDe maps the data onto it. A client written against that contract
reads `tenantid` where the file says `tenantId`, gets no match, and sees an
empty result with no error anywhere - the query succeeds, the rows are
there, and every field is blank.

Project the declared columns explicitly instead. Identifier resolution is
case-insensitive here, so a declared name still binds to an inferred one
differing from it only by case. Partition keys are projected alongside the
data columns: they are part of the table's schema and are what partition
predicates filter on. A partition key repeating a data column is projected
once, since binding it twice would make the view ambiguous.

A table that declares no columns keeps *, leaving inference in charge, so
catalogs that never declared a schema are unaffected.
2026-09-11 14:04:22 -04:00
Olamide Kosile c48e81d956 fix(cognito): delete a pool's users and resource servers on DeleteUserPool (#3419)
Fixes #2864. DeleteUserPool cascaded to groups and (since #2858) identity
providers, but left userStore and resourceServerStore untouched. A pool id
can be pinned with the floci:override-id tag, so unlike real AWS (where a
pool id is never reused) a pool recreated on the same id inherited the
deleted pool's users, password hashes included, and resource servers.

Adds the same prefix-scan cascade already used for groups/identity
providers to users and resource servers, and adds regression tests for
both cases mirroring the identity-provider orphan-reuse test from #2858.
Verified by disabling the new cascade and confirming both new tests fail
with the exact expected count mismatch before restoring it. Full cognito
package regression (368 tests) passes clean.
2026-09-11 13:59:49 -04:00
Niels Kootstra 70176d6287 fix(neptune): isolate resources by account and region (#3401)
* fix(neptune): isolate resources by account and region

* fix(neptune): migrate legacy resources by request scope

* fix(neptune): preserve region filtering in query listings

* chore: retrigger pull request checks
2026-09-11 13:57:17 -04:00
Ovidiu 62abde805a fix(lambda): recover a DynamoDB Streams ESM from a trimmed checkpoint (#3412)
A DynamoDB Streams ESM stores the sequence number of the last record it
delivered and resumes with AFTER_SEQUENCE_NUMBER on the next poll. The
stream retains a bounded window (MAX_RECORDS), so a burst of writes that
outruns the consumer can push that checkpoint out of the window. getRecords
then raises TrimmedDataAccessException, which the poll loop caught only as a
generic Exception: it logged a warning and left the checkpoint untouched.

The next poll re-derived the same cursor and failed the same way, so the ESM
wedged permanently. Every later write still reached the stream and none was
ever delivered, with nothing surfaced to the client beyond a warning line
repeating once per poll interval. Seen in the wild as a data pipeline that
stopped dead after a bulk import and stayed dead for hours, the emulator
logging the same warning several thousand times.

Treat a trimmed checkpoint as what it is - a cursor that can never succeed -
and resume from the oldest record the stream still holds, as AWS does when a
consumer is overtaken by the trim horizon. Records written between the lost
checkpoint and the trim horizon are gone from the stream and are not
delivered; the warning says so. Any other stream failure keeps the previous
behaviour and retries the same window.
2026-09-11 13:48:21 -04:00
Niels Kootstra c4ff42b800 fix(transcribe): isolate jobs and vocabularies by account and region (#3402)
* fix(transcribe): isolate jobs and vocabularies by account and region

* fix(transcribe): migrate legacy vocabularies by scope
2026-09-11 13:34:20 -04:00
Matheus André 8d011cb983 fix(apigateway): implement MOCK integration response selection based on status code (#3327)
Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-11 12:11:12 -04:00
Kenshin Okinaka e219ea409f feat(ses): support v2 dedicated IP (IP-level) and scaling/warmup APIs (#3420)
Add the remaining SES v2 dedicated-IP operations on top of pool management:
GetDedicatedIps, GetDedicatedIp, PutDedicatedIpInPool,
PutDedicatedIpWarmupAttributes, PutDedicatedIpPoolScalingAttributes, and
PutAccountDedicatedIpWarmupAttributes.

SES has no API to create a dedicated IP (they are leased out-of-band or
auto-provisioned), so Floci models an account with no dedicated IPs:
GetDedicatedIps is empty and any IP-targeted operation returns NotFoundException
'Could not find dedicated IP <ip> under this account.', matching real AWS for an
account with no leased IPs (verified 2026-06-21). PutDedicatedIpPoolScalingAttributes
updates the pool's scaling mode, and PutAccountDedicatedIpWarmupAttributes stores
the account-level flag now reflected by GetAccount.

Add integration and AWS SDK v2 compatibility tests.
2026-09-11 12:01:13 -04:00
Kenshin Okinaka d96516dc70 feat(firehose): apply the Lambda transform to buffered records (#3393)
* feat(firehose): apply the Lambda transform to buffered records

A flushed buffer now goes to the Lambda processor's function as a single
invocation, and what the function returns is what reaches the destination.
Ok delivers the returned data, Dropped leaves no trace, and every other
outcome routes that record to the error output while the rest of the batch
still delivers: ProcessingFailed, a record the function did not return, a
record id returned twice, and an Ok carrying no data.

A function-level error is retried NumberOfRetries more times and then fails
the whole batch as Lambda.FunctionError; a response the function returned
successfully is final however malformed it is, matching what AWS reports for
a response naming no records at all.

The transformation runs ahead of data format conversion, so a stream
configured for both converts what the function returned, and the
"not applied yet" warning the configuration used to log is gone.

* fix(firehose): clamp a NumberOfRetries wider than a long, and heal a stored Enabled

Long.parseLong threw for a NumberOfRetries too wide for a long, which the
catch treated as "not a number" and answered with the default 3. A larger
retry count than one that clamps therefore got fewer attempts: 2147483648
delivered 101 attempts where 999999999999999999999 delivered 4. Reading it
as a BigInteger keeps the clamp meaningful at any magnitude.

A ProcessingConfiguration persisted before Enabled was defaulted never
passes canonicalizeProcessors again, so the describe path now fills it, the
way that path already self-heals partial BufferingHints. Only Enabled: the
parameters AWS defaults include RoleArn, which a read must not inject from
whatever role is current by then.
2026-09-11 11:45:03 -04:00
Niels Kootstra c6e64a0977 fix(mwaa): isolate environments by account and region (#3400)
* fix(mwaa): isolate environments by account and region

* fix(mwaa): migrate legacy environment records safely
2026-09-11 10:25:21 -04:00
XuJianandxujiantop-crypto 5bf8075d52 fix(sfn): support advanced JSONPath expressions (#3398)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-11 10:21:19 -04:00
Matan Baruch 485b7c5047 feat(rds): accept AWS IAM DB auth users on MySQL (#3395) 2026-09-11 10:10:26 -04:00
Franklin G. Mendoza efcbc4d993 feat(marketplace-metering): emulate AWS Marketplace Metering API (#3344) 2026-09-11 10:06:04 -04:00
Rafael Sierra f9f90cfc98 feat(s3): add object annotations support (#3324)
* feat(s3): add object annotations support

PutObjectAnnotation, GetObjectAnnotation, ListObjectAnnotations, DeleteObjectAnnotation
via the ?annotation subresource, with per-version storage, x-amz-annotation-directive
on CopyObject, s3:ObjectAnnotation:* notifications, and x-amz-object-if-match.

* fix(s3): serialize annotation restore with copy publication and sweep payloads on reset

* fix(s3): lock cross-account copy buckets via resolveBucket and log compat test cleanup
2026-09-11 10:00:16 -04:00
TATSUNO “Taz” Yasuhiro dffe34e133 fix(dynamodb): match AWS wording and order for Select rejections (#3410)
* fix(dynamodb): match AWS wording and order for Select rejections

Query and Scan share one Select validator. It reported Floci wording and
checked the rules in the wrong order, so a request breaking both the
ProjectionExpression rule and the IndexName rule named the wrong one.

The ProjectionExpression conflict is now reported first, and each message
names the Select value the way AWS does. The SPECIFIC_ATTRIBUTES message
without a projection also matches AWS, which prefixes the error count on
Query but not on Scan.

Closes 8 TIER 1 and 2 TIER 3 cases in the dynamodb-conformance suite.

* test(dynamodb): cover the bare Select message on Scan

Scan returns the message without the validation count prefix, Query keeps it.
Only the Query side had a handler-level test.
2026-09-11 09:53:13 -04:00
TATSUNO “Taz” Yasuhiro be578ac13f fix(mwaa): probe the metadata database over TCP before starting Airflow (#3406)
The official postgres image serves first-boot init through a temporary
server that listens only on the Unix socket, then restarts it. The
readiness probe ran pg_isready over that socket, so it could pass
against the temporary server before the final server accepted TCP
connections from the Airflow container. Probe TCP loopback instead.
2026-09-11 09:26:48 -04:00
TATSUNO “Taz” Yasuhiro 14b0875a27 fix(rds): wait for the final PostgreSQL server before reporting the instance ready (#3405)
The official postgres image serves first-boot init through a temporary
server that listens only on the Unix socket, then restarts it. The
readiness probe ran psql over that socket, so it passed against the
temporary server and CreateDBInstance returned while the container was
still restarting. A CreateDBSnapshot sent right after then failed
pg_dumpall and returned InvalidDBInstanceState.

Run the rds_iam role setup over TCP loopback instead, as the Redshift
readiness check already does. The temporary server never listens on
TCP, so the command only succeeds once the final server is up. Loopback
connections are trusted by the generated pg_hba.conf, so no password is
needed. Log the cause when a snapshot fails. The round-trip container
test waits the same way.

Fixes #3384
2026-09-11 09:20:01 -04:00
Franklin G. Mendoza 3c080e1ea6 feat(marketplace-reporting): emulate AWS Marketplace Reporting API (#3343) 2026-09-11 09:15:23 -04:00
luiseterc ee23e26bc3 feat(ec2): implement DescribeSpotPriceHistory (#3359)
* feat(ec2): implement DescribeSpotPriceHistory

* test(ec2): verify DescribeSpotPriceHistory with SDK

* fix(ec2): honor spot price history dry run
2026-09-11 08:29:06 -04:00
Hector Ventura 7c08b35f1d fix(core): read ARN resource segments by structure, not by position (#3392)
AwsArnUtils parses an ARN's five top-level fields and hands the resource back
whole, because its structure is service-specific. Five services then split that
resource by counting from an end, and each is wrong on input AWS accepts.

SNS took the segment after the last colon as a Lambda function name, so a
subscription to a qualified ARN (...:function:order-processor:PROD) invoked a
function named PROD. The message was accepted, reported as published, and
delivered nowhere. S3 and Step Functions already cut after ":function:"; SNS
was the outlier and now matches them.

Step Functions decided between a state machine ARN and a version ARN by asking
whether the last segment was all digits. Digits are legal in a state machine
name, so a machine named 2024 was taken apart into version 2024 of a nameless
ARN, and validation then refused it: DescribeStateMachine returned InvalidArn
for a state machine that exists. The rule is now the resource's segment count,
stateMachine:<name> against stateMachine:<name>:<version>, and the two inline
copies of the old rule route through it so all three sites agree.

AppSync read the API id as the segment after the last slash, so tagging a data
source looked up an API by the data source's id and answered NotFound. The
model anchors AppSync's ResourceArn to apis/<26 chars> with nothing after it,
so a sub-resource ARN is not taggable at all and the answer is 400. That shape
is adopted verbatim except for the partition: the model spells it aws, but this
emulator mints API ARNs with the region's own partition and has to accept the
ARN it just returned.

Two are hardening rather than live failures, and neither is reachable through
the public API today, so neither carries a test: the microVM controller used a
bare split where a guarded regionOf sits in the same class, and S3 Tables
guarded on ":" + prefix while cutting on the prefix alone, which only diverges
for a name containing the prefix that the name charset already blocks.

Each behavioural fix was checked by reverting its source file and confirming
the new tests fail without it.
2026-09-11 08:07:58 -04:00
BingEdward 862e4a1c77 fix(dynamodb): reject out-of-bound query cursors (#3389)
Signed-off-by: 7487 <1042653432@qq.com>
2026-09-11 00:24:49 -04:00
XuJianandxujiantop-crypto ce073930b9 fix(sfn): resolve context reference paths (#3390)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-11 00:17:28 -04:00
TATSUNO “Taz” Yasuhiro fbe92aa411 fix(dynamodb): more request validations in Query and Scan (#3360)
* fix(dynamodb): accept and report Query key conditions the way AWS does

Three gaps in KeyConditionExpression validation.

A sort-key comparison with the value on the left, such as ":lo <= sk",
is valid on AWS and means "sk >= :lo". Floci rejected it because it only
looked for the attribute on the left. The operands are now normalised
before the key checks run.

A nested path on a key attribute now reports that it cannot carry a
condition, instead of the generic unsupported message.

A condition on a non-key attribute now reports the partition key it left
unconditioned, which is what AWS answers.

Closes 2 TIER 1 and 1 TIER 3 case in the dynamodb-conformance suite.

* fix(dynamodb): bound Segment and TotalSegments on Scan

A parallel Scan accepted a negative Segment. A TotalSegments of 0 was
rejected, but with the zero-based wording instead of the AWS constraint
wording. Both are now rejected with the AWS constraint wording, before
the required-parameter checks run. The TotalSegments upper bound from
#3287 moves into the same block, so several violations are reported in
one message.

Closes 1 TIER 3 case in the dynamodb-conformance suite.

* fix(dynamodb): report TotalSegments before Segment on Scan and test the lower bound
2026-09-11 00:08:03 -04:00
Vũ Thế Huy 6b17ef2b1c feat(redshift): emulate GetClusterCredentials and GetClusterCredentialsWithIAM (#3273)
* feat(redshift): add RedshiftCredentialBroker for short-lived Db credentials

* refactor(rds-proxy): widen PasswordValidator to a three-value AuthResult

The wire-level password check the PostgreSQL/MySQL proxy handlers take now
returns REJECT / PASSTHROUGH / MASTER_EQUIVALENT instead of a boolean, so a
caller can tell the proxy to open the backend leg as the cluster master for a
client it has vouched for. RdsAuthProxy keeps its own boolean master-password
callback, renamed MasterPasswordCheck to free the PasswordValidator name, and
adapts it at the handler boundary (non-master stays PASSTHROUGH).

* feat(redshift): auth proxy accepts live GetClusterCredentials credentials

passwordValidatorFor now returns AuthResult and consults RedshiftCredentialBroker:
the master pair and any live minted credential resolve to MASTER_EQUIVALENT, a
known broker user with a stale password is REJECTed, everyone else PASSTHROUGH.

* feat(redshift): add default-credential-duration-seconds config

* feat(redshift): implement GetClusterCredentials action

Mints a short-lived DbUser/DbPassword pair via RedshiftCredentialBroker and
returns it as Query-protocol XML. AutoCreate prefixes IAM: on the DbUser,
DbGroups are echoed, DurationSeconds is validated to 900-3600 (default from
the new config key), and an unknown ClusterIdentifier propagates ClusterNotFound.
The two credential actions are registered in AwsQueryController.REDSHIFT_ACTIONS
and the Query dispatch now forwards the Authorization header to the handler.

* feat(redshift): implement GetClusterCredentialsWithIAM action

Derives the DbUser from the caller's IAM identity resolved via the Authorization
header: an IAM user maps to IAM:<name>, an assumed role to IAMR:<role>, and an
unresolvable caller to the IAMR:floci fallback with a WARN so local and CI flows
are not blocked. Any DbUser request parameter is ignored.

* feat(redshift-data): resolve non-master DbUser via GetClusterCredentials

resolveViaDbUser now accepts a DbUser that has a live credential in
RedshiftCredentialBroker, connecting to the container as the cluster master
(the minted DbUser is nominal). An unknown non-master DbUser still fails with
ValidationException.

* test(redshift): end-to-end GetClusterCredentials + Data API non-master DbUser

Docker-gated: mints a credential for a non-master DbUser via GetClusterCredentials
then runs SELECT 1 through the Data API as that DbUser, asserting the result.

* test(compat): SDK coverage for Redshift GetClusterCredentials

Adds getClusterCredentials and getClusterCredentialsWithIAM assertions to the
AWS SDK Redshift compatibility test.

* docs(redshift): document GetClusterCredentials and GetClusterCredentialsWithIAM

Regenerates the redshift.md action table (excluding the DbGroups member-name
switch label), fills the two new descriptions, updates the wire-auth and
redshift-data.md DbUser notes, and bumps the Service Matrix count to 23.

* fix(redshift): reject a wrong master password instead of passing it through

passwordValidatorFor only treated the master pair as MASTER_EQUIVALENT and let
everything else fall to the broker. A request with the master username but a
wrong password is unknown to the broker, so it classified as PASSTHROUGH; the
wire proxy then opened the backend leg as master (isMaster is username-only) and
the client authenticated with the wrong password. Now the master username is
decided on its own password: match to MASTER_EQUIVALENT, mismatch to REJECT.

* fix(redshift): reject proxy logins when the cluster row is gone; strip IAM user path

passwordValidatorFor fell through to the broker when the cluster was absent from
the account partition, classifying an unknown user as PASSTHROUGH; the wire proxy
reads isMaster from its own start-time config, so that still opened the backend
as master for the master username with any password. Return REJECT when there is
no cluster row to validate against.

RedshiftIamDbUserResolver now strips an IAM path prefix from a user ARN
(user/team/alice -> alice), matching how AWS names the DbUser.

* fix(redshift): keep concurrent credentials, revoke on delete, bound the config default

Addresses PR review (greptile):
- RedshiftCredentialBroker now holds every unexpired credential per DbUser instead
  of one slot, so a reissue no longer invalidates a still-live password (matches
  AWS, which keeps each issued credential valid to its own expiry).
- Add revokeCluster(); RedshiftService calls it on deleteCluster and at the start
  of createCluster, so a cluster recreated with the same identifier does not
  inherit master-equivalent access from a stale credential.
- resolveDurationSeconds now holds the YAML default to the same 900-3600 bounds as
  a request value, falling back to 900 with a WARN instead of minting a credential
  that is already expired or over-range.

* fix(redshift): revoke temp credentials on createCluster rollback too

The greptile review asked for revocation on 'relevant rollback paths'. Both
createCluster failure branches that delete the cluster row now also call
credentialBroker.revokeCluster, so a credential issued by a concurrent
GetClusterCredentials while the row briefly existed cannot outlive it.

* fix(redshift): correct GetClusterCredentials AutoCreate prefix

AWS prefixes the returned DbUser with IAM: when AutoCreate is false and
IAMA: when it is true. The handler returned IAM: when true and no prefix
when false, so a client using the returned name could not authenticate
and the value diverged from GetClusterCredentialsWithIAM, which already
issues prefixed identities.

The broker keys on the returned name, so the proxy and Data API now
expect the prefixed DbUser. Tests and the redshift docs are updated to
match.

* test(redshift): give compat GetClusterCredentials tests distinct @Order

Three methods shared @Order(2), leaving their relative order undefined.
Number the two credential tests 3 and 4 and move testDeleteCluster to 5.
2026-09-10 23:58:33 -04:00