Commit Graph
318 Commits
Author SHA1 Message Date
Niels Kootstra 1b1252505b fix(sts): validate SAML assertions before assuming roles (#3204)
* fix(sts): validate SAML assertions before assuming roles

* test(sts): use valid SAML fixture in SDK compatibility tests

* fix(sts): address SAML review findings

* fix(sts): align SAML fixtures with verifier

* test(sts): share compatibility XML parser
2026-09-08 07:14:38 -04:00
Franklin G. Mendoza 4944764fa3 feat(inspector2): add organization configuration operations (#3162)
* feat(inspector2): add organization configuration operations

* fix(inspector2): complete organization contracts

* fix(inspector2): scope organization account state

* test(inspector2): log tolerated organization state

* test(inspector2): isolate organization cleanup
2026-09-07 22:54:52 -05:00
TATSUNO “Taz” Yasuhiro cbec02df04 feat(dynamodb): import tables from S3 and report new exports as IN_PROGRESS (#3138)
* feat(dynamodb): import tables from S3 and report new exports as IN_PROGRESS

ExportTableToPointInTime handed its worker the same description object it
returned, so a small export could already read COMPLETED in the initial
response. The worker now mutates a copy and runs under the request account.

ImportTable creates the table in CREATING, loads DynamoDB JSON lines from
every object under the S3 prefix on a virtual thread, and flips the table
to ACTIVE when done. DescribeImport and ListImports report it. DYNAMODB_JSON
with NONE or GZIP compression is accepted. CSV, ION and ZSTD are rejected
with a ValidationException.

* fix(dynamodb): item calls on a CREATING table return ResourceNotFoundException

* fix(dynamodb): concurrent ImportTable calls with one ClientToken share one import

* fix(dynamodb): import reads S3 as the caller and denies another account's bucket
2026-09-07 22:25:24 -05:00
TATSUNO “Taz” Yasuhiro fd21ac9a6d feat(sfn): publish history events for Parallel branches and Map iterations (#3167)
* feat(sfn): publish Parallel branch and Map iteration history events

The states inside a Parallel branch or an inline Map iteration now publish
their events into the execution history.

The cause of a failure the interpreter raises now carries the AWS prefix
"An error occurred while executing the state '<name>' (entered at the event
id #<n>). ". It is written once, at the innermost state.

Every shape was verified against real Step Functions in us-east-1.

* feat(sfn): record EvaluationFailed for JSONata failures

A JSONata expression that fails now leaves the EvaluationFailed event AWS
records, with error, the attributed cause, location and state. The location
names the field the way the cause does. The event is recorded once per
attempt when the state retries, and before the Failed event and the Catch.
A Catch clause whose own expression fails records it from where the state
stood before its first Failed event, then fails the state again.

Verified against real Step Functions in us-east-1

* fix(sfn): record every Distributed Map run so DescribeMapRun resolves its ARN

* fix(sfn): stop counting history events once the execution has ended
2026-09-07 23:18:05 -04:00
Franklin G. Mendoza d99675a512 feat(controlcatalog): add control lookup operations (#3130)
* feat(controlcatalog): add control lookup operations

* fix(controlcatalog): complete control lookup contracts

* test(controlcatalog): verify pagination continuation

* fix(controlcatalog): move control model to package

* fix(controlcatalog): integrate service storage lifecycle
2026-09-07 21:49:39 -05:00
Vũ Thế Huy b9039fef1d feat(redshift-data): emulate the Amazon Redshift Data API (#3186)
* feat(redshift-data): resource resolver, connection factory, statement store, service registration

* feat(redshift-data): field mapper, column metadata, SQL parameter binding

* feat(redshift-data): execute, describe, and paged result retrieval

* feat(redshift-data): batch execution, list statements, cancel

* feat(redshift-data): schema introspection operations

* test(redshift-data): end-to-end Data API over a real cluster plus SDK compatibility test

* docs(redshift-data): document the Redshift Data API surface

* fix(redshift-data): address code review findings

- rejectMultiStatement now reuses the SQL tokenizer so a semicolon inside a
  comment, string literal, or dollar-quoted block no longer rejects a valid
  single statement
- GetStatementResultV2 gains unit coverage for the typed and CSV envelopes
- CSV output is RFC 4180 quoted (embedded comma, quote, CR, LF)
- batch rollback is asserted transactionally in the integration test
- RedshiftDataFieldMapper logs a swallowed blob-read SQLException
- RedshiftPid/RedshiftQueryId use a non-negative hash
- NextToken that decodes to a negative offset is rejected
- CancelStatement leaves a FAILED statement FAILED
- DescribeTable paginates ColumnList and emits NextToken
- DbUser is echoed on the SecretArn path
- the statement store no longer builds its sweeper executor in the test constructor

* fix(redshift-data): address PR #3186 review findings

- SQL scanner handles PostgreSQL escape strings (E'...'): a backslash-escaped
  quote no longer ends the literal and mis-detects a following :name as a bind
  marker; plain '...' literals still treat backslash as an ordinary character
- ListStatements clamps MaxResults to 1..100 so MaxResults=0 no longer emits the
  same NextToken forever
- DescribeTable matches Table / Schema exactly (=) instead of LIKE, so a name
  containing _ or % cannot merge other tables' columns into ColumnList
- register the service in the README category table
- drop a stray em dash from the neighbouring services.yaml comment

* fix(redshift-data): bind string parameters untyped so real PostgreSQL infers the column type

CI ran the integration test against a real Redshift (PostgreSQL 15) cluster and
parameterisedStatement failed: a string bound to an int column via setString
raised "operator does not exist: integer = character varying". H2 in PostgreSQL
mode coerces it, so the unit test missed it.

- RedshiftDataConnectionFactory adds stringtype=unspecified to the JDBC URL, so
  setString sends the value untyped and the server infers the target type,
  matching how AWS binds Redshift Data API parameters
- ListStatements now rejects MaxResults above 100 with ValidationException
  instead of silently clamping (PR #3186 re-review)
- RedshiftDataOperationsTest uses JBoss Logging, not java.util.logging (PR #3186 re-review)

* fix(redshift-data): back the statement store with StorageFactory

The store held a bare ConcurrentHashMap outside the configured storage and
lifecycle model. It now obtains an account-aware backend through StorageFactory
("redshift-data", statements.json), the same as Athena's query store, resolved to
the global storage mode via the catalog descriptor. Default mode stays memory, so
statements are still lost on restart as documented; the 24h TTL sweep now walks
every account partition and deletes per account since the sweep thread has no
request context. StoredStatement is annotated for reflection and field-visible
serialization so persistent modes round-trip it.

* test(redshift-data): cover StoredStatement serialization round-trip and values()

The StorageFactory-backed store serializes StoredStatement in persistent modes.
Adds a round-trip test through the exact mapper PersistentStorage builds,
covering the ArrayNode, enum, Instant, and nested sub-statement fields plus the
field-visibility annotation, and a values() test.

* fix(redshift-data): register the nested Status enum for reflection

PersistedModelReflectionTest walks every type reachable from a StorageFactory
persistence root; StoredStatement.status pointed at an unregistered enum, so
native-image deserialization of a persisted statement would fail on restart.
2026-09-07 20:18:22 -04:00
Danny 5fd89e27bc feat(pipes): validate ParallelizationFactor on Kinesis and DynamoDB sources (#3192)
* feat(pipes): validate ParallelizationFactor on Kinesis and DynamoDB sources

SourceParameters is stored as an opaque JsonNode, so ParallelizationFactor
already round-tripped through CreatePipe, UpdatePipe and DescribePipe with no
bounds applied at all. Apply the AWS constraints in validateSourceConfiguration,
which both the create and update paths already run:

- reject the field on a source its parameter block does not describe, for
  example KinesisStreamParameters.ParallelizationFactor on an SQS source
- require a numeric, then an integral value
- require a value in [1, 10], reported with the offending value

The tiering and message shape follow LambdaService.parseScalingConfig, which
applies the equivalent MaximumConcurrency bounds for SQS event source mappings.

The value is persisted and returned on the wire but not yet enforced: the poller
opens an iterator on a single hardcoded shard and delivers one batch at a time,
so there is no per-shard concurrency to scale. Record that on both iterator
initializers and in an enforcement-status note in the docs, matching how
ScalingConfig documents the same gap for Lambda.

* fix(pipes): reject a ParallelizationFactor wider than an int

asLong hands back the low 64 bits of a BigInteger, so a value such as
2^64 + 5 read as 5 and passed the [1, 10] bounds check: CreatePipe accepted
it over raw HTTP and persisted the original digits. Gate the bounds on
canConvertToInt and report the value with asText, so an oversized literal is
rejected and named in full. Real AWS rejects it too, the field being an int32.

Also correct the docs: ListPipes returns pipe summaries and omits
SourceParameters entirely, so only DescribePipe echoes the factor back.
2026-09-07 18:39:32 -04:00
Franklin G. Mendoza 5864b013d2 feat(detective): add organization member operations (#3190)
* feat(detective): add organization member operations

* fix(detective): align organization operations with AWS

* docs(detective): clarify member listing

* fix(detective): enforce organization administration contracts
2026-09-07 18:31:48 -04:00
luiseterc f9686d5eb2 fix(ec2): add network capacity to instance type responses (#3179)
* fix(ec2): add network capacity to instance type responses

* fix(ec2): correct m8gd.2xlarge network limits
2026-09-07 13:10:32 -04:00
Aniket Shukla b713c4b0d9 fix(kms): support ML-DSA keys (#3047)
* fix(kms): support ML-DSA keys

* test(kms): cover ML-DSA through SDK
2026-09-07 11:57:24 -04:00
Kenshin Okinaka f485122ffc feat(ses): implement v1 ReorderReceiptRuleSet and CloneReceiptRuleSet (#3176)
* feat(ses): implement v1 ReorderReceiptRuleSet and CloneReceiptRuleSet

Completes the SES v1 receipt management surface with the two remaining
rule-set actions, both reproducing wire behavior probed against real AWS
(us-east-1, 2026-09).

ReorderReceiptRuleSet demands an exact permutation of the set's rules,
with the probed error precedence: rule-set existence first, then a
duplicate request name (InvalidParameterValue "Multiple positions found
for rule", even when the duplicated name is not in the set), then set
rules absent from the request (listed in set order), then request names
not in the set (RuleDoesNotExist, first in request order). RuleNames
members validate at the Smithy layer under the bare 'ruleNames' path
with a nested list-member constraint whose length cap is 100; there is
no service-level "Not a valid ruleName" stage, so a 65-char name lands
on RuleDoesNotExist. A failed reorder leaves the order unchanged.

CloneReceiptRuleSet deep-copies the source's rules under a new creation
timestamp; the active flag stays behind. Name validation is two-layer
for both members: the Smithy pattern combines violations with
originalRuleSetName listed first, and the service-level 64-char check
reports the target before the source. An existing target wins over a
missing source (AlreadyExists before RuleSetDoesNotExist).

Covered by unit tests, Query-protocol integration tests, and AWS SDK
compatibility tests run against a live local instance.

* fix(ses): parse ReorderReceiptRuleSet RuleNames with the probed AWS index grammar

Review flagged that a sparse Query list (RuleNames.member.1 plus member.3)
was silently truncated at the first missing index. Probing real SES with
raw signed Query requests showed the string-list grammar differs from the
receipt-action struct-list grammar: a gap is padded with empty members
(which then fail the ruleNames Smithy constraint, so nothing is ever
truncated) up to a skip of 10, counted from the previous index or from 1
for a leading gap; a larger gap is MalformedInput "Excessively sparse
input would skip N list elements" with a comma-grouped count; an index
above 214748369 (exact boundary, found by bisection) is MalformedInput
"Index N is illegal"; index 0, a leading-zero spelling, and a non-numeric
token are each their own probed MalformedInput; and a repeated index
keeps its first value.

The same probing showed the ruleNames Smithy violation carries no member
index and appears at most once however many members are malformed, so the
service now emits it once instead of per member.

Covered by wire-level integration tests for each grammar case and a unit
test for the single-violation behavior.
2026-09-07 11:22:23 -04:00
Franklin G. Mendoza 7a5ae965e5 feat(budgets): add full service emulation (#3165)
* feat(budgets): add budget and notification operations

* feat(budgets): complete service emulation

* fix(budgets): enforce account and action contracts
2026-09-06 23:54:37 -04:00
Kenshin Okinaka 2c6a92c07d feat(ses): implement v1 receipt filters (CreateReceiptFilter, ListReceiptFilters, DeleteReceiptFilter) (#3163)
Adds the three v1 receipt-filter actions as a stored-but-inert IP filter
store alongside the receipt-rule-set domain: filters round-trip through the
management API but never filter an inbound connection, since Floci accepts
none.

Validation follows real AWS as probed: the filter name is a single
service-level layer (no Smithy pattern, unlike rule and rule-set names) with
"Not a valid filterName" for every malformed shape and its own message for
an empty name; IpFilter members are Smithy-enforced (not-null paths and the
[Allow, Block] policy enum); the Cidr member accepts a single IPv4 or IPv6
address or an in-range CIDR block and rejects everything else with
"Invalid CIDR block"; duplicates are AlreadyExists with the original kept;
deletes are idempotent with only an absent FilterName rejected; and the
101st filter in a region is rejected with LimitExceeded "Too many filters".
List responses are name-sorted for determinism since the probe could not
pin the wire ordering.

Covered by unit tests, Query-protocol integration tests, an AWS SDK
compatibility test, and Terraform/OpenTofu compat coverage for
aws_ses_receipt_filter.
2026-09-06 21:00:42 -05:00
Franklin G. Mendoza 6264b09a28 feat(identitystore): add full service emulation (#3159)
* feat(identitystore): add groups users and memberships

* feat(identitystore): add full service emulation

* fix(identitystore): validate update attribute paths
2026-09-06 21:51:19 -04:00
Kenshin OkinakaandPriamo fd665a08cc feat(ses): implement v1 receipt rules with locally validated action targets (#3119)
* feat(ses): implement v1 receipt rules with locally validated action targets

Adds the five v1 receipt-rule actions (CreateReceiptRule, DescribeReceiptRule,
UpdateReceiptRule, DeleteReceiptRule, SetReceiptRulePosition) on top of the
stored-but-inert receipt-rule-set domain. Rules route no mail, but ordering
semantics follow real AWS as probed: a rule created without After is inserted
at the front, SetReceiptRulePosition without After moves a rule to the front,
update replaces the whole rule in place, and rule delete is idempotent while
rule-set delete cascades.

Action targets are validated against the local emulator the way real SES
validates them against the account: any TopicArn must be an existing SNS
topic, an S3 BucketName an existing bucket, a Lambda FunctionArn an existing
function, and a BounceAction Sender a verified identity, using the probed
error codes (InvalidSnsTopic, InvalidS3Configuration, InvalidLambdaFunction,
InvalidParameterValue). Smithy-layer validation reproduces the probed member
paths and combined violation messages; only the members real SES enforces are
required (S3 BucketName, SNS TopicArn, and Stop Scope may be absent).

Covered by unit tests with mocked resource services, Query-protocol
integration tests, an AWS SDK compatibility test, and Terraform/OpenTofu
compat coverage for aws_ses_receipt_rule.

* fix(ses): match probed AWS semantics for action-list gaps and present-struct required members

Probing triggered by the upstream review corrected two earlier conclusions.
A gap in the action list (an empty struct serializes to no Query keys) is
not compacted by AWS: the gap is padded into an empty action slot and
rejected with InvalidParameterValue "Exactly one action type must be
specified for each ReceiptAction", with Smithy paths keeping the wire
index. member.0 is rejected outright with MalformedInput
"0 is not a valid index".

The earlier "optional" verdict for S3Action.BucketName, SNSAction.TopicArn,
and StopAction.Scope was an artifact of empty structs never reaching the
wire: once an action carries any member, the type's required members are
enforced as Smithy violations. BounceAction violations are reported in the
probed smtpReplyCode, sender, message order, and SNSAction reports a bad
Encoding enum before the missing TopicArn.

* fix(ses): honor original receipt-action index spellings and require stop actions last

Probing the leading-zero report pinned AWS's index semantics exactly: index
tokens are grouped by numeric value, ordered by length then lexicographically,
and the i-th token must parse to i, or the padded empty slot is rejected with
the exactly-one-action-type error. member.01 alone is therefore a valid slot 1
whose action must be parsed under its original spelling instead of a rebuilt
canonical one, while mixed spellings such as member.01 plus member.2 are
rejected because the one-digit token sorts first.

The same probes surfaced an unrelated service-level rule now reproduced too:
a stop action anywhere but the last position is rejected with
"Stop action, if any, must be placed at the end of the actions list".

* chore(ses): log best-effort compat-test cleanup failures with resource context

The three cleanup catches in the receipt-rule compatibility suite swallowed
failures silently. They now report the failed step and resource on stderr,
the form the other suites in this module already use, so leaked test
resources stay diagnosable.

* chore(lambda): log functionExists resolution failures at debug level

The catch converts a resolution failure into the predicate's negative
answer; the debug line keeps a surprising false diagnosable (which
reference was rejected, and why) without turning ordinary existence
misses on a query path into log noise.

* fix(ses): restrict receipt-action index tokens to ASCII digits

Character.isDigit also accepts non-ASCII Unicode digits, so a key such as
Rule.Actions.member.<fullwidth 1> parsed as a real index. No AWS Query
index grammar recognizes those spellings; the key is now skipped like any
other unmodeled parameter, pinned by an integration test.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-09-06 18:01:33 -04:00
Vũ Thế Huy 4570bf62c5 feat(redshift): emulate Redshift UNLOAD TO s3 over Simple Query protocol (#3129)
* feat(redshift): parse UNLOAD TO s3 statements

* feat(redshift): add S3Service.authorizeAnonymousPutObject for the UNLOAD writer

* feat(redshift): simulate Redshift UNLOAD TO s3 via CopyOut

* feat(redshift): dispatch UNLOAD via the intercepting bridge

* test(redshift): cover UNLOAD to S3 end to end

* docs(redshift): document UNLOAD to S3 support

* fix(redshift): drain backend on UNLOAD streaming failure and handle final slice error

* refactor(redshift): clean up inline FQCN imports across main and test sources

* fix(redshift): address review feedback on UNLOAD to S3 simulator

* fix(redshift): authorize ListBucket on UNLOAD prefix probe and clean up manifest on backend EOF

* fix(redshift): authorize UNLOAD cleanup deletes and skip them under ALLOWOVERWRITE

* fix(redshift): fail open on UNLOAD MAXFILESIZE above the buffering ceiling

* feat(redshift): repeat the UNLOAD header row at the start of every slice

* test(redshift): cover UNLOAD to S3 over JDBC in the SDK compatibility suite

* docs(redshift): document UNLOAD per-file header, MAXFILESIZE bytes, and over-cap fail-open

* fix(redshift): clean up new UNLOAD slice objects even under ALLOWOVERWRITE

deleteWritten previously bailed entirely when ALLOWOVERWRITE was set, to avoid
destroying a pre-existing object a slice key had overwritten. That also left
genuinely new slice keys behind on a MANIFEST failure, exposing a partial result
with no manifest. Track which slice keys existed before the write and skip only
those on cleanup.

* fix(redshift): never delete UNLOAD output under ALLOWOVERWRITE

The preExistingKeys heuristic could not distinguish an overwrite from a fresh
write atomically: two concurrent UNLOADs to the same prefix could both classify a
key as new, and one operation's cleanup could then delete the other's output.
Drop the heuristic and simply never delete under ALLOWOVERWRITE. Non-overwrite
runs verified the prefix was empty, so their cleanup is still safe. A failed
MANIFEST + ALLOWOVERWRITE UNLOAD may leave data objects without a manifest, which
is now documented.

* fix(redshift): read UNLOAD objects via getObject in the integration test

listObjects returns metadata-only S3Object entries whose getData() is null, so
unloadToS3PrefixWritesRowsAsObjects and unloadGzipWritesCompressedObject threw
NullPointerException in CI. Fetch each body with getObject, as the MANIFEST test
already does.
2026-09-06 15:58:37 -05:00
Franklin G. Mendoza d80734e6de feat(account): add alternate contact operations (#3118)
* feat(account): add alternate contact operations

* fix(account): complete alternate contact contracts
2026-09-06 15:49:12 -05:00
Vũ Thế Huy 7b5c6e272d fix(cloudformation): delete AWS::IAM::User on stack deletion (#3076)
* fix(cloudformation): delete AWS::IAM::User on stack deletion (#2490)

* fix(cloudformation): reconcile IAM user updates and verify user identity

* fix(cloudformation): log intentionally tolerated errors during IAM user deletion

* fix(cloudformation): use context helpers and assert Fn::GetAtt in IAM user provisioner

* test(cloudformation): add AWS SDK compatibility test for IAM user

* test(cloudformation): log tolerated exception during IAM user test cleanup

* test(cloudformation): use Logger for cleanup in IAM user SDK test

* test(cloudformation): use JBoss Logging for cleanup in IAM user SDK test

* fix(cloudformation): address review feedback on IAM user provisioner

---------

Signed-off-by: Vũ Thế Huy <31652864+vuthehuyht@users.noreply.github.com>
2026-09-06 14:13:00 -05:00
Franklin G. Mendoza 41022d09fb feat(cloudformation): support service-managed stacksets (#3055)
* feat(cloudformation): support service-managed stacksets

* fix(cloudformation): restrict service-managed account targeting

* docs(cloudformation): sync resource type table

* fix(cloudformation): align service-managed stackset contracts

* test(cloudformation): isolate stackset organization fixture

* fix(cloudformation): preserve stackset update handling after rebase

* fix(cloudformation): preserve stackset OU deletion targets

* fix(cloudformation): preserve overlapping stackset targets

* fix(cloudformation): reconcile stackset deployment targets
2026-09-06 13:59:54 -05:00
Franklin G. Mendoza aebed6e15c feat(accessanalyzer): add analyzer lifecycle (#3117)
* feat(accessanalyzer): add analyzer lifecycle

* fix(accessanalyzer): complete service contracts

* test(accessanalyzer): make SDK cleanup best effort

* test(accessanalyzer): use project logging for cleanup
2026-09-06 10:55:17 -04:00
Mario Toffia 9b28388d89 fix(acm): report SUCCESS domain validation once a certificate is issued (#3112)
DescribeCertificate returned Status ISSUED together with
DomainValidationOptions[].ValidationStatus PENDING_VALIDATION for every
public certificate, forever. Clients that wait on the validation status
rather than the certificate status never finished: the AWS SDK
CertificateValidated waiter polls only ValidationStatus, and the CDK
DnsValidatedCertificate custom resource uses that waiter, so its stack
waited for the Lambda's timeout and rolled back.

The validation status now follows issuance: SUCCESS on an ISSUED
certificate, PENDING_VALIDATION while the configured validation wait is
running. A pending certificate is issued, with its validations marked
SUCCESS and the change stored, on the first read after
validation-wait-seconds has passed; before this the documented transition
never happened.
2026-09-06 10:48:30 -04:00
Mario Toffia c67e598594 feat(iot): real device certificates issued by the local CA (#3079)
* feat(iot): CreateKeysAndCertificate issues a real client certificate from the local CA

certificateId is sha256(DER) in lowercase hex as on AWS; the returned RSA 2048
key pair matches the certificate. CreateCertificateFromCsr parses the PKCS#10,
checks its self-signature and key strength (RSA 2048 or more, EC P-256/384/521),
signs the CSR's key with the same CA and returns no private key, as on AWS.

* docs(iot): describe the CA-issued device certificates

* fix(iot): accept only the NIST curves AWS IoT names and never store a device private key

The CSR key check reads the named-curve identifier instead of the field size,
so secp256k1 and explicit curve parameters are refused as on AWS. The stored
certificate record no longer carries the private key; it is returned once.

* feat(iot): device certificates expire at the end of 2049 and DescribeCertificate reports validity

AWS IoT-issued client certificates all carry notAfter 2049-12-31T23:59:59Z.
CertificateGenerator gains an overload with an explicit validity window;
DescribeCertificate adds validity.notBefore, validity.notAfter and
certificateMode DEFAULT. The Java SDK compatibility test asserts the shape.

* fix(iot): a device certificate never outlives its issuing CA

A new local CA is valid until the end of 2050, past AWS's fixed 2049 device
expiry; a CA created earlier (ten years) caps the device certificates it signs
at its own expiry, so a chain never expires before its leaf.

* fix(iot): derive CA and device expiry from creation time, never mint an expired certificate

A CA created after 2050 lives ten years from creation instead of ending on
the fixed date; after 2049 a device certificate lives a year, still capped
at its CA. The Python compatibility suite now sends a real PKCS#10 request,
since the placeholder it used is refused as on AWS.

* docs(tls): the local CA now signs IoT device certificates

* test(iot): pass the certificate authority to IotServiceTest's constructor
2026-09-06 10:39:57 -04:00
Franklin G. Mendoza 162211de0c feat(route53): support cross-account VPC associations (#3116)
* feat(route53): support cross-account VPC associations

* test(route53): add SDK cross-account compatibility coverage

* fix(route53): harden cross-account VPC ownership

* fix(ec2): scope default resources by account
2026-09-06 00:05:31 -04:00
Franklin G. Mendoza 3927c66040 feat(macie2): add organization administration operations (#3105)
* feat(macie2): add organization administration operations

* test(macie2): validate organization administration with sdk

* fix(macie2): harden delegated administration routing
2026-09-05 23:49:52 -04:00
Vũ Thế Huy 025ac714f6 fix(redshift): emit ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus (#3109)
DescribeClusters (and every other cluster response, since they share
buildClusterXml) omitted two fields the Terraform AWS provider requires:
ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus. The
create waiter polled an empty ClusterAvailabilityStatus ("unexpected
state '', wanted target 'Available'") and import/read rejected the empty
AvailabilityZoneRelocationStatus.

ClusterAvailabilityStatus is derived from clusterStatus: available maps
to Available, unavailable to Unavailable, failed to Failed, and every
transient state to Modifying. Floci has no availability-zone relocation
feature, so AvailabilityZoneRelocationStatus is the constant "disabled".

Closes #3098
2026-09-05 22:27:00 -04:00
Mario Toffia 67bbd2cf13 feat: serve custom domains over TLS as soon as they are created (#3086)
* feat(tls): record runtime-learned hostnames in the certificate metadata

* feat(tls): TlsCertificateManager.ensureHost grows the server certificate at runtime

Reissues the leaf from the local CA with the same key pair and the new SAN,
replaces certificate and metadata by atomic renames (the key file is never
rewritten), reloads the default TLS configuration and fires
CertificateUpdatedEvent so the HTTPS listener swaps immediately.
Names must be well-formed host names under a local suffix; anything else is
refused with a WARN and never throws.

* feat(tls): keep runtime-learned hostnames across a boot regeneration

* test(tls): ensureHost is visible to the next TLS handshake without a restart

* docs(tls): custom domains learned at runtime

* test(tls): pin the certificate contracts of a runtime reissue

The reissued leaf keeps the boot leaf's shape (subject, issuer, EKU, CA flag,
validity, new serial, configured names first), a wildcard covers exactly one
label, an IP allowed by the base URL becomes an iPAddress SAN, and a client
that verifies the server's identity for the new name (SNI plus RFC 6125
matching) fails before ensureHost, succeeds after it, and fails again after
reset, while the configured name keeps serving HTTPS throughout.

* fix(tls): retry a failed listener reload and keep served names across a boot

A name is known only once the HTTPS listener serves it: a reload that
returns false, a missing default TLS configuration or a failing listener
now leaves the in-memory state untouched, so the next ensureHost call for
that name writes and reloads again instead of reporting it as covered.

At boot, a SAN the served certificate carries beyond the metadata's
configured list is treated as learned, so a reissue whose metadata rename
did not complete cannot lose the name in a later regeneration.

The allow-list is checked after coverage, so a default SAN such as
host.docker.internal no longer logs a refusal on a no-op call.

Tests are split by concern: TlsCertificateManagerTest (reissue, reload,
reset, failure, races) and TlsCertificateManagerNameRulesTest over a
shared fixture; TlsConfigSourceLearnedHostnamesTest holds the boot paths.

* fix(tls): carry a name whose reload failed into later reissues and resets

The learned list now follows the files and the known set follows the
listener. A name written to disk but not yet served is kept by every
later reissue instead of being dropped when a second name is learned,
and a reset whose reload failed is retried by the next reset.

Two pre-existing em dashes in TlsConfigSource log messages replaced with
commas, as AGENTS.md asks.

* feat(acm): issue AMAZON_ISSUED and PRIVATE certificates from the local CA

RequestCertificate now returns a TLS server leaf (serverAuth and clientAuth)
signed by Floci's local root CA, and CertificateChain is that CA's PEM, the
same bytes GET /_floci/ca.pem serves. Certificate plus CertificateChain from
GetCertificate therefore build a chain that validates, as they do on AWS, for
both certificate types, and ExportCertificate returns the same chain. The
requested KeyAlgorithm is still honoured and DescribeCertificate reports the
CA as the issuer.

The bundled amazon-root-ca.pem and its startup check are gone: nothing Floci
issues chained to it, and the file was corrupt (its base64 payload could not
decode), so every GetCertificate handed out an unparsable chain.

AcmPaginationTest walks a store shared with every other ACM test class; its
page cap now leaves room for the suite to grow instead of failing once the
shared store passes fifty certificates.

* refactor(acm): drop the cosmetic Amazon issuer generator

CertificateGenerator.generateCertificate signed a leaf with its own key under a
CN=Amazon issuer DN that no client could ever verify. Its last production caller
now issues from the local CA, so the method and the DN are gone and the
self-signed builder no longer carries an issuer and CA flag that were always the
subject and true. Tests that only needed some certificate use the self-signed
generator; the ones that need a leaf that is not a CA issue it from a throwaway
CA.

* docs(acm): certificates chain to the local CA

Say that every issued certificate is signed by the local root CA, that
GetCertificate returns that CA as CertificateChain, and that trusting
/_floci/ca.pem once validates both the HTTPS endpoint and ACM certificates.

* test(acm): the SDK compatibility suite validates the certificate against its chain

GetCertificate's certificateChain() must contain the issuing CA and that CA
must verify certificate(), as on AWS. A chain that does not parse or does not
sign the leaf now fails the suite instead of passing a BEGIN CERTIFICATE check.

* docs(acm): say when the CA is created and what Issuer reports

ACM issuance now creates the local CA under {persistent-path}/tls/ on first
use, also with TLS off and in memory storage mode, and DescribeCertificate
reports the CA's name as Issuer where AWS reports Amazon. The CA javadoc no
longer calls ACM a later step.

* test(acm): pin key size, an imported chain and the persisted chain

The import fixture is now a server certificate from a throwaway CA, uploaded
with that CA as its chain, and GetCertificate must hand both back unchanged.
The RSA and EC chain tests also check the key size and curve, and the
persistence test checks the chain survives a restart.

* test(acm): the python compatibility suite verifies the certificate against its chain

The key-algorithm case checked the certificate's self-signature, which only
held while ACM certificates were signed by their own key under a cosmetic
issuer. On AWS, and now here, the signer is the issuing CA that GetCertificate
returns first in CertificateChain, so the case verifies that signature and the
issuer name instead.

* fix(acm): write EC private keys as PKCS#8 and classify keys by interface

JcaPEMWriter turned a JDK EC private key into a bare SEC1 structure with
no curve and no public half, which neither OpenSSL nor parsePrivateKey
could read, so every EC certificate stored an unusable key and
ExportCertificate on one failed. EC keys now go out as PKCS#8, RSA keys
stay PKCS#1 as AWS IoT hands them out, and a SEC1 key without a public
half parses through its private-key info.

Private keys are told apart by the ECKey interface rather than by name:
a BouncyCastle provider, when one is registered, names an EC key ECDSA.

* test(acm): AcmServiceTest pins issuance from the local CA

Service level, no Quarkus: every KeyAlgorithm yields a leaf of that key
signed by the CA with the CA PEM as chain and metadata read from the
certificate; PRIVATE is issued at once; a pending certificate already
holds its leaf and chain; an idempotent replay mints nothing; imports
keep their own chain; exports return the stored chain, also for EC
keys; sixteen concurrent requests each get their own valid certificate.

* feat(apigateway): serve a custom domain over TLS as soon as it is created

CreateDomainName hands the domain name to TlsCertificateManager.ensureHost
after the domain is stored, outside the uniqueness lock. The certificate
manager never throws, so the API response is unchanged.

* feat(iot): serve a customer-managed domain over TLS as soon as it is configured

CreateDomainConfiguration hands a customer-managed domain name to
TlsCertificateManager.ensureHost after the configuration is stored. A
configuration without a domain name describes the default endpoint and
registers nothing.

* feat(cognito): serve a custom domain over TLS as soon as it is created

CreateUserPoolDomain hands a custom domain to TlsCertificateManager.ensureHost
after the domain is stored. A prefix domain lives under amazoncognito.com on
AWS, a name Floci does not serve, and is left alone.

* docs: custom domains are served over TLS on creation

One sentence each in the API Gateway, IoT Core and Cognito pages, and the
TLS page now names the operations that add hostnames to the server
certificate.

* test(compat): custom domain reachable over TLS trusting only the ACM chain

RequestCertificate, CreateDomainName with regionalCertificateArn, then a TLS
handshake with SNI that trusts only the returned CertificateChain and
verifies the hostname. Probes for TLS on the endpoint host and port, because
the workflow hands the tests an http:// URL while Floci serves both, and
skips when the probe fails.

* docs(tls): say which ensureHost outcomes are logged as warnings

* test: pin the custom domain TLS hooks against the service contracts

Service tests for API Gateway, IoT Core and Cognito: the exact name is
handed over once, after the record is stored, with no service lock held
(a concurrent create must not wait for the TLS reload), and never for a
rejected request, an ENDPOINT configuration, an AWS-managed configuration,
a prefix domain or a later update or delete. A CloudFormation stack with
the three types registers every domain and a replacement, not an in-place
update or the delete. With TLS on, a client trusting only the ACM chain
reaches all three names by SNI with hostname verification, and a reset
takes them back.

* test(acm): build the InUseBy test service with the local CA

AcmInUseByTest landed on main with #3035 using the constructor that
predates the local CA; AcmService now takes the certificate authority
it issues from, so the test loads a throwaway CA in its temp directory
like AcmServiceTest does.

* test(cognito): request an issued ACM certificate in the custom domain TLS tests

Since #3035 a custom domain needs an issued ACM certificate, so the wire
test requests one and the service test stubs AcmService. Two new cases pin
that a certificate ACM does not know, or has not issued, is refused before
the hostname is registered.

* test(cognito): a concurrent create does not wait for the TLS reload

The custom domain hook sits after the domain lock #3095 introduced, so a
second create is not queued behind the HTTPS listener switch; pinned the
same way as for API Gateway and IoT Core. The routing test #3095 added
constructs the service with the certificate manager as well.
2026-09-05 22:05:40 -04:00
Franklin G. Mendoza 1bf7494e99 feat(ssoadmin): add permission sets and assignments (#3103)
* feat(ssoadmin): add permission sets and assignments

* test(ssoadmin): validate account assignments with sdk

* fix(ssoadmin): complete pagination and lifecycle contracts
2026-09-05 21:46:20 -04:00
Franklin G. Mendoza 6a728f1b9f feat(cloudwatchlogs): add cross-account policy operations (#3089)
* feat(cloudwatchlogs): add cross-account policy operations

* fix(cloudwatchlogs): align cross-account policy contracts

* fix(cloudwatchlogs): enforce account policy quotas

* fix(cloudwatchlogs): validate field index policy scopes

* fix(cloudwatchlogs): parse field index criteria safely

* fix(cloudwatchlogs): align field index quota parsing
2026-09-05 21:08:07 -04:00
Mario Toffia 615056999e feat(acm): map CertificateExport and CertificateTransparencyLoggingPreference onto the certificate options (#3111)
The AWS::CertificateManager::Certificate provisioner accepted both properties
and ignored them, so every certificate a stack created carried the ACM
defaults. Both now become the certificate's Options, with the CloudFormation
defaults (export DISABLED, transparency logging ENABLED) when absent, and a
value other than ENABLED or DISABLED fails the resource before any ACM call.

Updates follow the registry schema: CertificateExport is createOnly, so a
change replaces the certificate through the existing delete-or-unwind path,
while a changed CertificateTransparencyLoggingPreference calls
UpdateCertificateOptions on the existing certificate and keeps its ARN.
Export is never sent to UpdateCertificateOptions, since ACM does not allow
changing it once the certificate exists.

CertificateAuthorityArn stays ignored; private CA is not emulated.
2026-09-05 18:42:39 -05:00
Niels Kootstra 8686651de1 fix(appconfigdata): honor requested poll interval (#3092) 2026-09-05 15:53:16 -04:00
Scott Steen 0471d6f488 feat(bedrock-runtime): stream ConverseStream incrementally (#3043)
ConverseStream previously buffered the whole proxied response, translated it in
one shot, and returned it as a single byte[]. Both backends now write frames
through a JAX-RS StreamingOutput as they're known, and the proxy backend reads
the upstream SSE response via HttpResponse.BodyHandlers.ofLines() instead of
ofString() - text deltas reach SDK clients as the model generates them instead
of landing all at once when the response finishes.

Once the StreamingOutput starts writing, JAX-RS has already committed the 200
response, so a failure discovered only after streaming begins - a stream that
never reaches a finish_reason or "[DONE]" (upstream connection dropped
mid-generation) - can no longer become an HTTP error status. It's now reported
as a modelStreamErrorException event, the same wire shape (:message-type:
exception, :exception-type: <name>) and modeled exception real Bedrock uses
for a mid-stream failure, verified to decode correctly through
BedrockRuntimeAsyncClient's generated ConverseStreamResponseHandler. A stream
that completes normally (finish_reason or "[DONE]" seen) with no content is
now treated as a legitimate empty completion rather than an error, matching
real Bedrock.

Added a compatibility-tests/sdk-test-java case exercising
BedrockRuntimeAsyncClient.converseStream end to end, proving the emitted
event-stream frames decode correctly through the real AWS SDK rather than
only Floci's own byte-level assertions.
2026-09-05 15:17:39 -04:00
Mihai BlidaruandMihai Blidaru 724be0a6a7 fix(s3): return composite multipart checksums and match S3 on UploadPart, GetObjectAttributes and CopyObject responses (#3093)
* fix(s3): return composite checksums for multipart uploads

CompleteMultipartUpload stored the checksum of the whole object but labelled
it COMPOSITE, so clients that recompute the composite value from the part
checksums, as the AWS documentation describes, never matched it.

Follow the AWS checksum type rules, verified against real S3:

- SHA1/SHA256 are always COMPOSITE, CRC32/CRC32C default to COMPOSITE and
  CRC64NVME is always FULL_OBJECT. x-amz-checksum-type on CreateMultipartUpload
  selects FULL_OBJECT for CRC32/CRC32C; incompatible combinations fail with
  InvalidRequest, and the response echoes x-amz-checksum-algorithm/-type.
- The composite value is the algorithm applied to the concatenated binary part
  checksums, Base64 encoded, with a "-<part count>" suffix. It is returned by
  CompleteMultipartUpload, HeadObject and GetObject (with x-amz-checksum-type),
  while GetObjectAttributes omits the suffix, as AWS does.
- A checksum sent on CompleteMultipartUpload is validated against the stored
  type: a mismatching value is a BadDigest (the composite is accepted with or
  without its suffix), a checksum type different from the one the upload was
  created with is an InvalidRequest, per-part checksums in the request body
  that do not match the uploaded parts are an InvalidPart, and a COMPOSITE
  upload completed without the checksum of every part is an InvalidRequest
  (FULL_OBJECT uploads need none, as on S3). A non-numeric
  PartNumber is a MalformedXML instead of a 500.
- UploadPart echoes the part checksum (x-amz-checksum-<algorithm>) when the
  upload declared an algorithm, as S3 does; without one no header is returned.
- CopyObject writes a single object without a part manifest; a composite source
  gets a full-object checksum recomputed with its algorithm, and CopyObjectResult
  carries the checksum elements, matching AWS.
- GetObjectAttributes lists part-level checksums only for COMPOSITE objects: a
  FULL_OBJECT multipart object reports its PartsCount alone and a single-part
  object has no ObjectParts element.

The algorithm and type rules live in two new enums, ChecksumAlgorithm and
ChecksumType, parsed once from the request headers; S3Checksum builds the
full-object, composite and GetObjectAttributes views of a checksum.

The boto3 compatibility suite gains multipart upload_file cases for SHA256 and
for the SDK's default CRC32, asserting the composite value and the part list.

The S3 docs drop the stale note that checksum responses focus on SHA-1 and
SHA-256 (CRC32, CRC32C and CRC64NVME have been supported since #877) and list
the AWS algorithms Floci rejects.

* fix(s3): return the GetObjectAttributes ETag without quotes

S3 returns the ETag element of GetObjectAttributes without the surrounding
quotes that HeadObject, ListParts and CompleteMultipartUpload keep. Verified
against real S3 with the same object: head_object gives "af3c...-3" while
get_object_attributes gives af3c...-3, and the AWS CLI reference shows the same
in its get-object-attributes example. Floci echoed the quoted value, so a client
comparing both saw different strings on Floci and equal ones nowhere.

* fix(s3): give a copied object its own ETag

CopyObject kept the ETag of the source, so the copy of a multipart object
carried the "<md5-of-md5s>-N" value of its parts. S3 writes a copy as a single
object and returns the MD5 of the whole content as its ETag, in CopyObjectResult
and HeadObject alike (verified against real S3: source "af3c...-3", copy
"a5f04f..."). The copy now keeps the ETag storeObject computes.

* fix(s3): send CopyObjectResult as application/xml

The CopyObject response carried Content-Type: text/plain;charset=UTF-8 for an
XML body. S3 labels it application/xml like every other XML response.

* test(s3): cover multipart checksums in every SDK compatibility suite

Each SDK implements flexible checksums differently, so the multipart flows are
exercised per client rather than once: the Go transfer manager (what
terraform-provider-aws uses), @aws-sdk/lib-storage for Node, the Java SDK v2 both
low-level and through S3TransferManager on the multipart-enabled async client, the
AWS CLI (s3api, aws s3 cp --checksum-algorithm and a plain aws s3 cp that goes
multipart on its own) and boto3. Every case asserts the composite or full-object value computed in the
test itself, the UploadPart echo, the suffix-less GetObjectAttributes checksum
and unquoted ETag, the rejected Complete without part checksums, and the copy
of a multipart object as a single full object with its own ETag. The default
algorithm cases accept whatever the SDK version declares (CRC32 composite or
full object, or none) and check the stored value against it.

* test(terraform): upload a large aws_s3_object with Terraform and OpenTofu

The IaC suites created buckets but never an object, so the code path that
surfaced the composite checksum bug, an aws_s3_object above the provider's part
size uploaded through the SDK transfer manager, was not covered. Both suites now
upload a 12 MiB file generated by the test setup with checksum_algorithm SHA256
and check that HeadObject reports a COMPOSITE checksum equal to the composite
computed locally over the part sizes GetObjectAttributes lists, that the state
attribute holds the same value, and that re-planning the object shows no drift.

compat-opentofu moves to the same aws-cli image as compat-terraform (2.34.32):
2.15 predates the S3 checksum type and cannot show ChecksumType in its output.

* fix(s3): reject x-amz-checksum-type without a checksum algorithm

CreateMultipartUpload only parsed x-amz-checksum-type when an algorithm was
declared, so a type sent on its own, valid or not, was silently ignored. S3
validates the header regardless: an unknown value is InvalidRequest "Value for
x-amz-checksum-type header is invalid." and a valid one without an algorithm is
InvalidRequest "The x-amz-checksum-type header can only be used with the
x-amz-checksum-algorithm header." (both verified against real S3).

* test(s3): log cleanup failures in the multipart checksum compat tests

The Java, Node and Go cases swallowed errors while deleting their objects and
bucket. They now report what could not be deleted and why, so a leftover is
diagnosable instead of silent.

---------

Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com>
2026-09-05 15:12:13 -04:00
Matheus Oliveira 37faaa8abe feat(kms): support ImportKeyMaterial for Origin=EXTERNAL keys (#3068)
CreateKey accepts Origin=EXTERNAL, GetParametersForImport issues a real RSA
wrapping key, and ImportKeyMaterial unwraps and installs the material.
Expiry and DeleteImportedKeyMaterial return the key to PendingImport.

Fixes #1916

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-05 14:00:44 -04:00
Vũ Thế Huy 0ab9979edf fix(athena): register every Glue database as a DuckDB schema so <db>.<table> resolves (#2993)
* feat(athena): extract GlueViewDdlBuilder with schema qualification and aliases

* feat(athena): wire GlueViewDdlBuilder into AthenaService

* docs(athena): document Glue database schema registration and aliases

* fix(athena): propagate getDatabases failure and harden DDL table quoting

* fix(athena): skip Glue tables with nonexistent S3 bucket and cleanup AthenaTest

* fix(athena): avoid redundant table fetch and add qualified query compatibility test

* fix(athena): do not skip views for tables with nonexistent S3 bucket
2026-09-05 11:19:46 -04:00
TATSUNO “Taz” Yasuhiro e5afe3518b fix(kms): apply real RSAES-OAEP for RSA keys in Encrypt and Decrypt (#3038)
* fix(kms): apply real RSAES-OAEP for RSA keys in Encrypt and Decrypt

Encrypt on an RSA key now produces raw RSA-OAEP ciphertext of the
modulus length. Decrypt accepts a ciphertext made locally with the
public key from GetPublicKey, so the normal envelope pattern works.
Encrypt, Decrypt, and ReEncrypt read the EncryptionAlgorithm request
fields and return them in responses.

Validate plaintext length between 1 and 4096 bytes on every encrypt
path. Turn a malformed blob payload into InvalidCiphertextException
instead of a 500. GenerateDataKey now names itself in key usage
errors and rejects non symmetric keys like real AWS.

Error codes and messages for algorithm mismatch, wrong key usage,
missing KeyId, encryption context on asymmetric keys, and oversized
plaintext were measured against real AWS KMS in us-east-1 and match.

Fixes #3024

* test(kms): rename a GenerateDataKey test to state the thrown exception
2026-09-04 11:21:25 -04:00
David c48b6b0b0a fix(lambda): do not publish a version when nothing has changed (#2941)
"AWS Lambda doesn't publish a version if the function's configuration and
code haven't changed since the last version." Publishing was unconditional,
so repeated publishes accumulated identical versions.

Unchanged is decided by $LATEST's revisionId, which is regenerated on every
code and configuration update, so a version records the revision it was cut
from and a later publish that finds it unmoved returns that version. Keying
on the revision rather than comparing the fields a snapshot copies means a
field added later is covered without anyone remembering to update a
comparison. Versions published before this carry no source revision and never
match, so existing state keeps its previous behaviour.

Three carve-outs, each with a test:

Description is supplied at publish time rather than carried on $LATEST, so a
publish naming a new one is a real publish even when nothing else moved.
LambdaVersionIntegrationTest already asserted that and decides the case.

Only the most recent version counts, because AWS compares against the last
version: a description going A then B then A must publish again rather than
matching the older A.

A hot-reload function's code lives in a bind-mounted directory that changes
with no API call, so revisionId cannot witness it and these always publish.

Two existing tests change, because the behaviour they assert is the one this
fixes. LambdaServicePersistenceTest reached version 3 by publishing three
times with nothing changed; its subject is the counter surviving a restart,
so it now varies the description. CodeDeployTest published identical bytes
twice to get two versions for a blue/green shift; it now deploys a real
change between them, which is what a blue/green deployment does anyway.

Closes #2822
2026-09-04 10:33:59 -04:00
luiseterc 1f87f7c482 feat(ec2): implement instant CreateFleet (#2956)
* feat(ec2): implement instant CreateFleet

* fix(ec2): address CreateFleet review feedback

* fix(ec2): harden CreateFleet placement rollback

* test(ec2): isolate CreateFleet dry-run fixture

* fix(ec2): group CreateFleet response instances

* fix(ec2): report incomplete fleet rollback

* fix(ec2): resolve fleet placement from subnet overrides
2026-09-04 10:06:44 -04:00
Kurt McAlpineandkurtmc a7be2dd299 feat(neptune): support the Terraform aws_neptune_cluster read-back contract (#3017)
* feat(neptune): support the Terraform aws_neptune_cluster read-back contract

The Terraform AWS provider's aws_neptune_cluster resource reads back every
DBCluster field after create and update, and treats a mismatch on a ForceNew
attribute as a replacement. Against Floci the resource could not converge:
StorageEncrypted was hardcoded to true against the provider's default of
false, AvailabilityZones was emitted as a singular element that SDK parsers
drop, BackupRetentionPeriod and the other settings were never stored, and
tag calls on a Neptune ARN never reached the Neptune store.

CreateDBCluster and ModifyDBCluster now store the settings a request carries
(NeptuneClusterSettings, modelled on DocDbClusterSettings) and
DescribeDBClusters reads them back with the AWS defaults otherwise:
AvailabilityZones, BackupRetentionPeriod, PreferredBackupWindow,
PreferredMaintenanceWindow, DBSubnetGroup, DBClusterParameterGroup,
VpcSecurityGroups, StorageEncrypted, KmsKeyId, StorageType,
DeletionProtection, CopyTagsToSnapshot, EnabledCloudwatchLogsExports,
ReplicationSourceIdentifier, ServerlessV2ScalingConfiguration,
AssociatedRoles and ClusterCreateTime. StorageEncrypted defaults to false
as on AWS.

Also:
- A requested Port is honoured when it is free inside the proxy range, so
  Terraform's default port of 8182 matches the first cluster.
- DeleteDBCluster refuses a cluster with DeletionProtection enabled with
  InvalidParameterCombination, as on AWS.
- DBClusterMembers uses the DBClusterMember element the Neptune API model
  declares; the previous member element was dropped by SDK parsers.
- New actions: AddRoleToDBCluster, RemoveRoleFromDBCluster,
  DescribeGlobalClusters (empty list), ListTagsForResource,
  AddTagsToResource and RemoveTagsFromResource. Tags are accepted on
  CreateDBCluster and CreateDBInstance, and the rds credential scope routes
  a Neptune ARN ResourceName to the Neptune handler.

Verified against hashicorp/aws 6.62.0 with terraform apply, a clean
re-plan, an update covering retention, protection, log exports, security
groups, iam_roles and tags, a destroy blocked by deletion protection, and a
destroy after disabling it.

* test(compat): cover aws_neptune_cluster in the Terraform and Java SDK suites

Adds a dedicated Terraform fixture and bats test that applies an
aws_neptune_cluster, checks the read-back through terraform output and the
AWS CLI, checks tags through ListTagsForResource, and asserts a clean
re-plan. Extends the Java SDK NeptuneTest with tags, IAM roles, modify
settings, deletion protection and cluster members, so a real SDK parser
covers the new DBCluster fields.

* fix(neptune): infer the rds service for the DBCluster role actions

Unsigned Query requests resolve their service from the action name, and
AddRoleToDBCluster and RemoveRoleFromDBCluster were missing from the RDS
action set, so they fell through to the SQS default instead of reaching
the Neptune handler.

* feat(neptune): read back the settings Terraform's aws_neptune_cluster_instance manages

DescribeDBInstances omitted AutoMinorVersionUpgrade, PromotionTier,
PubliclyAccessible, the parameter and subnet groups and the windows,
ModifyDBInstance ignored them, StorageEncrypted was hardcoded to true,
and every cluster member was reported as the writer, so the provider
issued a ModifyDBInstance on every apply.

NeptuneInstanceSettings, modelled on NeptuneClusterSettings, stores what
a request carries and DescribeDBInstances reads it back with the AWS
defaults otherwise; StorageEncrypted, KmsKeyId and StorageType are the
cluster's. The first member of a cluster is its writer and deleting it
promotes the next. Covered by unit, integration and Java SDK tests and a
Terraform compat fixture with a writer and a reader instance.

---------

Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
2026-09-04 09:45:29 -04:00
Kévin Dehoux 84ec8ae8e7 feat(dynamodb): index-qualified PartiQL SELECT with ConsistentRead validation (#2953)
* feat(dynamodb): index-qualified PartiQL SELECT with ConsistentRead validation

ExecuteStatement parsed FROM "Table" only — a dot aborted the lexer
with 'Unexpected character', so PartiQL could not read through a
secondary index at all. Lex the qualifier, resolve it to an access
path, and route the read the way AWS does (characterised on real AWS,
eu-west-1, 2026-09-02):

- equality on the selected source's partition key queries it; any
  other WHERE shape becomes a full scan of the table or index with the
  remaining conditions as a filter
- ConsistentRead on a GSI-qualified statement is rejected with
  'Strongly consistent read is not supported on Global Secondary
  Indexes' — PartiQL's own wording, distinct from Query/Scan
- an unknown index omits the index name from the message, again
  unlike Query/Scan; index resolution also precedes the consistent-
  read check
- SELECT over an index surfaces only projected attributes, and an
  explicitly selected non-projected column is rejected
- BatchExecuteStatement SELECT statements must resolve through the
  table's primary key; index-qualified or partial-key statements get
  a per-statement ValidationError slot

Consistent reads on base tables and LSIs stay legal, NextToken/Limit
now paginate both read branches, and GetItem stays a base-table-only
shortcut.

Reproduced with paritysuite/dynamodb-conformance (new
tests/tier2/partiql/executeStatementIndex.test.ts plus ExecuteStatement
cases in tier3/error-messages/indexReads.test.ts): the qualified-read
and message cases fail against main and pass with this change.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>

* fix(dynamodb): bind the PartiQL NextToken to its issuing statement

A PartiQL NextToken carried only the last evaluated key, so replaying a
token against another table or access path with identical key names and
scalar types was accepted: Scan continued from the foreign key and
skipped items, Query restarted and duplicated them. Real AWS binds the
opaque token to the request: replaying it against any other statement,
table or access path is rejected with 'NextToken does not match request',
while a changed Limit or a dropped ConsistentRead is accepted and an
older token replays idempotently (characterised on real AWS, eu-west-1,
2026-09-03).

The token now embeds a SHA-256 digest of the statement text and
parameter values alongside the key, and decoding verifies it against the
current request. Wire integration tests cover statement, parameter,
index-qualified and cross-table replay plus the accepted Limit change;
the SDK twin asserts the exact message; the conformance suite gains the
base-table-to-index replay case.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>

---------

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>
2026-09-04 09:25:46 -04:00
Mario Toffia 9220c057b7 feat(iot): domain configurations (#3008)
* feat(iot): add the domain configuration model and service

Stores AWS IoT Core domain configurations the way the API reports them:
a new configuration is ENABLED and CUSTOMER_MANAGED (ENDPOINT without a
domain name), carries one VALID server certificate, the default TLS
policy and an ARN with the short id AWS appends. Update changes the
status, authorizer, TLS, certificate and protocol settings; delete
refuses an ENABLED configuration, as AWS does; list filters by service
type and pages with marker and pageSize. Tags work on the ARN.

* feat(iot): serve the domain configuration API

Adds the REST-JSON routes CreateDomainConfiguration,
DescribeDomainConfiguration, UpdateDomainConfiguration,
DeleteDomainConfiguration and ListDomainConfigurations under
/domainConfigurations, registered with the IoT service so the
X-Amzn-Errortype header is set for unsigned callers too. Tags on a
configuration ARN go through IotTagHandler; the IoT /untag route now
uses the same handler as /tags instead of calling IotService directly.
DescribeEndpoint accepts iot:CredentialProvider, the endpoint type
that pairs with the CREDENTIAL_PROVIDER service type.

* feat(iot): provision AWS::IoT::DomainConfiguration

Adds IotDomainConfigurationCfnProvisioner over the domain configuration
service. Ref is the configuration name; Fn::GetAtt Arn, DomainType and
ServerCertificates resolve to what DescribeDomainConfiguration reports
(ServerCertificates as a JSON string, since attributes are strings).

Like the CloudFormation handler, a configuration is created ENABLED and
a DomainConfigurationStatus of DISABLED is applied with a follow-up
update; tags go through TagResource and are reconciled on update; a
delete disables the configuration first because the API refuses to
delete an ENABLED one. UpdateStack keeps the configuration when the
createOnly properties (DomainName, ServiceType, ValidationCertificateArn,
ServerCertificateArns) are unchanged and replaces it otherwise, with a
fresh generated name when the template names none.

Inventory TSV, fixture wiring and the generated resource-type table
updated.

* docs(iot): describe domain configurations and add the stack integration test

IotDomainConfigurationCfnIntegrationTest provisions the type through a
stack and asserts Ref and every Fn::GetAtt attribute against
DescribeDomainConfiguration, the in-place status update, and that
DeleteStack removes the configuration.

* test(iot): cover domain configurations in the Java and Go SDK suites

Both cases create, describe, list, update and delete a configuration
through the real SDK clients and check the AWS error types on the
duplicate create, the refused delete of an ENABLED configuration and
the describe after deletion.

* fix(iot): remove a renamed domain configuration and keep the status when the template omits it

A template that changes DomainConfigurationName creates the new
configuration and now removes the previous one, as the generated-name
replacement already did; before, the old configuration outlived the
stack. An update without DomainConfigurationStatus no longer forces
ENABLED: the field is omitted and the current status stays, as the AWS
handler does.

The service rejects a structured JSON value where a string, boolean,
list or object is expected instead of turning it into an empty string
or silently clearing the authorizer, and validates the whole update
before touching the stored record.

* fix(iot): let stack rollback remove a domain configuration and make same-name creates atomic

A configuration created by a stack is recorded, with the owned marker,
before the follow-up status update, so a failure there still lets the
create rollback delete it. A replacement that fails after the new
configuration exists removes it again, re-enables the previous one if
it had been disabled on the way out, and marks the resource restored,
as the other provisioners do.

CreateDomainConfiguration checks and stores the name in one step, so
two overlapping creates of the same name cannot both succeed. A tags
value that is not a list is rejected. The Java SDK compatibility case
looks for a leftover configuration instead of swallowing every cleanup
exception.

* fix(iot): point the resource back at the prior domain configuration after a failed replacement

After the unwind removes the replacement and re-enables the previous
configuration, the resource now carries the previous name and
attributes again, without the owned marker, so it describes the
configuration that is still there rather than the one just removed.

* feat(iot): serve the AWS-managed domain configurations

Every AWS account has iot:Data-ATS, iot:Data, iot:CredentialProvider
and iot:Jobs without creating them. They now exist in every region on
first use: AWS_MANAGED, ENABLED, no server certificate, and the address
DescribeEndpoint returns as their domain name. They can be updated and
tagged like any other configuration, but not deleted, as on AWS. A
client that starts by describing iot:Data-ATS gets an answer instead of
a 404.

* fix(iot): report a failed replacement cleanup as a rollback failure

When the unwind of a failed replacement cannot remove the new domain
configuration, the resource now carries the rollback-failure marker
with the reason, so the stack ends in UPDATE_ROLLBACK_FAILED instead of
reporting a clean rollback while the configuration is still there. The
marker moves next to the restored one in CfnRollback so extracted
provisioners can set it; the legacy provisioner keeps its alias.

* fix(iot): serialise every read-modify-write on a domain configuration

Update, delete, tag and untag read a record, change it and write it
back. Two overlapping writers lost each other's changes: sixteen tag
writers on one configuration left seven keys. All of them now run under
the lock the create already used, and a test pins the invariant. A JSON
round trip with the mapper setup persistent storage uses pins that the
model reloads intact.

* fix(iot): keep the prior status the unwind compares against and never delete a same-name replacement

The store hands out its live record, so disabling the prior on the way
to deleting it changed the very object the unwind later compared
against, and a prior whose delete failed half way was left DISABLED
while the stack reported a clean rollback. The status seen at the start
is now kept and used. The test reproduces the aliasing instead of
handing the provisioner a fresh copy per call.

A replacement under the same explicit name normally fails on the
create; if it goes through because the prior vanished in between, the
prior is no longer deleted, which would have removed the configuration
just created.

* fix(iot): tolerate a domain configuration that vanishes while a stack delete disables it

The disable that precedes the delete now treats ResourceNotFoundException
as already deleted, the way the delete itself does. The SDK cases also
enable an already ENABLED configuration, the call a client makes when
it only wants to be sure the configuration is on.
2026-09-04 01:05:21 -05:00
TATSUNO “Taz” Yasuhiro 21f165b2e9 perf(build): drop KotlinPoet and ICU4J from the protobuf schema path (#2992)
Wire's schema parser drags in KotlinPoet, which drags in kotlin-reflect. Floci
parses .proto and never generates Kotlin. 274.4 to 260.2 MiB, 88.7 to 85.0 MB
gzipped.
2026-09-03 20:59:21 -04:00
Vũ Thế Huy 262495df67 fix(dynamodb): reject unused ExpressionAttributeNames/Values on PutItem, DeleteItem, Scan, Query (#2923)
* fix(dynamodb): reject unused ExpressionAttributeNames/Values on PutItem, DeleteItem, Scan, Query

The checkUnusedEan / checkUnusedEav helpers were only wired into handleUpdateItem
and (names only) handleQuery, so PutItem, DeleteItem and Scan accepted expression
attribute entries not referenced by any expression and performed the operation,
where AWS returns ValidationException. Query accepted unused values for the same
reason.

Wire both helpers into handlePutItem, handleDeleteItem and handleScan, and add the
missing checkUnusedEav call to handleQuery, each checking against the tokens
actually referenced by that operation's expressions.

Closes #2893

* fix(dynamodb): also reject unused EAV on legacy KeyConditions + FilterExpression Query

Addresses PR review: the unused ExpressionAttributeNames/Values check in
handleQuery was gated on KeyConditionExpression != null, so a Query combining
legacy KeyConditions with FilterExpression skipped it. Widen the guard to fire
whenever any expression parameter (KCE, FilterExpression, ProjectionExpression)
is present, and add an integration case for the mixed path. Also replace an em
dash in the new test comment per repo style.

* test(dynamodb): reference the aliased name in the reserved-word conformance case

The sdk-test-node "reserved word aliased via ExpressionAttributeNames passes"
case supplied ExpressionAttributeNames {#st: status} on a PutItem whose
ConditionExpression (attribute_not_exists(pk)) never referenced #st. Real AWS —
and now Floci, per #2893 — rejects unused ExpressionAttributeNames entries with
ValidationException. Point the ConditionExpression at #st so the alias is
actually used; the reserved-word aliasing behaviour under test is unchanged.

* fix(dynamodb): run Query unused EAN/EAV check unconditionally

Addresses PR review: the previous guard (keyConditionExpr || filterExpr ||
projectionExpression) still let a legacy KeyConditions Query carrying a stray
ExpressionAttributeNames/Values map through without validation. Drop the guard
so the checks always run; the token sets are still derived only from the
expressions that can legitimately reference those maps, so a correct request is
unaffected. Add an integration case for legacy KeyConditions with no expression
parameter.

* test(dynamodb): reference the aliased name in the sdk-test-java reserved-word case

Mirror of the sdk-test-node fix: reservedWordWithAliasPasses supplied an unused
ExpressionAttributeNames {#st: status} on a PutItem whose ConditionExpression
referenced pk, which #2893 now correctly rejects. Point the condition at #st.

* fix(dynamodb): AWS "can only be specified when using expressions" wording for PutItem/DeleteItem

Addresses PR review: when ExpressionAttributeNames/Values is supplied with no
expression parameter at all, this PR's new checkUnusedEan/checkUnusedEav calls
reported "Value provided in ExpressionAttributeNames unused in expressions:
keys: {...}". Real AWS answers that sub-case with "<param> can only be
specified when using expressions: ConditionExpression is null" instead.

Add rejectExprAttrsWithoutExpression, parameterised on the null-expression
message, and wire it into handlePutItem and handleDeleteItem ahead of the
unused-alias checks. Both operations only accept ConditionExpression, so the
named param is unambiguous; the wording matches the pre-existing PutItem+EAV
guard from #826. EAV is checked before EAN to preserve that guard's order.

Scan and Query still return the "unused in expressions" 400 for this sub-case:
those ops accept multiple expression parameters and AWS's exact wording there
is unverified. The helper is parameterised so it is a one-line change per op
once the strings are measured.
2026-09-03 10:49:08 -04:00
Kenshin Okinaka 812911fd03 feat(ses): support tag operations on tenant ARNs (#2832)
* feat(ses): support tag operations on tenant ARNs

* fix(ses): shield the stored tenant record from tag-callback mutation

* test(ses): cover the cross-region guard for tenant TagResource/UntagResource

* docs(ses): drop em dashes from the tenant tag additions
2026-09-02 22:14:39 -04:00
luiseterc c54b237cd8 fix(ec2): include network metadata in instance type responses (#2943) 2026-09-02 16:36:41 -04:00
Aniket Shukla 7d693de663 fix(dynamodb): reject QueryFilter with KeyConditionExpression (#2935)
* fix(dynamodb): reject QueryFilter with key expression

* test(dynamodb): keep QueryFilter test legacy
2026-09-02 11:41:14 -04:00
Kévin Dehoux 6dec21479b fix(dynamodb): reject ConsistentRead on GSI Scan (#2931)
Query already rejected ConsistentRead=true on a global secondary index,
but Scan silently performed the read. AWS returns ValidationException
'Consistent reads are not supported on global secondary indexes' for
both operations.

Extract the check into rejectConsistentReadOnGsi and apply it to both
handlers; strongly consistent reads on tables and LSIs stay legal.

Reproduced with paritysuite/dynamodb-conformance
(tests/tier3/error-messages/indexReads.test.ts): the Scan case failed
against 2.0.1 and passes with this change; the in-repo
DynamoDbAccessPathIntegrationTest gains a wire-level Scan case plus an
LSI-acceptance guard, and the Java SDK compat twin covers both ops.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>
2026-09-02 10:59:33 -04:00
Brian Taylor 2bf9b57bd9 fix(lambda): omit Environment when no variables are set (#2838)
* fix(lambda): omit Environment when no variables are set

Real AWS omits the Environment member entirely from CreateFunction,
GetFunction, GetFunctionConfiguration and ListFunctions responses when a
function has no environment variables. Floci always emitted it, as an
empty object.

The Terraform provider reads a present-but-empty Environment back as an
environment {} block in state, so any function declared without variables
plans a removal on every run and never converges. On Lambda@Edge, where
environment variables are not permitted at all, the block can never
legitimately exist and each no-op apply also republishes the function.

Layers, KMSKeyArn, FileSystemConfigs and VpcConfig in the same response
builder already omit-when-empty; Environment was the outlier.

* test(compat): correct Environment assertions to match live AWS

Three assertions in the Python and Java SDK compatibility suites required
an Environment block that real AWS does not send:

  - test_get_function_configuration_environment_always_present
  - test_update_environment_variables_round_trip (the cleared case)
  - LambdaFunctionConfigTest.getFunctionConfigurationHasDefaults

Measured against the live service in both directions: a function created
without variables comes back with no Environment member, and clearing to an
empty Variables map removes it again. The tests encoded Floci's previous
behaviour rather than the API's, which is why they went green.

Also corrects the wording of the Java clear case. It sends an Environment
with no Variables member, which is 'leave unchanged', not 'clear' — live AWS
keeps the existing variables, as Floci already did. The assertion now pins
that instead of describing a clear that never happened.
2026-09-01 10:56:48 -04:00
Kenshin Okinaka b0fe8311a0 feat(ses): support v2 tenant-scoped sending with association gate (#2815)
* feat(ses): support v2 tenant-scoped sending with association gate

* fix(ses): guard tenantForSending against a null TenantName and pin the raw-test charset

* fix(ses): validate an inline bulk template before the tenant gate
2026-08-31 09:35:40 -04:00
Vũ Thế Huy 426fbcb284 feat/redshift auth proxy (#2751)
* feat(redshift): add auth proxy port range and endpoint-host config

* feat(redshift): add containerHost/containerPort/proxyPort to Cluster model

* feat(redshift): add RedshiftAuthProxy reusing the RDS PostgreSQL protocol handler

* feat(redshift): add RedshiftProxyManager registry with shutdown hook

* feat(redshift): front new clusters with an auth proxy and advertise it

* feat(redshift): stop/update proxy on delete/modify, start it on snapshot restore

* feat(redshift): keep proxy port stable across reboot and adopt-on-startup

* test(redshift): integration coverage for JDBC through the auth proxy

* test(redshift): reinstate JDBC connectivity check now that the proxy exists

* docs(redshift): document the cluster auth proxy and its config

* fix(redshift): prevent minor port leak when proxy fails to start

* fix(redshift): rollback container on proxy failure and surface teardown errors

* fix(redshift): stop auth proxy on rollback to prevent listener collisions

* fix(redshift): ensure proxy shutdown failure does not abort container and port cleanup

* fix(redshift): add proper logging for intentionally ignored cleanup exceptions

* fix: Wait for Redshift database readiness before proxying

Previously, RedshiftContainerManager just slept for 3 seconds before marking the container as started. On slower CI environments, the PostgreSQL database might take longer to initialize, resulting in Connection Refused when the RedshiftAuthProxy forwards connections.
Now, RedshiftContainerManager polls the database using psql until it's ready, up to 60 seconds.

* fix(redshift): prevent proxy port reallocation on shutdown failure

Addresses a review comment indicating that if a Redshift auth proxy fails to shut down during rollback or deletion, its port must not be released into the available pool. Reassigning a still-bound port would cause subsequent cluster creations to fail with a BindException.
Instead, we now tolerate proxy shutdown errors but intentionally leak the port allocation to prevent collisions.

* fix(redshift): fix failing tests due to proxy changes

1. RedshiftOperationsTest checked for a hardcoded port 5440, but the RedshiftService now allocates dynamic proxy ports. Removed the exact port assertion.
2. RedshiftContainerManager's psql readiness check was connecting via local Unix socket, which succeeded before PostgreSQL was actually ready to accept remote TCP connections from the proxy. Added '-h 127.0.0.1' to enforce TCP readiness.

* test(redshift): use Awaitility to connect to proxy

Use Awaitility to retry the initial connection in RedshiftProxyIntegrationTest to prevent transient 'Connection attempt failed' errors on slower CI environments.

* chore(redshift): use proper imports instead of fully-qualified class names in tests

* fix(redshift): fix compiler errors introduced during import cleanup

* fix(redshift): resolve proxy lifecycle bugs and CI network issues

- Throw RuntimeException from RedshiftProxyManager.stopProxy if proxy is not found. This allows RedshiftService to catch it and intentionally leak the port, preventing port collisions if a proxy fails before registration.
- Force RedshiftProxyIntegrationTest to connect via 127.0.0.1 instead of the endpoint address, which resolves to host.docker.internal in CI environments and causes UnknownHostException.

* fix(redshift): prevent proxy port exhaustion on startup failures

Instead of blindly assuming missing proxies denote a leaked port, RedshiftProxyManager now tracks proxies that failed their socket cleanup during startup. stopProxy throws an exception only if the socket is known to be leaked. This allows RedshiftService to safely release ports after clean proxy startup failures, addressing Greptile's feedback about port exhaustion.

* fix(redshift): retain proxy reference to allow retry on close failure

As identified by Greptile, stopProxy previously removed the proxy from the registry before calling proxy.stop(). If stop() threw an exception, the proxy reference was lost, preventing any subsequent retry from ever finding it and attempting to close it again. stopProxy now only removes the proxy from the registry after stop() returns successfully. Additionally, failedCleanups is now retained instead of cleared, ensuring retries continue to safely leak the port if cleanup remains impossible.

* fix(redshift): abort cluster deletion if proxy fails to stop

As highlighted by Greptile, previously deleteCluster would swallow proxy shutdown failures and delete the cluster metadata anyway. This eliminated the retry path, stranding the unclosed proxy and its port reservation until the process exited. Now, if stopProxyAndReleasePortSafely fails, deleteCluster throws an exception to preserve the cluster metadata so the deletion can be retried.

* test(redshift): lock in proxy lifecycle failure-recovery behaviors

Bổ sung test cho ba hành vi hardening chưa được cover, để refactor sau
không âm thầm phá vỡ:

- stopProxy giữ lại proxy trong registry khi close() ném, cho phép retry
  gọi lại đúng instance và chỉ deregister sau khi stop sạch
- marker leak khi startup cleanup thất bại được retain qua mọi retry và
  chỉ bị xoá bởi một lần start mới thành công
- deleteCluster abort với InternalFailure, giữ nguyên container + metadata
  khi proxy không stop được; retry sau đó hoàn tất khi proxy stop OK

Đồng thời bỏ "-p 7100-7199:7100-7199" trong compatibility.yml: proxy bind
0.0.0.0 trong container floci và sdk-test-java chạy trên compat-net nên
JDBC đi container-to-container qua alias "floci", không cần publish port
ra host. Giữ lại FLOCI_SERVICES_REDSHIFT_ENDPOINT_HOST=floci.

* fix(redshift): keep an unclosable proxy reachable for later retry

Theo phản hồi mới của Greptile: khi start/replace proxy thất bại và
cleanupFailedStart cũng không đóng được listener, code cũ chỉ lưu relayKey
vào một Set rồi vứt object RedshiftAuthProxy. stopProxy sau đó ném vĩnh
viễn mà không còn cách nào chạm tới listener để thử đóng lại, khiến
cluster không xoá được và port bị giữ mãi trong dải hữu hạn.

Thay Set<String> failedCleanups bằng Map<String, RedshiftAuthProxy>
unclosableProxies. cleanupFailedStart giữ lại chính proxy đó; stopProxy và
stopAll thử đóng lại, chỉ gỡ entry khi stop thành công. startProxy không
còn xoá marker khi start mới — chỉ một lần stop thành công mới gỡ, vì
listener cũ có thể vẫn đang bound.

* fix(redshift): retry proxy port bind to absorb reboot rebind race

rebootCluster giữ nguyên proxy port của cluster để endpoint ổn định, nên
listener cũ bị đóng rồi bind lại đúng port đó chỉ vài ms sau. Dưới tải
(CI runner ARM) kernel có thể chưa nhả port và SO_REUSEADDR không giúp
được khi accept loop cũ đang teardown -> BindException -> RebootCluster
trả 500. Đây là nguyên nhân test RedshiftOperationsTest.
testClusterAndSnapshotLifecycle fail chập chờn.

start() giờ retry bind tối đa ~1s, chỉ nuốt BindException; IOException
khác vẫn propagate ngay. Thêm test dựng cảnh port bị chiếm tạm thời rồi
nhả, xác nhận proxy vẫn bind được.

* fix(redshift): tear down proxy and release port when rebootCluster fails

Nếu startProxy/restoreSnapshot ném sau khi proxy đã (re)start trong
rebootCluster, hai nhánh catch chỉ set status "failed" rồi rethrow —
proxy mới vẫn chạy và port vẫn nằm trong usedPorts, không nhánh nào dọn.
Giờ cả hai catch gọi stopProxyAndReleasePortSafely như createCluster và
restoreFromClusterSnapshot đã làm; proxyPort được hoist ra ngoài try với
sentinel -1 để rollback an toàn kể cả khi chưa cấp port.

Thêm test: restoreSnapshot ném -> proxy được stop lại, AwsException nổi lên.

* fix(redshift): serialize createCluster/deleteCluster/restoreFromClusterSnapshot

modifyCluster và rebootCluster đã synchronized nhưng create/delete/restore
thì không, dù cả năm method đều chạy chuỗi container + proxy + port nhiều
bước trên cùng một cluster. deleteCluster(x) chạy song song rebootCluster(x)
có thể để lại metadata mồ côi trỏ tới container/proxy đã dừng. Thêm
synchronized cho ba method còn lại để nhất quán.

* fix(rds,redshift): close backend socket when the auth handshake fails

handleConnection mở kết nối TCP tới container Postgres trước khi gọi
handleAuth. Chỉ nhánh thành công (bridge) và vài nhánh lỗi có kiểm soát
mới đóng backend; nếu handleAuth trả về sớm ở một probe trần (SSLRequest
không kèm startup) hoặc ném IOException (client ngắt giữa handshake), catch
cũ chỉ đóng client -> mỗi health-check TCP làm rò một connection tới
Postgres, ăn dần max_connections.

Chuyển việc đóng socket sang finally, đóng cả client lẫn backend
(idempotent, nhánh thành công đã đóng sẵn). Áp cho cả RdsAuthProxy vì
RedshiftAuthProxy được copy từ đó. Thêm test: client drop giữa handshake
-> backend nhận EOF.

* fix(redshift): stop replacement container and keep dump on failed reboot

Rollback của rebootCluster (b44fd1e3) mới chỉ stop proxy + release port,
để container thay thế chạy tiếp sau một cluster "failed", và finally vẫn
xoá tempDump. Vì container gốc đã stop và không có volume, tempDump là bản
sao duy nhất của data -> mất data không khôi phục được (bug có sẵn, giờ
mới lộ).

rollbackReboot() giờ stop luôn container thay thế (như createCluster/
restoreFromClusterSnapshot). tempDump chỉ bị xoá khi reboot thành công;
khi fail thì giữ lại và log đường dẫn để khôi phục thủ công.

* fix(redshift): make reboot rollback phase-aware to protect the original

Commit trước cho rollbackReboot stop container vô điều kiện. Nếu reboot
fail ngay ở takeSnapshot hoặc stopProxy — lúc container gốc (chứa data,
không volume) VẪN đang chạy — thì rollback lại force-remove chính nó, huỷ
bản sao data hoàn chỉnh duy nhất và chỉ còn dump rỗng/dở.

Thêm hai cờ:
- originalTornDown: đã stop proxy + container gốc -> rollback mới được
  đụng vào proxy/port
- replacementStarted: đã start container thay thế -> rollback mới được
  stop container
Fail trước hai mốc đó: không đụng gì, trạng thái gốc còn nguyên.

Thêm test: takeSnapshot ném -> cm.stop và stopProxy không được gọi.

* fix(redshift): clean an orphan replacement container on failed reboot

containerManager.start có thể tạo container Docker rồi mới ném ở
waitForReady, nên cờ replacementStarted (set sau khi start return) bỏ sót
trường hợp này -> orphan chạy dưới tên cluster.

Bỏ replacementStarted, gate rollback theo mỗi originalTornDown: một khi
proxy + container gốc đã stop thì container gốc chắc chắn biến mất, nên
containerManager.stop (xoá theo tên) chỉ có thể chạm replacement — kể cả
replacement do start() tạo dở rồi ném.

Thêm test: start() ném -> rollback vẫn gọi cm.stop để dọn orphan.

* fix(redshift): remove orphan cluster metadata on failed create/restore

* fix(redshift): keep failed cluster metadata if proxy stop fails

* fix(redshift): fix TooManyActualInvocations in proxy tests

* fix(redshift): clear proxyPort on reboot rollback if port is released

* fix(redshift): retain reserved port on reboot startup failure

* fix(redshift): retain proxy port in reboot rollback and teardown failed startup recovery

* fix(redshift): skip failing cluster and retaining dump if reboot fails before teardown
2026-08-31 09:03:26 -04:00
Aniket Shukla 2480daaa09 fix(athena): route database DDL to Glue (#2757)
* fix(athena): route database DDL to Glue

* fix(athena): preserve DDL execution failures
2026-08-30 18:26:48 -04:00