* fix(ecr): prevent registry request stalls during background garbage col…
fix(ecr): coordinate write admission and enforce exec termination durin…
Resolve race conditions between garbage collection and incoming write operations:
- Enforce container exec termination on await timeout or interruption using kernel-level `timeout -k 2` and process polling via `inspectExecCmd`.
- Keep write admission closed if exec process status is not definitively terminated.
- Implement atomic write admission tokens (`tryAcquireWriteAdmission`) under `writeAdmissionLock` to gate mutating requests (`POST`, `PUT`, `PATCH`, `DELETE`) with HTTP 503 while preserving non-blocking `GET` and `HEAD` requests.
- Decouple GC synchronization using a dedicated `gcLock` and drain active in-flight writes before initiating container exec.
- Add post-startup GC re-check in `EcrRegistryDataPlane.checkTagAndProxy()` prior to upstream proxying.
- Add unit tests `runGarbageCollectTimeoutWithExecStillRunningKeepsAdmissionClosed` and `garbageCollectionDuringStartupRefusesWritesAndPreservesReads`.
Closes#6150
fix(ecr): address review feedback on gc wait, tag claims, and registry…
Address code review feedback on ECR registry data plane and lifecycle management:
- Claim immutable tags prior to Exchange creation in EcrRegistryDataPlane to avoid tag release race on collisions
- Defer write admission release in Exchange.end() until client.close() completes
- Implement deadlock-free two-phase synchronization in EcrRegistryManager.runGarbageCollect() to preserve mutual exclusion with EcrService and storage pruning
- Ensure write admission is reopened if Docker exec start or inspection throws
- Introduce volatile ready flag set after ping and catalog reconcile to gate fast-path probes safely
fix(ecr): extract shared stub registry helper in EcrRegistryDataPlaneTe…
Refactor stub registry helper in EcrRegistryDataPlaneTest.
Closes#6150
* fix(ecr): guarantee poll delay in awaitTermination and add clock test s…
- Decouple Docker exec inspection from polling delay in EcrRegistryManager.awaitTermination into sequential try-catch blocks, guaranteeing a 200 ms pause on every iteration.
- Add Clock and Sleeper test seams with production defaults in EcrRegistryManager while preserving the 8-arg @Inject constructor for CDI.
- Update runGarbageCollectTimeoutWithExecStillRunningKeepsAdmissionClosed in EcrRegistryManagerTest to advance time via ManualClock, eliminating the 3 s real-time wait.
- Sign commit with GPG and remove attribution trailer from PR description.
* feat(redshift): support CopyClusterSnapshot API action (#7748)
* fix(redshift): address review findings and sync docs for CopyClusterSnapshot (#7748)
* refactor(redshift): simplify CopyClusterSnapshot using existing helpers (#7748)
Drop Tags, KmsKeyId and the ARN branch, which CopyClusterSnapshotMessage does not carry.
Reuse validateManualRetention (InvalidRetentionPeriodFault), takenFrom and SnapshotDumpCopier.copy,
and share the automated-snapshot setup across the new tests.
An AWS::EC2::Instance that names a launch template took the template's
image, type, key and metadata options but never its IamInstanceProfile,
so describe-instances showed no profile. When the instance declares no
profile of its own, it now launches with the template's, resolved the
same way RunInstances resolves it. The instance's own profile still wins.
A stack update that moves the instance to a template version naming
another profile, or none, changes or removes the profile in place, and a
dropped LaunchTemplate removes the profile it supplied. A rollback of an
update that changed the profile, whether the instance or its template
declared it, now puts the previous profile back instead of ending
UPDATE_ROLLBACK_FAILED.
Part of #7603
* fix(docker): create a publishing container on its network off Docker Desktop
A container that publishes a host port was created on the default bridge
and connected to its configured network after it started, a workaround
for Docker Desktop, so on any other daemon it stayed on both. Off Docker
Desktop it is now created on its network and joins it alone; Docker
Desktop, and a daemon that cannot be asked, keep the connect after start.
* fix(docker): keep the daemon answer when it cannot be asked, so create and start agree
A failed GET /info fell back to the Docker Desktop path without keeping
that answer. If the daemon answered as Docker Engine by the time the
container started, it was created on the default bridge and never
connected to its network. The first answer, the fallback included, is
now kept.
* fix(ecr): pull rewritten ECR images from an address Docker Desktop reaches
Docker Desktop's daemon runs in a VM and dials localhost there, where a host
port Docker chose for Floci is not bound, so pulls of rewritten ECR images timed
out. On Docker Desktop, rewrite to <account>.dkr.ecr.<region>.localhost:<port>,
which Desktop sends through its host proxy and pulls over plain HTTP.
* fix(ecr): warn when the Docker daemon's operating system cannot be read
The rewrite then falls back to localhost, which Docker Desktop cannot reach, so the later pull timeout needs this cause next to it.
Every request of every service looked its Host up among the distributions
once one existed. For each distribution the lookup built the local delivery
host names and cut a substring out of the stored key. 10 distributions
added about 4 KB to each request.
The lookup now compares the id and the suffix in place and walks the raw
keys of the same account.
* feat(bedrock): list and get foundation models and system-defined inference profiles
fix(bedrock): resolve only ARNs that name the catalog resource in the calling Region, and report on-demand inference only where a model is served in-Region
fix(bedrock): accept SPEECH and VIDEO output modalities and refuse an unserved model with ValidationException
fix(bedrock): report enum violations and read the model catalog through the shared helpers
An invalid ListFoundationModels or ListInferenceProfiles enum value now
answers with the "1 validation error detected:" prefix AWS sends and
lists the allowed values in the model's order.
* fix(bedrock): answer an unresolvable model or profile identifier with the error AWS returns
GetFoundationModel answers an unknown model id or an ARN that names no
foundation model in the calling Region with ValidationException.
GetInferenceProfile answers an ARN of another service or without an
account with ValidationException, and one of another account with
AccessDeniedException; one of another Region stays ResourceNotFoundException.
* fix(dynamodb): check the arguments of PartiQL set_add, set_delete and list_append
* test(dynamodb): cover a list_append with a wrong operand count after the INSERT table name
Adds CreateDBClusterSnapshot, DeleteDBClusterSnapshot, RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime, and makes DescribeDBClusterSnapshots list stored snapshots. A snapshot is a mongodump archive of the cluster's MongoDB container; rds-signed requests naming a DocumentDB cluster or snapshot are routed to DocumentDB.
fix(docdb): round out cluster snapshots and restores after review
List DocumentDB snapshots in the RDS-family list form on either endpoint, accept snapshot ARNs, keep the source's encryption and key on restore, check restore and snapshot identifiers against RDS too, read a point-in-time restore's data as a snapshot does, refuse RestoreToTime, apply every describe filter, and remove a cluster whose restore failed even under deletion protection. Drop the unrelated endpoint host, container-name host and audit log group changes. Cover the archive reaching the restored cluster outside mock mode.
Read a snapshot's record and archive together under the snapshot lock delete takes, and refuse a restore whose archive is missing or empty before any cluster exists; a snapshot taken in mock mode is marked metadata-only and restores only in mock mode. A KmsKeyId on RestoreDBClusterFromSnapshot now encrypts the restored cluster under that key even when the snapshot is unencrypted, as the restore guide allows; the point-in-time restore still refuses one for an unencrypted source. Share the docdb-scoped request in the integration test.
Under IAM enforcement, these tasks are now authorized as the execution role, or as the Credentials role a state names. DynamoDB is checked as a direct request is: batches on each table, transactions by each item's own action, ListTables on its regional collection and statements by what they do. S3 putObject is checked on the object in the bucket's own partition, and a bucket policy can grant or deny. RDS Data needs the action on the cluster and GetSecretValue on the secret. Redshift Data needs what an EventBridge target needs, and its statement operations are checked on any resource.
A request naming nothing it can reach is left to its service. With enforcement off nothing changes.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Every request of every service looked its Host up among the custom
domains. The lookup copied all stored domain keys and cut a substring per
key, and almost no host is a custom domain. 100 domains added about 19 KB
to each request.
A walk over the stored keys now answers a miss first. It copies nothing.
A hit still takes the old path, so the owner, region and conflict rules
stay the same.
A docker cluster ran Hive steps, made its steps' image with Hive and ran
Hive's metastore service on its primary node only when its Applications
named Hive. EMR installs Hive's client and its HCatalog server with
HCatalog too, and the Release Guide's HCatalog page says "HCatalog is a
tool that allows you to access Hive metastore tables within Pig, Spark
SQL, and/or custom MapReduce applications".
- EMR's hive-script, in the emr-scripts package every node has, checks
only "which hive" ("Hive isn't installed." otherwise), and the hive
it finds is hive-client's, which HCatalog installs, so a Hive step
runs on a cluster with HCatalog alone.
- Its HCatalog server, hcatalog-server, is the metastore service:
Hive's hcat_server.sh runs "hive --service metastore".
So a cluster whose Applications name HCatalog installs Hive as one
naming Hive does: its Hive steps run, in the release's image with Hive,
on the metastore service its primary node runs, which its Spark steps'
Hive client uses too.
An emr-spark-* release, the AWS runtime for Apache Spark, includes
neither ("This release includes the following applications:
AmazonCloudWatchAgent, Delta, Hudi, Iceberg, JupyterEnterpriseGateway,
Livy, and Spark."), and has no Hive image to make its steps' image with
Hive from, so a cluster of one installs neither, whatever its
Applications name; one naming Hive asked for that image since #7459.
emr.md now backs a cluster's Spark steps using its metastore with the
Release Guide's EMR pages, in place of the Glue page #7636 quoted:
Spark's default catalog "always connects to a Hive metastore", and
Using HCatalog has Spark SQL read a table the HCat CLI made.
* fix(ec2): retain instance account and region during start
Run container start work in the instance owner account and region, capturing
the caller account for legacy ownerless records. Cover worker scope and
cleanup with the real Quarkus request context and mocked Docker operations.
Adapted from AndreKurait/floci#547 onto the current upstream lifecycle path.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(ec2): inherit the start worker scope when restoring volumes
Let the post-start volume-restoration callback inherit the account and region
established by the lifecycle worker instead of entering another account scope.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
A cluster's Hive steps kept their metastore in an embedded Derby
database in the cluster's /mnt, so only one Hive step at a time could
use it ("Another instance of Derby may have already booted the
database"), and Spark steps, with a catalog of their own, saw a Hive
step's tables only through the Glue Data Catalog. "By default, Hive
records metastore information in a MySQL database on the primary node's
file system", and the Glue Data Catalog is the one to pick "when you
require a persistent Hive metastore or a Hive metastore shared by
different clusters".
- On a cluster whose Applications name Hive, the primary node's
container runs Hive's metastore service on port 9083, once its HDFS
is up: with the image's Hadoop configuration, as Hive steps run, the
cluster's HDFS, its Derby database in the node's own volume, which
only the service opens, and its warehouse in the HDFS. The node is
ready once it listens, and ends if it exits, as for the HDFS daemons.
- It is on the cluster's own Docker network with the HDFS, so only the
cluster's steps reach it. It reaches tables' S3 locations through S3A
on Floci's S3, with a session for the cluster's EC2 instance
profile's role, which goes with the container: at the host's address
when Floci runs on the host, and as floci when Floci runs in a
container, which joins the cluster's network for it, as it joins EC2
VPC networks, and leaves it when the HDFS container goes. A start
that fails, or a container an earlier Floci left, does not keep
Floci there, and one Docker keeps Floci on stays known for the next
teardown.
- It gets the cluster's core-site and hive-site after its own
settings, as EMR's primary node does, so a hive-site warehouse folder
holds for it as for the steps. One an earlier Floci left running
starts again, as its session went with that Floci, and so does one
given Floci's address before Floci could join its network.
- A Floci that crashed is still on that network when it starts again,
and Docker lists it first, so what Floci launched then joined it and
reached the cluster's HDFS and metastore. Floci's own network is no
longer one it made, an EMR cluster's or a VPC's, its earlier owner
label included, or one Docker cannot inspect, unless it is on no
other, and its DNS server takes its address from that network.
- In a namespace the steps share, host or container:<id>, it does not
run: Hive 3.1 has no setting for the address it listens on, so it
would serve every interface of the namespace. Hive steps keep the
embedded Derby database there, as they do with no network.
- Hive steps get its URI in place of the embedded Derby settings, and
Spark steps' Hive client gets it too, so a Spark step reads a Hive
step's tables and makes tables a Hive step reads; a hive-site or
spark-hive-site naming the Glue Data Catalog's client factory still
uses Floci's Glue.
- Two Hive sessions starting at once both upload Hive's exec jar to
the same HDFS folder when it is not there, and one could launch Tez
tasks with a jar that changed under it, so the primary node puts it
there first, under the name Hive gives it.
EmrHiveStepsDockerIntegrationTest runs two Hive steps at once on a
cluster's metastore, and a Spark step that reads a Hive step's table
and makes one the next Hive step reads.
OpenSearch's CreateDomain and the legacy CreateElasticsearchDomain store
the TagList they carry, but the tag-on-create table did not read the
`es` namespace, so under IAM enforcement a caller allowed to create a
domain could tag it with no es:AddTags, and a policy allowing the create
only with some tag did not hold. The reason the generator gave, that no
rule maps its REST routes, has not been true since they were vendored.
`es` moves to the generator's namespaces. The Service Reference lists
OpenSearch Service's operations for the `es` client alone, so, as the
request-resources generator does, an operation of a vendored REST model
it lists for no client is read as the action of its own name: it needs
the tagging actions of the operations the reference lists that action
for, and is checked with the request's tags when that action takes
them. The `opensearch` client's CreateDomain is es:CreateDomain, which
the reference lists for CreateElasticsearchDomain beside es:AddTags, as
the OpenSearch Service developer guide's policy for creating a domain
only with a tag grants es:CreateDomain and es:AddTags. Both creates now
need es:AddTags on the domain they name, and are checked with the tags
as aws:RequestTag/<key> and aws:TagKeys (587 operations over 72
namespaces, no other entry changed).
The handler also read a TagList the model does not allow, and not as the
check reads it: a tag with no value was dropped, though the check lets it
replace an earlier tag of its key, and an object's structures were tags,
though the check lets a member of the same name replace them. Either got
a denied tag past a deny on it. The model requires a list of tags, each
with a Key of 1 to 128 characters and a Value of up to 256, so CreateDomain
and AddTags now refuse anything else with a ValidationException, before
changing anything, and the tags checked are the tags a domain gets.
* fix(dynamodb): refuse a PartiQL function call with the error for its place
* fix(dynamodb): answer a PartiQL statement nested too deep with InternalFailure
Every request whose access key was not 12 digits walked all stored IAM keys to find the owning account. 100 keys added about 17 KB to each request of every service.
A new store lookup does one get per owning account and returns the same entries as the scan. It returns all of them because the same id can be Inactive in one account and Active in another, and it does not migrate legacy entries.
Copy action-list membership under the existing execution monitor before
listing, approval and stage lookups. Reuse the snapshot for action ownership
lookup and stop completion so registration cannot invalidate a traversal.
Cover the four affected request paths with deterministic registration tests.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Resolve SubscriptionRoleArn for SNS subscriptions and update the role without replacing the subscription. Remove the covered CloudFormation property gap.
Validate RawMessageDelivery and FilterPolicy when Subscribe reuses an existing subscription; preserve omitted/default attributes and explicit updates.
Update the stack subscription by its prior physical identity when topic, protocol and endpoint are unchanged. Preserve Subscribe validation for creates and target replacements, reset dropped declared attributes and validate firehose roles before other attribute writes. Cover FilterPolicy and raw delivery updates/removal through CloudFormation and SNS SDKs.
Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(paymentcryptography): the data plane as a service of its own
docs(paymentcryptography): the data plane has a page of its own
fix(paymentcryptography): a MAC under a three-key Triple DES key is computed
test(paymentcryptography): a key of another purpose does not encrypt data
feat(paymentcryptography): the data plane's IAM is generated
fix(paymentcryptography): a DUKPT MAC needs a base derivation key
fix(paymentcryptography): a key whose material is not held is refused
docs(paymentcryptography): the data plane's example runs
test(paymentcryptography): the data plane through the AWS SDK
test(paymentcryptography): the data plane through the AWS CLI
fix(paymentcryptography): the CLI test removes the keys it makes
docs(compat): the AWS CLI suite names the data plane
test(paymentcryptography): the route is read as the registry reads it
test(paymentcryptography): the request names its method and its URI
fix(paymentcryptography): the cipher pads no data
fix(paymentcryptography): the data plane takes the service scope
fix(paymentcryptography): a MAC length that is not a number is refused
docs(paymentcryptography): the data plane says the cipher pads no data
fix(paymentcryptography): the data plane ciphers with Triple DES as well
fix(paymentcryptography): the scope alias names the model's scope
fix(paymentcryptography): the Triple DES cipher is BouncyCastle's
fix(paymentcryptography): the usage and the blob keep their comments
fix(paymentcryptography): a key's family is read from its algorithm
fix(paymentcryptography): the cipher reads the vector through one helper
test(paymentcryptography): the keys are built by one builder
fix(paymentcryptography): the data plane checks the model's rules
fix(paymentcryptography): the Triple DES check value is BouncyCastle's
fix(paymentcryptography): the SDK names it TDES_2_KEY
docs(contributing): the ciphers come from BouncyCastle
refactor(paymentcryptography): the model owns the request shapes
refactor(paymentcryptography): the ciphers are BouncyCastle's
test(compat): one helper makes a key of either algorithm
docs(contributing): the cipher rule comes out
fix(paymentcryptography): the refusals are the model's
refactor(paymentcryptography): the ciphers are one helper each
refactor(paymentcryptography): the generators share the helper
docs(paymentcryptography): the javadocs name both ciphers
test(aws): the moved constants read from the shared helper
fix(paymentcryptography): the deprecated cipher constructors go
chore(paymentcryptography): the duplicate import goes
test(paymentcryptography): the DUKPT vectors the standard publishes
fix(paymentcryptography): the DUKPT refusal is the derivation's
docs(paymentcryptography): the retail MAC is over a double-length key
fix(paymentcryptography): the ISO 9797-1 MAC pads only a partial block
refactor(paymentcryptography): the refusals the model already makes
chore(aws): the routes are generated from the models again
* chore(aws): the IAM resources are generated again
The execute-api host filter parsed the request URI and ran a regular
expression on every request. The response filter created the
request-scoped route context on every response, and that object calls
UUID.randomUUID() when it is created.
The host filter now refuses a host without the regular expression and
returns before it reads anything else. The response filter checks the
path first, so the route context is created only for API Gateway paths.
fix(s3): authorize POST encryption settings and report them
fix(s3): reject incompatible POST encryption fields
fix(s3): normalize POST encryption before authorization
CreateIntegration accepts arn:aws:s3:::bucket with a Serverless namespace or cluster target. The bucket must exist in the integration's Region and have no period in its name, a bucket joins a target once, and a target takes at most 50. The integration reports SourceType s3-event-notifications, starts no poller and publishes no zero-ETL events.
fix(redshift): validate S3 integration source and target identities
fix(redshift): resolve unstored S3 bucket Region in default Region
Fall back to the deployment default Region when an S3 bucket has no stored Region, match bucket partition using RegionResolver.partitionForRegion, and remove the unused two-argument RedshiftZeroEtlEndpoints constructor.
Federated users provisioned via the hosted UI were reported with
UserStatus CONFIRMED. AWS reports EXTERNAL_PROVIDER for users that
sign in with a third-party identity provider.
- Set user status to EXTERNAL_PROVIDER in provisionFederatedUser
- Update test assertion accordingly
Closes#7545
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
fix(cognito): preserve status of linked and permanent-password federated users
Addresses qodo review: provisionFederatedUser no longer overwrites
EXTERNAL_PROVIDER on linked local profiles or federated profiles that
had a permanent password assigned.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
fix(cognito): track auto-provisioned status to preserve linked users on re-sign-in
Use a persisted federatedAutoProvisioned flag instead of overwriting
federatedProviderName, so linked profiles and permanent-password users
keep their status across repeated federated sign-ins.
Addresses pgermosen review.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
test(cognito): add re-sign-in status preservation tests
Covers linked profile re-sign-in and permanent-password profile re-sign-in.
Addresses pgermosen review.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Use an injectable UTC clock for transaction deadlines. Advance the test clock
only after the blocking query starts, then check idle expiry after it finishes.
This removes the one-second wall-clock race without changing runtime TTLs.
test(rds-data): reuse the shared manual clock
Use ManualClock for the transaction concurrency fixture and advance it
through its existing duration-based interface.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
Expose backend keep-alive and idle-pool timeout controls while retaining the existing defaults. Preserve target failures without replaying uncertain requests, and document target timeout hints and local transport limits.
Validate negative idle timeouts with a Floci-specific error before creating clients, and attempt every fixture cleanup step while preserving aggregated failures. Cover negative, zero and positive configuration values and real-listener connection behavior.
Closes#7524
test(elbv2): replace timer-dependent backend checks
With Docker-backed VPC networks, one container of an awsvpc task joins
its VPC's Docker network at the task ENI address, so the address
DescribeTasks reports answers. A Lambda function with VpcConfig joins
the same network at an address leased from its first subnet, skipping
addresses an interface already holds, and returns it once its container
is removed. Peer and Cloud Map addresses still resolve on the network a
container was created on.
Closes#7639
Move the Java sources from io.github.hectorvent.floci to io.floci.aws, matching io.floci.gcp, io.floci.az and io.floci.oci. Generated by tools/rename/rename_package.py apply on the base commit, with no other edits.
Logger categories and the arn.fail-on-blank-region property move to the io.floci.aws prefix. The pom groupId becomes io.floci; the artifactId stays floci.
Refs #6589
Signed-off-by: Hector Ventura <hectorvent@gmail.com>