Commit Graph
1753 Commits
Author SHA1 Message Date
Brian Taylor 24a8c8440b fix(lambda): resolve layer version ARNs by account (#2948)
* fix(lambda): resolve layer version ARNs by account

Layer resolution dropped the ARN's account segment, so an ARN naming another
account resolved inside the caller's own partition. Two consequences, filed
separately as #2813 and #2809.

A foreign ARN whose layer name and version happened to match one of the
caller's own resolved to that layer: the function recorded an ARN it was not
using, and the launcher mounted different content at /opt than
GetFunctionConfiguration reported. resolveLayerByArn now scopes the lookup to
the caller's account and partition, so a foreign ARN is a miss.

A foreign ARN that matched nothing was rejected outright, which no AWS-managed
public layer can ever satisfy: Powertools, the AppConfig extension and
Datadog-published layers all live in AWS-owned accounts, and every Terraform
stack attaching one failed at CreateFunction. Validation now applies the
eager existence check only to the caller's own account and records a foreign
ARN unresolved, warning that its content is not mounted.

Measured against the live service in ap-southeast-1:

  CreateFunction, foreign ARN matching an own layer name/version
    -> AccessDeniedException, not a substitution
  CreateFunction, AWS-managed Powertools layer
    -> 201, ARN echoed verbatim on GetFunctionConfiguration
  CreateFunction, missing layer in the caller's own account
    -> InvalidParameterValueException: Layer version ... does not exist.

The own-account message and status are unchanged, matching that third case
exactly. The AccessDenied case is a known divergence: Floci implements no
layer permissions, so it cannot tell a public layer from one the caller has no
policy for, and accepts both.

Closes #2813
Closes #2809

* fix(lambda): reject foreign-partition layer ARNs when attaching them

GetLayerVersionByArn already answers a non-aws partition with
InvalidParameterValueException, but CreateFunction and
UpdateFunctionConfiguration accepted the same ARN and persisted it, so a
function could carry a layer Floci's own lookup path calls invalid.

Partitions are isolated, so no resource policy can ever make a cn or
gov layer readable from the aws partition. That is what separates it
from a foreign account, where a policy can, and where AWS-managed public
layers live. Foreign accounts stay accepted; foreign partitions now
reject with the message GetLayerVersionByArn already uses.

Measured on CreateFunction in ap-southeast-1: a cross-partition layer
ARN and a foreign-account layer ARN both fail with AccessDeniedException,
so the live service does not distinguish them at this call. The split
here is Floci's, on reachability grounds, and is documented as such.

* fix(lambda): gate foreign-account layer ARNs behind a config flag

Review asked for the accept-foreign-ARN behaviour to be opt-in rather than the
default, on both PRs' reasoning that it broadens what CreateFunction accepts
beyond AWS. It is now floci.services.lambda.accept-external-layer-arns, default
false, env FLOCI_SERVICES_LAMBDA_ACCEPT_EXTERNAL_LAYER_ARNS.

Off, a layer ARN naming another account is refused. On, it is recorded on the
function verbatim and its content is not mounted, which is what a stack
attaching Powertools or the AppConfig extension needs. A same-account ARN is
unaffected either way: a missing layer is still the eager
InvalidParameterValueException.

The refusal is AccessDeniedException, 403, not the InvalidParameterValueException
this branch previously used for the partition case. That was the second review
finding: the live probe in this PR measured CreateFunction returning
AccessDeniedException for a cross-partition ARN and the identical
AccessDeniedException for a same-partition foreign account, so reporting a
different error class than what was measured was an observable divergence
presented as parity. Both now report what AWS reported.

Cross-partition stays refused with the flag on. Partitions are isolated, so no
resource policy can make an aws-cn layer readable from aws, and
GetLayerVersionByArn already calls such an ARN invalid.

Negative control, with the default flipped to true and the tests kept:

  LambdaLayerArnAccountIntegrationTest
    foreignAccountArnIsDeniedByDefaultAndTheFunctionIsNotCreated
    updateFunctionConfigurationIsDeniedAndLeavesTheExistingLayerInPlace
  Tests run: 7, Failures: 2

Also moves the two generic ARN ownership checks this branch was adding into
AwsArnUtils as isForeignPartition and isForeignAccount, so the layer code keeps
only the layer-shaped part. Review noted RdsService.targetGroupBelongsTo already
carries its own copy and asked not to land a further one. The existing RDS, EKS
and EC2 copies are deliberately left alone; this only avoids adding another.
2026-09-13 00:19:37 -04:00
Kenshin Okinaka 6790024abc feat(firehose): convert array, struct and map columns to Parquet (#3521)
* feat(firehose): convert array, struct and map columns to Parquet

Data format conversion rejected every complex Hive type up front, so a
stream whose Glue table carried an array<string> or a struct<..> routed
its whole batch to the error output as UnsupportedSchema. That covers the
ordinary Firehose-to-Athena schema, where a JSON event nests.

A column's type is now a recursive tree feeding DuckDB's read_json, and
values coerce the way real AWS's OpenX deserializer does (probed against
us-west-2 with a table of exactly these types):

- a value that is not an array is wrapped into a one-element array
- a struct takes its members from an object by name, dropping an
  undeclared one and leaving a missing one null, and an array fills them
  by position instead; a scalar fails the record
- a map accepts only an object, and its keys are lowercased
- member names match case-insensitively at every depth, and the scalar
  coercions apply inside containers as they do at the top level
- a mismatch at any depth fails that record alone, with the message AWS
  reports there

binary and uniontype stay unsupported, as does a type string the parser
cannot read; each still routes the batch to the error output.

* fix(firehose): refuse under HiveJsonSerDe what AWS refuses

The complex-type conversion applied OpenX's coercions whichever
deserializer was configured: a non-array wrapped into an array, an
array filling a struct by position, a string parsed into a numeric
column, a nested value serialized into a text column. AWS documents
the last two as things HiveJsonSerDe will not do, and a probe over a
Hive stream (us-west-2, twelve records over the same four complex
columns) confirmed it refuses all four and fails the record, with
messages now reproduced: "Start of Array expected", "Start of Object
expected", "Current token (VALUE_STRING) not numeric, can not use
numeric value accessors", and "One or more fields have incorrect
format. Exception when validating field (root)".

The two booleans threaded through the type tree became one SerDeRules
record built from the deserializer, with a third member for this. The
top-level scalar path shares ScalarType, so a string in a numeric
column now fails under Hive there too, which was a deviation before
this branch. Hive still coerces a number into a text column and treats
{}, missing and undeclared members as OpenX does, all probed. A map
column itself given a non-object, and a boolean column given a string,
were not probed; the docs say which way they fall.
2026-09-13 00:09:47 -04:00
Niels Kootstra b994d58e14 fix(s3): honor max-keys=0 and reject invalid max-keys values (#3510)
max-keys=0 was treated as "no limit", so ListObjects, ListObjectsV2 and
ListObjectVersions returned every key instead of an empty page, and a
negative value was accepted. AWS answers max-keys=0 with an empty page
and IsTruncated=false, and rejects negative, non-numeric or overflowing
values with InvalidArgument "Argument maxKeys must be an integer between
0 and 2147483647" plus ArgumentName and ArgumentValue.

The parameter is now read as a string so a non-integer value produces
that 400 instead of the 404 JAX-RS emits for a failed Integer conversion.
The DynamoDB import path, which relied on 0 meaning unlimited, now asks
for Integer.MAX_VALUE explicitly.
2026-09-12 23:08:32 -05:00
Matheus Oliveira 34062f6383 fix(lambda): report real runtime errors instead of Function.TimedOut (#3505)
RuntimeApiServer now reports real init errors, crashed processes, and
the actual FunctionError instead of Function.TimedOut, and retains the
fault payload so a same-cause enqueue() rejection returns it instead of
a generic ContainerStopped.

* Fix #3314

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 23:04:16 -05:00
Niels Kootstra 9f9a828439 fix(core): accept only JSON objects as JSON protocol request bodies (#3509)
The JSON 1.0 and 1.1 dispatchers handed whatever Jackson parsed straight
to the handlers, so a body of null, [] or a scalar reached code that
expects an object and failed with an unhelpful 500 instead of the
SerializationException AWS returns. Both dispatchers now reject any body
that is not a JSON object with the standard 400 SerializationException.

An empty or whitespace only body is still read as {}. The awsJson1_1
protocol requires services to accept no payload for operations that
define no input, and clients rely on that for calls such as Organizations
DescribeOrganization.
2026-09-13 00:03:31 -04:00
Niels Kootstra 76c1907214 fix(glue): bound DeleteSchemaVersions ranges before expanding them (#3508)
A Versions expression such as 1-9223372036854775807 was expanded into a
list before the 25 version limit was checked, so a single request could
exhaust memory. Reject any range that would expand to more than
MAX_DELETE_SCHEMA_VERSIONS entries with InvalidInputException up front,
and cover the exact 25 version boundary.
2026-09-12 23:44:59 -04:00
Brian Taylor 2a4ca61baf fix(cognito): delete a user pool's records with the pool (#2949)
* fix(cognito): delete a user pool's app clients, revocations and codes

#3419 took users and resource servers out with the pool, closing the half of
#2864 that was reported. Three more record types are the same defect and were
left behind: app clients, revoked token records and outstanding verification
codes.

On AWS a pool id is never reused, so nothing can inherit an orphan. Here
floci:override-id makes ids caller-chosen and therefore reusable, and a pool
recreated on a pinned id picks up whatever the deleted pool left.

Reproduced by pinning us-east-1_orphanprobe1, populating it, deleting the pool
and recreating it on the same id. The client leak is the serious one: the
deleted pool's client id kept resolving against the new pool, carrying a secret
the new pool's caller never saw.

  clients: ["c1"]
  describe-user-pool-client --client-id c1a93e3fc698451d96ed406adb -> c1

Clients are keyed by client id alone, so they are found by their userPoolId
field rather than a key prefix. Revoked tokens and verification codes have
their keys collected before deleting so the backing key set is not modified
while it is being iterated.

confirmSignUpNamesDeletedUserPoolInResourceNotFoundMessage, added by #2936,
built its orphaned client by deleting the client's pool, which this cascade
now prevents. It is renamed and reaches the same defensive path by dropping the
pool record alone, and a second case pins the new behaviour: a client id from a
deleted pool is gone with it.

Refs #2864

* fix(cognito): bound the delete cascade by pool ownership, not key prefix

floci:override-id makes pool ids caller-chosen, and validateOverrideId
permits a colon. Two live pools can therefore be named so that one id
plus the key separator is a prefix of the other, and the revoked-token
and verification-code cascades deleted by the matched key, so deleting
the shorter pool erased the longer one's records. For revoked tokens
that reinstated tokens the surviving pool had revoked.

Both records carry their own userPoolId, so ownership is now settled by
that field rather than by the key prefix. The other cascades reconstruct
the key from the pool id being deleted and so never reached across a
boundary; they are left alone.

A jti can itself contain a colon (global revocations use
global:{username}), so bounding the prefix by the separator would not
have been sufficient either.
2026-09-12 23:39:32 -04:00
Matheus Oliveira 8a452116bf fix(s3): evaluate IAM policy on presigned URL and presigned POST requests (#3504)
Presigned URL and presigned POST both skipped IAM identity-policy
evaluation. The POST-side check now also runs independent of
S3's enforce-auth flag, matching the presigned-URL path, and now
resolves the account from the parsed credential instead of the
ambient request context set before the multipart body was parsed.

* Fix #3195

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 23:21:34 -04:00
Hector Ventura b618fa9033 fix(cloudformation): expose the RDS resource-id GetAtt attributes (#3527)
AWS::RDS::DBCluster declares DBClusterResourceId readOnly and AWS::RDS::DBInstance
declares DbiResourceId, and RdsService already assigns both. Neither reached the
stack resource, so Fn::GetAtt on either resolved to the literal "LogicalId.Attr"
rather than the id, the silent failure mode Fn::GetAtt has when an attribute was
never mapped.

Invisible until now: the types were LEGACY_SWITCH, and CfnSchemaCoverageTest skips
those. Moving them to a provisioner is what surfaced it.

The other 17 attributes that surfaced with them stay recorded as gaps, because
Floci does not emulate what they describe: read replicas, multi-AZ secondaries,
point-in-time restore windows, RDS Custom automation. Endpoint and ReadEndpoint
are recorded too, for a different reason: the dotted Endpoint.Address,
Endpoint.Port and ReadEndpoint.Address are already set, and that is the form
AWS's GetAtt exposes for these types.

Both assertions fail against the previous commit, returning null.
2026-09-12 22:19:42 -05:00
lex00andlex00 5d0b0b44b1 fix(ec2): store and validate CreateVpcEndpoint SubnetConfiguration (#3491)
* fix(ec2): store and validate CreateVpcEndpoint SubnetConfiguration

CreateVpcEndpoint accepted SubnetConfiguration.N and dropped it, so an
interface endpoint took floci's own synthesized address in each subnet rather
than the one the caller pinned. Terraform's aws_vpc_endpoint sends the
subnet_configuration block on create and reads it back by following the
endpoint to its network interfaces, so every plan after the apply saw an
address it never asked for and proposed replacing the endpoint.

SubnetConfiguration is request-only in ec2/2016-11-15. No output shape carries
it, so the addresses are stored on the endpoint and consumed when its
interfaces are built, and DescribeVpcEndpoints echoes nothing new.

Ec2QueryHandler parses the flattened SubnetConfiguration.N list for
CreateVpcEndpoint and for ModifyVpcEndpoint, which takes the same parameter.
Ec2Service validates each entry against the named subnet, rejecting an IPv4
address outside its CIDR with InvalidParameterValue, and keeps the pinned
address on the endpoint's interface in that subnet. A subnet named only
through its configuration joins the endpoint's subnet set. Ipv6 is stored as
given, since floci's subnets carry no IPv6 CIDR to validate against and its
network interfaces have no IPv6 field yet.

Adds Ec2VpcEndpointSubnetConfigurationIntegrationTest over the query wire and
three Ec2ServiceTest cases for the create, modify and rejection paths.

* fix(ec2): reject the subnet-reserved addresses in SubnetConfiguration

validateSubnetConfigurations only checked that SubnetConfiguration.Ipv4 parsed
and fell inside the named subnet's CIDR. For a 10.61.1.0/24 subnet that let
10.61.1.0, .1, .2, .3 and .255 through, and each became the private address of
the endpoint's network interface. AWS keeps those five for itself, so none of
them can be assigned to a resource and no real endpoint could ever report one.

The rule is in ec2/2016-11-15 itself, in the CreateSubnet documentation:
"Amazon Web Services reserves both the first four and the last IPv4 address in
each subnet's CIDR block. They're not available for your use." CreateSecondarySubnet
says the same for secondary subnets. No constraint key carries it, and no shape
in the model states it for SubnetConfiguration.

Ipv4Cidrs.isSubnetReserved is new; the EC2 service had no reserved-address helper
to reuse. VpcNetworkManager.firstHostOffset looks close but is not the same rule:
it reserves ten addresses of Docker-network headroom at the bottom of a block and
nothing at the top, for allocation readability rather than AWS semantics.

Small blocks need no special case. A /28, the smallest subnet AWS accepts, keeps
11 of its 16 addresses and a /29 keeps three. Both ends are clamped so they cannot
cross in a block of four addresses or fewer, where every address is reserved.

The check sits in the shared validator, so CreateVpcEndpoint and ModifyVpcEndpoint
both refuse a reserved address with the InvalidParameterValue the containment check
already raises. Tests cover all five reserved addresses and one ordinary host
address on the create path, the modify path, a /28 subnet, and the query wire.

---------

Co-authored-by: lex00 <artigues.dev@gmail.com>
2026-09-12 22:32:12 -04:00
lex00 fe40e06938 feat(ec2): support snapshot block public access (#3490)
* feat(ec2): support snapshot block public access

Adds EnableSnapshotBlockPublicAccess, DisableSnapshotBlockPublicAccess and
GetSnapshotBlockPublicAccessState over the EC2 Query protocol.

The setting is account-level state scoped to one region, so it lives in a small
Ec2SnapshotBlockPublicAccessService keyed by region, mirroring
Ec2EbsEncryptionService. The account-aware storage backend namespaces the keys by
the calling credential's account. A region that was never configured reads back
unblocked.

Enable accepts only block-all-sharing and block-new-sharing, per the EC2 model,
and rejects unblocked with InvalidParameterValue. Disable returns the resulting
unblocked rather than the prior state. Only the Get response carries managedBy,
always account, since Floci has no declarative-policy layer.

* fix(ec2): honor DryRun on snapshot block public access

EnableSnapshotBlockPublicAccess, DisableSnapshotBlockPublicAccess and
GetSnapshotBlockPublicAccessState all model the standard DryRun parameter, but
none of the three handlers checked it. Enable persisted the requested state,
Disable persisted unblocked and Get answered 200, so DryRun=true had real side
effects on both write paths.

All three handlers now take the parameter map and call the existing
checkDryRun(params). Enable validates State first, through a new
validateEnableState on the service, because AWS reports an invalid parameter
ahead of DryRunOperation and only returns DryRunOperation once the request
would otherwise have succeeded. So State=unblocked with DryRun=true still
fails with InvalidParameterValue, and a missing State still fails with
MissingParameter.
2026-09-12 20:21:34 -04:00
Franklin G. Mendoza 8963c665eb fix(cloudformation): preserve SAM implicit API auth (#3501) 2026-09-12 18:48:43 -05:00
lex00 cebb011a00 fix(autoscaling): round-trip the dropped Auto Scaling group fields (#3494)
* fix(autoscaling): round-trip the dropped Auto Scaling group fields

CreateAutoScalingGroup and UpdateAutoScalingGroup accepted DesiredCapacityType,
CapacityRebalance, MaxInstanceLifetime and DefaultInstanceWarmup and threw them
away, so DescribeAutoScalingGroups never read them back. A mixed instances policy
launch template override that selected instance types by InstanceRequirements
instead of by name was dropped the same way, and because the override parser used
InstanceType's presence as its only "is there another override" signal, such an
override also truncated the whole Overrides list.

The four scalar members now travel into AutoScalingService as one AsgOptionalFields
record and are stored on AutoScalingGroup as boxed, uninitialised fields, so a group
that never set one omits it from the Describe response rather than reporting a
default. Update keeps its partial-update semantics: an absent member leaves the
stored value alone. DefaultInstanceWarmup honours the documented -1 removal
sentinel, MaxInstanceLifetime must be 0 or at least 86400, and DesiredCapacityType
is checked against units, vcpu and memory-mib.

LaunchTemplateOverrides.InstanceRequirements parses and echoes every member of the
botocore shape except BaselinePerformanceFactors, and an override that sets both
InstanceType and InstanceRequirements raises ValidationError as AWS does.

Verified against botocore autoscaling/2011-01-01/service-2.json from awscli 2.35.24.

* fix(autoscaling): enforce the attribute-based instance selection rules

Two rules that botocore states but does not encode as constraints were missing.

DesiredCapacityType is typed XmlStringMaxLen255 with no enum, and
CreateAutoScalingGroupType.members.DesiredCapacityType.documentation carries the
rule: "Amazon EC2 Auto Scaling supports DesiredCapacityType for attribute-based
instance type selection only." Floci accepted vcpu and memory-mib for a group
whose launch template names a fixed instance type. Both values now raise
ValidationError unless the mixed instances policy left in effect by the request
carries a launch template override with a non-empty InstanceRequirements. units
is the documented default and stays legal everywhere, and an absent member is
not validated.

The effective policy is the one the request supplies on create. On update it is
the policy the request supplies, the stored policy when the request names no
launch source, or none when the request switches the group to a launch
configuration or a plain launch template. The effective DesiredCapacityType is
likewise the request value or, when absent, the stored one, so an update cannot
strip attribute-based selection out from under a stored vcpu.

shapes.InstanceRequirements.required is ["VCpuCount", "MemoryMiB"] and the shape
documentation repeats it as "You must specify VCpuCount and MemoryMiB". An
override carrying InstanceRequirements without both ranges was stored and
returned 200; it now raises ValidationError. Both rules run on create and on
update.

createGroupCarryingEveryOptionalField is @Order(1) and seeds the group the later
ordered tests reuse, so its setup moved from a launch template naming t3.micro
to a mixed instances policy whose override sets VCpuCount and MemoryMiB. That
makes its DesiredCapacityType=vcpu legal without relaxing any assertion, and the
ordered updates that follow still see attribute-based selection in effect.
2026-09-12 18:37:36 -05:00
Hector Ventura 29e9ae9221 refactor(cloudformation): move the RDS types into RdsCfnProvisioner (#3459)
Moves all seven AWS::RDS types out of the monolith switch into a per-service
provisioner. Method bodies are carried over unchanged except for the six
master-credential call sites described below; the rest is plumbing.

The seven types delete by physical id alone, so the id-only delete override
serves all of them and none appears in DELETE_NEEDS_STACK_RESOURCE.

Unlike the ECS, ELBv2, Cognito, EC2-networking, Events and Batch batches, this
one does not take its service out of the monolith. SecretTargetAttachment is
still served there and reads an instance's or cluster's endpoint through
RdsService to build its connection detail, so the field, its constructor
parameter and its import all stay. Four helpers the RDS block shared with other
types stay too, copied into the provisioner: sameNameExistingResource,
deleteRenamedResource, parseIntProp and parseCfnTags. firstNonBlank,
parseBoolProp and parseOptionalIntProp had no non-RDS callers left and moved
outright.

Name generation now goes through ProvisionContext.generatePhysicalName rather
than a copy: the two implementations were already byte-identical, down to the
12-character suffix.

MasterUsername and MasterUserPassword keep the opt-out #3301 gave them. The
engine resolves dynamic references for every property now, with ssm-secure
rejected, so those two properties read through
resolveOptionalWithoutDynamicReferences and resolve their own references with
ssm-secure allowed. Reading them with the ordinary resolveOptional compiles and
leaves the suite green while breaking ssm-secure on the only resource AWS
permits it on, so the monolith's helper moves across with the code rather than
collapsing into the ordinary path.

CloudFormationRdsDynamicReferenceIntegrationTest is new and covers that, because
nothing did. RdsCfnProvisionerTest builds its engine without a dynamic-reference
resolver, so the general stage is off there and its assertions hold either way,
and CloudFormationDynamicReferenceIntegrationTest has no RDS case. The ssm-secure
test fails with ROLLBACK_COMPLETE when the opt-out is reverted, and the plain ssm
test guards the other direction.

The 69 existing RdsCfnProvisionerTest tests and the 2 integration tests pass
unchanged, which is the guard that the move preserved behaviour: both build
through CfnProvisionerFixture, so they exercise the new provisioner without
knowing it exists. The fixture's CfnDynamicReferences wiring had to move ahead
of the registry build, since the provisioner takes it as a constructor argument.

Making the types provisioner-owned rather than LEGACY_SWITCH puts them under
CfnSchemaCoverageTest for the first time, which the switch was exempt from. The
19 attributes it found are recorded as gaps here, unchanged from what the switch
set. Two of them are closable and a follow-up PR closes them, kept out of this one
so it stays a pure move; Endpoint and
ReadEndpoint are recorded rather than set because the dotted sub-attributes
already carry them, which is the form AWS's GetAtt actually exposes.

Monolith 5,942 to 5,458 lines, legacy types 39 to 32.
2026-09-12 16:13:37 -05:00
Niels Kootstra 2104b33ea7 fix(codepipeline): cap QUEUED and PARALLEL pipelines at 50 active executions (#3503)
AWS allows at most 50 concurrent executions per QUEUED or PARALLEL
pipeline. StartPipelineExecution now counts the pipeline's InProgress
and Stopping executions under a per-pipeline admission lock and returns
ConcurrentPipelineExecutionsLimitExceededException at the limit. The
admission lock is separate from the monitor a QUEUED worker holds for
its whole run, so a start never waits for the running execution.

A start that reaches the executor after shutdown is persisted as Failed
and returns ConflictException instead of leaking
RejectedExecutionException. Shutdown waits up to five seconds for
execution workers to stop so their final status writes complete before
the process exits.
2026-09-12 14:25:07 -04:00
Ovidiu (Ovi)andOvidiu ea5925f630 feat(athena): add UpdateWorkGroup support (#3468)
* feat(athena): add UpdateWorkGroup support

* fix(athena): validate workgroup configuration updates

---------

Co-authored-by: Ovidiu (Ovi) <462561+ovidiubute@users.noreply.github.com>
2026-09-12 14:15:00 -04:00
Aniket Shukla e62e99f060 fix(core): prevent REST JSON requests falling through to S3 (#3498) 2026-09-12 14:00:37 -04:00
Matheus Oliveira cfe9f84ffe feat(eventbridge): run ECS tasks from classic rule targets (#3484)
PutTargets now parses EcsParameters on an ECS cluster ARN target and
the invoker calls ecs:RunTask when the rule fires, mirroring how the
Scheduler already delivers to ECS. An InputTransformer shaped as a
TaskOverride is parsed into containerOverrides and passed through, per
AWS's documented ECS target behavior.

* Fix #2558

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 14:00:19 -04:00
Niels Kootstra 6507f32aea fix(firehose): keep buffered records when S3 delivery fails (#3471)
* fix(firehose): keep buffered records when S3 delivery fails

A failed S3 write dropped the batch it was delivering. Records that came in
through PutRecord were lost; records polled from a Kinesis source were only
recovered by re-reading from the committed checkpoint.

A failed delivery now restores the batch at the front of the buffer, ahead
of records that arrived while the write was in flight, keeps the buffer's
original start time so the next scheduled tick retries it, and re-pends the
source checkpoint so a later successful delivery commits it. Successful
delivery, compression and the scheduled flush are unchanged.

* fix(firehose): serialize delivery per stream so a later flush cannot commit past an unresolved batch

The buffer monitor only made the snapshot atomic. A poll that had read past
a first flush's checkpoint could buffer its records after that flush took
the pending position, and a second flush would then deliver them and commit
a position past the first batch while its S3 write was still in flight. If
that write failed, the durable checkpoint already sat past records that
were only buffered for retry, and a restart before the retry skipped them.

One delivery at a time per stream, from taking the buffer to committing or
restoring its checkpoint, closes that window; the poller keeps buffering
under the buffer lock alone, so a slow write never stalls a poll.

* docs(firehose): a failed S3 write now keeps its batch buffered

* docs(firehose): drop the stale no-retry note in the Parquet converter
2026-09-12 13:50:21 -04:00
XuJianandxujiantop-crypto c18c80e557 fix(sfn): treat null as falsy in JSONPath negation (#3497)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-12 13:44:20 -04:00
XuJianandxujiantop-crypto 8e3bd63c15 fix(ecr): recover backing registry containers (#3486)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-12 13:42:41 -04:00
Matheus Oliveira 15eff7e4cd fix(storage): log effective storage mode at boot (#3495)
PersistentPathValidator now logs the effective storage mode once at
INFO, making memory-mode data loss visible instead of silent.

* Fix #2225

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 13:39:46 -04:00
Ovidiu 547090bdfb fix(apigateway): only emit the greedy path parameter for greedy resources (#3397)
* fix(apigateway): only emit the greedy path parameter for greedy resources

REST (V1) proxy events carried a "proxy" key in pathParameters on every
request, not just for greedy resources. The value came from the controller's
own JAX-RS binding - the class is mounted at @Path("/{proxy: .*}"), so
`proxy` is non-empty for every request regardless of which API Gateway
resource matched.

AWS emits pathParameters.proxy only when the matched resource itself declares
a greedy parameter. For /datasets/{datasetId} it sends {"datasetId": "..."}
and nothing else. Integrations that validate the event against a strict
schema (JSON Schema additionalProperties: false) therefore rejected every
request to a parameterised resource, which made every findOne/updateOne/
deleteOne style route unusable behind such an integration.

The two meanings of "proxy" coincide only for a root-level /{proxy+}
resource, which is why this went unnoticed: that is the shape the code was
originally written for. extractPathParams already skips greedy params
deliberately, and the V2 builder derives them from the route key, so V1 was
the odd one out.

Replace the unconditional put with putGreedyPathParam, which:

  - adds the parameter only when the matched resource declares a greedy
    segment;
  - takes the value from the remainder after the literal prefix, so
    /files/{proxy+} matching /files/a/b/c yields "a/b/c" rather than the
    whole request path; and
  - reads the parameter name from the template, since {proxy+} is only the
    conventional spelling and AWS permits any name.

The now-unused JAX-RS capture is dropped from the buildProxyEvent signature
so it cannot leak into the event again.

* fix(apigateway): route greedy resources named other than {proxy+}

AWS does not reserve the greedy path parameter name - "you can use any
string for the greedy path parameter name" - and /parent/{name+} matches
every descendant below that parent.

buildProxyEvent already reads the name from the template, but the REST
router still keyed on the literal {proxy+} in three places: the exclusion
in the template-match arm, the guard in the greedy-match arm, and the
parent-prefix extraction used by both that arm and its specificity sort.

A resource such as /assets/{rest+} therefore only half routed. It fell to
the template arm, where pathMatchesTemplate compares segment counts and
treats {rest+} as an ordinary single-segment wildcard, so /assets/foo
matched while /assets/img/logo.png - the whole point of a greedy resource
- matched nothing at all. A quick manual check passes, which is why the
unit test added with the previous commit stayed green: it calls
buildProxyEvent directly and never exercises routing.

Recognise a greedy segment by its trailing "+" rather than by name, via
greedyParentPrefix, and route on that. Only a terminal greedy segment
counts, matching AWS, where a greedy parameter is allowed solely as the
last segment of a resource path. Specificity is unchanged: exact beats
template beats greedy, and greedy resources still sort by longest parent
prefix.

extractPathParams already generalised on the trailing "+", so it needed no
change. putGreedyPathParam becomes greedyPathParam, returning a map like
its extractPathParams companion and sharing the same terminal-segment
detection instead of scanning for the first greedy part.

Tested through the real request path, per AGENTS.md: the new
ApiGatewayGreedyPathParameterIntegrationTest stands up /assets/{rest+}
with a MOCK integration and drives it over HTTP. Without this change its
multi-segment and deeply-nested cases fail while the single-segment case
passes, reproducing the half-routing exactly. ApiGatewayProxyMatchTest
adds five routing assertions for non-proxy greedy names, four of which
fail without it.

* fix(apigateway): emit the greedy path parameter to mapping templates too

The same rule the previous two commits applied to the Lambda proxy event
was wrong in the two mapping-template paths, in opposite directions.

invokeAwsIntegration built its pathParameters from the JAX-RS capture,
exactly as buildProxyEvent used to, so $input.params('proxy') and a
method.request.path.proxy mapping resolved on every request rather than
only for a greedy resource, and carried the whole request path instead of
the remainder after the prefix.

invokeMock had the opposite gap: it used extractPathParams alone, which
deliberately skips greedy parameters, so $input.params('proxy') was empty
for a greedy resource where AWS supplies the captured remainder.

Both now compose extractPathParams with greedyPathParam, matching
buildProxyEvent, so the three paths agree on what a matched resource
declares. AGENTS.md asks for compatibility to be checked across alternate
protocol paths; these are the alternates for this behaviour.

As with buildProxyEvent, the JAX-RS capture was invokeAwsIntegration's only
use of the proxy argument, so it is dropped from the signature rather than
left available to leak back in.

ApiGatewayGreedyPathParameterIntegrationTest now asserts the captured value
over HTTP and not merely the route: its MOCK response template echoes
$input.params('rest'), so the greedy value must arrive under the name the
template declares. All three assertions fail without this change.
2026-09-12 13:32:20 -04:00
Matheus Oliveira 99c19d03d2 fix(sfn): merge ResultPath at a bracket-index reference path (#3483)
Support [n] bracket-index segments in ResultPath so a path such as
$[1].payload merges into the addressed array element instead of
discarding the array input; an out-of-bounds index raises
States.ResultPathMatchFailure. Also support the single-quoted bracket
field name form ($.abc.['def ghi']) AWS documents for a field name a
dotted segment cannot carry.

* Fix #3479

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 13:22:28 -04:00
Niels Kootstra 1b83ef323e fix(storage): load each backend once and close WAL writers on shutdown (#3469)
* fix(storage): load each backend once and close WAL writers on shutdown

StorageFactory.shutdownAll() ran the final flush after the WAL backends had
been shut down. A WAL flush compacts and reopens the writer, so every WAL
backend was left with an open writer after shutdown. loadAll() also reloaded
backends that create() had already loaded, replaying live stores and opening
a second WAL writer on top of the first.

create() now owns the initial load of a backend, loadAll() only loads
backends that have not been loaded yet, and shutdownAll() flushes before it
shuts the backends down. Memory, persistent and hybrid behavior is unchanged.

* chore: retrigger CI
2026-09-12 13:21:31 -04:00
Niels Kootstra 3bdb019e96 fix(lifecycle): run every shutdown step even when one of them fails (#3472)
EmulatorLifecycle.onStop ran its cleanup steps as one straight sequence. A
RuntimeException from any step skipped everything after it, including the
final storage shutdown, so WAL and hybrid stores were left unflushed and
open whenever a proxy, container or UI manager failed to stop.

Each step now runs in isolation: a failure is logged with its stack trace
and the resource name, the remaining steps still run, and storage shutdown
always runs last. The step order is unchanged.
2026-09-12 13:18:48 -04:00
Aniket Shukla 129ba0a260 fix(codepipeline): populate stage execution status (#3478)
* fix(codepipeline): populate stage execution status

* fix(codepipeline): track stage execution lifecycle
2026-09-12 13:17:42 -04:00
Franklin G. Mendoza ad1061c369 fix(iam): enforce temporary credential lifecycle (#3487) 2026-09-12 13:15:10 -04:00
Niels Kootstra a9feb3ccaf fix(sqs): keep DLQ messages when a move task cannot deliver them (#3470)
* fix(sqs): keep DLQ messages when a move task cannot deliver them

StartMessageMoveTask removed a message from the source queue before knowing
whether it could be delivered. With no DestinationArn, a message without a
recorded original source queue, or whose original source queue was deleted,
was dropped or parked in a queue nobody could receive from, and a delivery
failure lost the message outright.

The move worker now checks that the target queue exists before taking the
head message off the source (under one lock hold), restores the message at
the head when delivery fails so the source keeps its order, and resolves
the target queue by the account in its URL because the worker runs outside
any request scope. Without that, only the first message of a queue owned by
a non-default account was moved.

* fix(sqs): deliver a copy on redrive so a failed move restores the source unchanged

* fix(sqs): roll back the in-memory add when a queue persist fails

* test(sqs): share the failing-store service helper
2026-09-12 13:13:18 -04:00
Franklin G. Mendoza bea8f85f62 fix(lambda): warn before runtime api port exhaustion (#3496) 2026-09-12 13:10:32 -04:00
Aniket Shukla eb622254bc fix(apigateway): allow idempotent custom-id tags (#3430)
* fix(apigateway): allow idempotent custom-id tags

* fix(apigatewayv2): allow idempotent custom-id tags
2026-09-12 13:09:48 -04:00
Matheus Oliveira 4471e92a0f feat(cloudformation): pass EngineMode and StorageEncrypted to RDS clusters (#3482)
AWS::RDS::DBCluster templates set these fields but the provisioner
never read them, so CFN-provisioned clusters kept the defaults.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 11:44:53 -05:00
Priamo Germosen d429d107ff fix(mwaa): apply AirflowConfigurationOptions to the Airflow container (#3457)
CreateEnvironment stored and GetEnvironment echoed back
AirflowConfigurationOptions, but nothing translated it into the
container's actual configuration, so a DAG reading a custom
conf.get("section", "key") value at import time or task-run time got
nothing back, even though GetEnvironment reported the option as
configured.

Added MwaaEnvironmentManager.airflowConfigurationOptionsEnv, which
converts each AWS "section.key" entry into the AIRFLOW__SECTION__KEY
environment variable real Amazon MWAA sets for the same option, and
wired it into startAirflowContainer's env list. A malformed key (no
"section.key" dot on both sides) or one that would collide with a
variable Floci itself manages (PROTECTED_ENV_VARS: the executor,
database connection, security keys) is skipped and logged rather than
silently breaking the environment's required wiring.

Since this map now genuinely does something instead of being inert,
also added the validation CreateEnvironment's botocore model declares
for it (a 1-64 character key matching [a-z]+([a-z0-9._]*[a-z0-9_]+)?,
a 1-65536 character printable-ASCII value) as a server-side
ValidationException: the AWS SDKs enforce this client-side, but Floci
is also reachable via raw HTTP/CLI --cli-input-json, which bypasses
that, and an oversized or malformed entry should be rejected before
Docker container creation rather than passed through.

Fixes #3436
2026-09-12 11:11:23 -05:00
Matheus Oliveira 828b53c5af feat(rds): persist EngineMode and StorageEncrypted on DB clusters (#3448)
CreateDBCluster accepted these fields but DbCluster never stored them,
so DescribeDBClusters always reported defaults and Terraform saw
permanent drift on Aurora-shaped clusters.

* Fix #2559

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 10:42:59 -05:00
Franklin G. Mendoza a985773611 feat(bcm-pricing-calculator): emulate workload estimates (#3441)
* feat(bcm-pricing-calculator): emulate workload estimates

* fix(bcm-pricing-calculator): serialize timestamps as epoch seconds

* fix(bcm-pricing-calculator): align idempotency and errors
2026-09-12 11:31:20 -04:00
Ovidiu 606e7b966f feat(glue): support GetPartitionIndexes (#3416)
Reading a table's partition indexes failed as an unsupported action, which
makes a Glue table unmanageable as infrastructure: the Terraform AWS
provider reads the indexes after creating a table and again on every
refresh, so the create reports an error and every later plan fails on the
same call. The table itself is fine - only the read of its indexes is
missing - so the resource lands in state and then cannot be planned.

Return an empty descriptor list. No index can exist while CreatePartitionIndex
is unsupported, so empty is the accurate answer rather than a placeholder,
and it is the answer a client reading a table's indexes needs. The table is
resolved first so that a missing one is reported as missing rather than as a
table that happens to have no indexes.
2026-09-12 11:27:15 -04:00
Matheus Oliveira 543bde7d5d feat(ecs): scope EFS volume mounts to rootDirectory and accessPointId (#3449)
Fold rootDirectory (or the access point's own root when
accessPointId is set) into the shared EFS named volume's identity,
so different roots on the same fileSystemId no longer collide.

* Fix #2563

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-12 10:58:07 -04:00
Aniket Shukla d11fff3d6d fix(s3): decode unsigned streaming checksum payloads (#3476) 2026-09-12 10:11:34 -04:00
Franklin G. Mendoza daff15da9f fix(cloudhsmv2): tighten backup and tag fidelity (#3443)
* fix(cloudhsmv2): restrict resource policies to backups

* fix(cloudhsmv2): tighten backup and tag fidelity

* fix(cloudhsmv2): serialize tag mutations
2026-09-12 09:24:03 -04:00
XuJianandxujiantop-crypto c6316d10cf fix(lambda): honor DynamoDB stream partial batch failures (#3466)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-12 09:21:02 -04:00
Adrien Poupa ffdd5b8789 fix(scheduler): forward MessageAttributes in universal sqs target (#3435)
* fix(scheduler): forward MessageAttributes in universal sqs target

* fix(scheduler): decode universal SQS binary attributes
2026-09-12 09:02:25 -04:00
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