A listener stored whatever certificate ARN it was given. CreateListener,
ModifyListener and AddListenerCertificates each model CertificateNotFound,
and all three took an ARN naming nothing and answered 200, so a listener
could be left serving a certificate that was never uploaded. Only the other
direction worked: ELBv2 reports its references to IAM, so
DeleteServerCertificate already refused with DeleteConflict while a listener
held one.
The error is the one AWS publishes on those three operations and no others:
botocore gives CertificateNotFoundException the code CertificateNotFound,
400, senderFault, and the API reference lists it under
AddListenerCertificates, CreateListener and ModifyListener with one
sentence, "The specified certificate does not exist." That sentence is the
message rather than one naming the ARN, because it is the one the reference
publishes.
The check covers the listener types the member belongs to and no more. The
reference marks Certificates "[HTTPS and TLS listeners]" on CreateListener
and ModifyListener, and describes AddListenerCertificates as adding to the
list "for the specified HTTPS or TLS listener", so a certificate on a
listener of any other protocol is a configuration it does not describe. What
AWS answers there is not CertificateNotFound on any evidence to hand, so
such a request keeps the behaviour it had rather than being refused with a
code read off the wrong case. A test pins each side of that line. The line
follows the protocol the listener ends the call with, not the one it started
with: ModifyListener takes a protocol without taking certificates, so when
none arrive the certificates checked are the ones already on file. An HTTP
listener holding an ARN that resolves to nothing is left alone, and the
request that turns it into an HTTPS one, which is where those certificates
start being served, is refused.
A blank entry is refused the same way, rather than skipped. Certificates is
the list of certificates the listener serves, an empty value in it names one
no better than a value that is no ARN at all, and the Query parser turns an
empty CertificateArn parameter into exactly that entry, so skipping it
stored a certificate the listener cannot serve.
ELB Classic already answered this question in full, resolving an ARN to an
IAM server certificate or an ACM one and holding IAM's certificate lock
across the write. This is the second caller, so the three private methods it
kept, certificateExists, iamServerCertificate and acmCertificateExists, move
to CertificateReferenceResolver in core.common and Classic reads them from
there. Neither referrer owns the lookup: IAM holds server certificates, ACM
holds the rest, and a listener carries only the ARN. Classic's public
constructors are untouched, so its unit tests still build it the same way.
The check alone is not enough, which is why the lock moves with it. A
certificate can be deleted between the check and the write, and the delete
walks the reference providers under IAM's own lock, so every write that
records an IAM certificate runs inside that lock and re-checks there, while
the fail-fast check outside it keeps the error precedence. That covers
CreateListener as much as the two writes to a listener already published:
until the new listener is in the map, nothing the delete walks can see that
it holds the certificate. A race test drives each of them against
DeleteServerCertificate over the wire, and with the lock removed they leave
a listener holding a deleted certificate in 1 of 30 trials for
AddListenerCertificates and 4 of 30 for CreateListener, so the guarantee is
measured rather than asserted.
Where the check sits in ModifyListener is part of the fix. The listener it
modifies is the stored object, and the port, protocol and SSL policy were
set before anything could refuse the request, so a refusal answered 400 over
a listener already moved to the new port: no later read put it back, and the
data plane was never restarted to match. Every refusal now lands before the
first setter.
An absent resolver leaves the old behaviour in place. ElbV2Service is wired
by hand in its unit tests, with no IAM and no ACM, and a listener write
there is the write it was before any certificate existed to check. The
dependency is a field rather than a constructor parameter because that is
how this class takes all six of its others, and converting it would be a
refactor this change does not need.
docs/services/elb.md said listener certificate ARNs are not validated when
they are added, which was true and is the behaviour this removes, so it now
documents the three operations, the protocols they cover, the empty value,
the protocol change, the error and the lock, as the Classic page already
does.
Sixteen integration tests cover a missing IAM certificate, a missing ACM
one, a blank entry, a value that is no ARN at all and an ARN of a service
that serves no certificates, an uploaded certificate and an ACM certificate
being accepted, a listener carrying no certificate, a TLS listener held to
the same check as an HTTPS one and a listener of a protocol with no
certificates left alone, a protocol change refused over the certificate it
already held and allowed over one that exists, a second certificate being
added, a refused change leaving the port and protocol as they were, and the
two writes that must refuse without changing what the listener already
serves. Every certificate and load balancer they make is registered for
cleanup: the account's certificate quota is 20 and the Quarkus instance is
shared, so one left behind fails an unrelated class's upload instead of
anything here.
Three things the reference states about these operations stay open, each
wanting an error code no source here gives: CreateListener and
ModifyListener take "exactly one certificate" and AddListenerCertificates
"one certificate per call", where Floci accepts a list; TooManyCertificates
is modeled on all three and no quota is enforced; and
DescribeListenerCertificates is documented to report the default certificate
alongside the list, with IsDefault telling them apart, which Floci does not
model.
Driven through the standard hashicorp/aws provider against a local instance
as well, which is how the change was checked against a real client rather
than only against the suite: an aws_iam_server_certificate and an
aws_lb_listener serving it apply clean, and a listener naming a certificate
nobody uploaded fails with CertificateNotFound and the reference's sentence.
That failure arrives at the end of the provider's create timeout rather than
at once, because the provider retries this error on all three calls, the
AddListenerCertificates one against a constant named iamPropagationTimeout:
real AWS is eventually consistent about a certificate just imported, so a
client waits it out. Floci's storage is immediately consistent and nothing
here models a propagation delay, so the retry simply ends in the refusal.
The same contract is pinned at the SDK boundary too, as eight boto3 tests in
compatibility-tests: the refusal on each of the three operations, the
accepted cases, and both protocol edges. They run in under a second, where
driving the same thing through Terraform in CI costs about a minute for the
accepted case and nearly two for the refusal, almost all of it the
provider's waiter and the retry above rather than anything Floci does. The
suite had no ELB coverage at all before this. Each test takes its load
balancer back out before its certificates, which is the order that frees
them, and test_acm.py's private certificate builder moves to a conftest
fixture taking the common name rather than being copied, since the new file
needs the same pair.
#2940 widened the compatibility workflow to build the native image for both
published architectures and run all eight suites on both, sixteen suite jobs per
PR. What the suites check is arch-neutral, and with several PRs in flight the
jobs sat queued for the shared runner pools for longer than they take to run.
The suites now run against the arm64 image only. Both native images are still
built, so each published architecture is proven to link and package, and one
amd64 suite stays: sdk-test-python now carries a Firehose compression delivery
test, mirroring the Java one, that proves the x86_64 snappy JNI library
survived the native build. That is the one resource registered per platform,
and the proof moves from the slowest leg to the fastest.
The two Snappy variants are container formats around raw Snappy blocks: the
xerial snappy-java stream and Hadoop's block framing, neither of which has a
Python reader without native system libraries. The test parses the framing
itself, following Floci's writer, and decodes the raw blocks with cramjam,
which ships wheels for both architectures. The results artifact carries the
architecture in its name so the two Python uploads are distinguishable.
* feat(config): add compliance evaluation loop, retention, and pagination
Replace the hardcoded INSUFFICIENT_DATA compliance with real aggregation
over evaluations reported via PutEvaluations / PutExternalEvaluation:
- New actions (13): PutEvaluations, PutExternalEvaluation,
DeleteEvaluationResults, DescribeComplianceByResource,
GetComplianceDetailsByConfigRule, GetComplianceDetailsByResource,
GetComplianceSummaryByConfigRule, GetComplianceSummaryByResourceType,
DeleteConfigurationRecorder, DeleteDeliveryChannel,
PutRetentionConfiguration, DescribeRetentionConfigurations,
DeleteRetentionConfiguration
- PutConfigRule now round-trips the full AWS rule shape (Description,
Scope, SourceDetails, InputParameters, MaximumExecutionFrequency,
EvaluationModes) instead of silently dropping fields
- Evaluations persist to config-evaluations.json and are cascade-deleted
with their rule; retention persists to config-retention.json
- NextToken/Limit pagination on describe/get operations with AWS page
sizes and InvalidNextTokenException/InvalidLimitException validation
- DescribeConfigRules with an unknown name now fails with
NoSuchConfigRuleException, matching AWS
- boto3 compatibility suite: tests/test_config.py
Since Floci performs no Lambda invocation, PutEvaluations accepts the
config rule name as the ResultToken; documented in the service doc's
deviations section.
* fix: honor Limit field in Config pagination requests
* fix(config): enforce the modeled rule enums and the ComplianceTypes filter shape
PutConfigRule now deserializes the whole modeled ConfigRule and stores it, so
Source.Owner, MaximumExecutionFrequency, ConfigRuleState and
EvaluationModes[].Mode were persisted and echoed back verbatim — a rule AWS
would have rejected with InvalidParameterValueException read back as a valid
one.
The ComplianceTypes filter on the four compliance reads was likewise unchecked:
an unmodeled value or a list longer than the shape's max of 3 simply matched
nothing, which a caller reads as an empty result rather than as a rejection.
* fix(config): validate the nested SourceDetails enums and Scope cardinality
The stored ConfigRule carries SourceDetails, whose EventSource (aws.config only),
MessageType and MaximumExecutionFrequency are all enum-typed, and a Scope whose
ComplianceResourceTypes list is capped at 100. All four were persisted and echoed
back by DescribeConfigRules verbatim, one level below the members the previous
commit checked.
* fix(config): reject a missing ConfigRuleName on DeleteConfigRule
store.remove(ruleName) throws NullPointerException on the backing
ConcurrentHashMap when ruleName is null (the handler passes null when
ConfigRuleName is absent from the request), producing a 500 instead of
the modeled NoSuchConfigRuleException. Guard on isBlank(ruleName)
first, matching the existing requireRule() idiom used by the sibling
evaluation operations for the same field.
* fix(config): keep the newest evaluation when PutEvaluations reorders
storeEvaluations() unconditionally overwrote the stored compliance
result for a resource/rule pair, so an older evaluation arriving after
a newer one (e.g. an out-of-order Lambda invocation) regressed
compliance details, aggregates, and summaries back to the stale value.
Compare against the stored OrderingTimestamp and skip the incoming
evaluation when it is older than what is already recorded.
* fix(config): make PutEvaluations atomic per resource/rule key
storeEvaluations() read the current evaluation with a plain get() and
wrote the new one with a separate put(), so two concurrent
PutEvaluations calls for the same resource could both read the old
value before either wrote, letting an older OrderingTimestamp win the
race regardless of arrival order. Replace the read-then-write with
ConcurrentHashMap.compute(), which is atomic per key.
Added a stress test exercising 16 concurrent writers per resource key
across 100 attempts; it passes reliably under the fix. The race window
in the prior get/put shape is narrow enough (a handful of nanoseconds
between the two calls) that it did not reproduce deterministically
under test scheduling even with that much contention -- the fix is
justified by the non-atomic read-then-write shape itself, not by a
forced failure.
* fix(config): enforce DescribeConfigRules' 25-name limit
ConfigRuleNames is modeled with Maximum 25 items (confirmed against
botocore's config service-2.json) but describeConfigRules had no size
check, so 26+ names were processed instead of rejected with
InvalidParameterValueException like every other array-size limit this
PR already enforces.
* fix(config): close the DeleteConfigRule/PutEvaluations deletion race
PutEvaluations (and PutExternalEvaluation, DeleteEvaluationResults)
checked a rule's existence via requireRule and then wrote to the
evaluations map as two separate steps. If DeleteConfigRule ran in
between -- removing the rule and its evaluation bucket -- the pending
PutEvaluations call would recreate the bucket via computeIfAbsent
after the delete, orphaning evaluations under the deleted rule's name.
A later rule created with that same name would then inherit the
deleted rule's compliance details and evaluation status.
Guard the check-then-act with a per-rule monitor (ruleKey(region,
ruleName)), matching the lockFor()-keyed-monitor idiom already used by
DocDbService for the identical class of race between a tag update and
a delete.
Added a stress test racing PutEvaluations against DeleteConfigRule
across 200 attempts, then recreating the rule under the same name and
asserting a clean (INSUFFICIENT_DATA) evaluation state. It passes
under the fix; as with the earlier PutEvaluations-ordering race, it
did not reproduce RED against the pre-fix code even under that much
contention -- the race window between the existence check and the map
write is too narrow to hit deterministically without injecting an
artificial delay into production code. The fix is justified by the
non-atomic check-then-act shape itself, confirmed by reading the code.
* feat(ses): implement email template CRUD with stored, inline, and ARN variants
Adds CreateTemplate / GetTemplate / UpdateTemplate /
DeleteTemplate / ListTemplates on both V2 REST JSON
(/v2/email/templates) and V1 Query.
SendEmail / SendTemplatedEmail resolve templates in three forms
with Mustache-style {{var}} substitution against TemplateData:
- TemplateName references a stored template
- TemplateArn extracts the name from the template/<name>
segment of an SES template ARN (region and account segments
are not validated, mirroring how KMS / Secrets Manager
handle ARNs in Floci)
- TemplateContent (V2 only) supplies inline subject / text /
html without storing the template first
V2 Content.Template requires exactly one of TemplateName,
TemplateArn, or TemplateContent; violations return
BadRequestException (400). V1 SendTemplatedEmail accepts
TemplateArn either alone or alongside Template (name) — the
name is used for resolution when both are present, matching
AWS where boto3 and the Java SDK keep Template as a required
field and treat TemplateArn as supplementary for cross-account
addressing.
Templates persist region-scoped via StorageFactory in
ses-templates.json. Template names reject leading/trailing
whitespace (same rule as identities) and are validated through
a single validateTemplateName helper reachable from every
resolution path. listTemplates is sorted by CreatedTimestamp
with TemplateName as a tiebreaker for deterministic output.
Error codes: the service layer throws V1-style codes
(TemplateDoesNotExist / AlreadyExists / InvalidTemplate /
InvalidParameterValue); SesController remaps them to
NotFoundException (404) / AlreadyExistsException (400) /
BadRequestException (400) for V2 callers.
* test(ses): add Python and Java SDK compatibility tests for templates
Covers boto3 (ses / sesv2) and AWS Java SDK v2 (SesClient /
SesV2Client) against the SES email template CRUD, inline
TemplateContent, and TemplateArn paths. Happy path,
duplicate-create rejection, missing-template lookups,
Mustache-style variable substitution, and 3-way selector
conflicts on V2 Content.Template are exercised on both SDK
surfaces.
Adds:
- Python: ses_client / sesv2_client conftest fixtures and a
tests/test_ses_templates.py suite covering V1 + V2
- Java: sesv2 Maven dependency, SesV2Client factory in
TestFixtures, and a SesTemplateTest covering V1 + V2
* docs(ses): document email template CRUD and templated send
Adds the new V1 template actions (CreateTemplate / GetTemplate
/ UpdateTemplate / DeleteTemplate / ListTemplates /
SendTemplatedEmail) and the V2 /v2/email/templates endpoints
to the SES service reference, and extends the README service
matrix to mention template support on the SES / SES v2 rows.
* fix(ses): add template actions to SES_ACTIONS for unsigned request routing
Unsigned clients (curl, aws --no-sign-request) were falling through to
the SQS handler because the six template Query actions were not
registered in SES_ACTIONS.
* fix(ses): narrow exception catch to JsonProcessingException in template endpoints
Broad Exception catch was masking unexpected errors (e.g. NPE) as 400
responses. Narrowed to JsonProcessingException which is the only
checked exception from objectMapper.readTree().
* test(ses): add template variable substitution edge cases and cross-region isolation
Add SesServiceTemplateTest with 14 unit tests for applyTemplateData
covering undefined variables, spaced/hyphenated names, unclosed braces,
non-string JSON values, regex metacharacters, and case sensitivity.
Add cross-region isolation integration test verifying templates created
in one region are not visible in another.
* test(ses): add awscli compatibility tests for template CRUD and templated send
Cover create, get, update, list, delete template and send-templated-email
via the AWS CLI. Uses JSON parameter format to avoid awscli parser issues
with Mustache-style {{variable}} syntax.
---------
Co-authored-by: Kenshin OKINAKA <kenshin_okinaka@realcross.co.jp>
* test: move compatibility tests into this repo
* fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler
* fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest
* test: add sdk tests for multipart S3 copy coverage
* fix: cover and fix smithy cbor and multipart s3 copy regressions
* test: migrate more test coverage to new folder
* test: add missing ec2 expectation in healthcheck test
* docs: update READMEs in `./compatibility-tests`