* fix(dynamodb): match AWS wording and order for Select rejections
Query and Scan share one Select validator. It reported Floci wording and
checked the rules in the wrong order, so a request breaking both the
ProjectionExpression rule and the IndexName rule named the wrong one.
The ProjectionExpression conflict is now reported first, and each message
names the Select value the way AWS does. The SPECIFIC_ATTRIBUTES message
without a projection also matches AWS, which prefixes the error count on
Query but not on Scan.
Closes 8 TIER 1 and 2 TIER 3 cases in the dynamodb-conformance suite.
* test(dynamodb): cover the bare Select message on Scan
Scan returns the message without the validation count prefix, Query keeps it.
Only the Query side had a handler-level test.
The official postgres image serves first-boot init through a temporary
server that listens only on the Unix socket, then restarts it. The
readiness probe ran pg_isready over that socket, so it could pass
against the temporary server before the final server accepted TCP
connections from the Airflow container. Probe TCP loopback instead.
The official postgres image serves first-boot init through a temporary
server that listens only on the Unix socket, then restarts it. The
readiness probe ran psql over that socket, so it passed against the
temporary server and CreateDBInstance returned while the container was
still restarting. A CreateDBSnapshot sent right after then failed
pg_dumpall and returned InvalidDBInstanceState.
Run the rds_iam role setup over TCP loopback instead, as the Redshift
readiness check already does. The temporary server never listens on
TCP, so the command only succeeds once the final server is up. Loopback
connections are trusted by the generated pg_hba.conf, so no password is
needed. Log the cause when a snapshot fails. The round-trip container
test waits the same way.
Fixes#3384
AwsArnUtils parses an ARN's five top-level fields and hands the resource back
whole, because its structure is service-specific. Five services then split that
resource by counting from an end, and each is wrong on input AWS accepts.
SNS took the segment after the last colon as a Lambda function name, so a
subscription to a qualified ARN (...:function:order-processor:PROD) invoked a
function named PROD. The message was accepted, reported as published, and
delivered nowhere. S3 and Step Functions already cut after ":function:"; SNS
was the outlier and now matches them.
Step Functions decided between a state machine ARN and a version ARN by asking
whether the last segment was all digits. Digits are legal in a state machine
name, so a machine named 2024 was taken apart into version 2024 of a nameless
ARN, and validation then refused it: DescribeStateMachine returned InvalidArn
for a state machine that exists. The rule is now the resource's segment count,
stateMachine:<name> against stateMachine:<name>:<version>, and the two inline
copies of the old rule route through it so all three sites agree.
AppSync read the API id as the segment after the last slash, so tagging a data
source looked up an API by the data source's id and answered NotFound. The
model anchors AppSync's ResourceArn to apis/<26 chars> with nothing after it,
so a sub-resource ARN is not taggable at all and the answer is 400. That shape
is adopted verbatim except for the partition: the model spells it aws, but this
emulator mints API ARNs with the region's own partition and has to accept the
ARN it just returned.
Two are hardening rather than live failures, and neither is reachable through
the public API today, so neither carries a test: the microVM controller used a
bare split where a guarded regionOf sits in the same class, and S3 Tables
guarded on ":" + prefix while cutting on the prefix alone, which only diverges
for a name containing the prefix that the name charset already blocks.
Each behavioural fix was checked by reverting its source file and confirming
the new tests fail without it.
* fix(dynamodb): accept and report Query key conditions the way AWS does
Three gaps in KeyConditionExpression validation.
A sort-key comparison with the value on the left, such as ":lo <= sk",
is valid on AWS and means "sk >= :lo". Floci rejected it because it only
looked for the attribute on the left. The operands are now normalised
before the key checks run.
A nested path on a key attribute now reports that it cannot carry a
condition, instead of the generic unsupported message.
A condition on a non-key attribute now reports the partition key it left
unconditioned, which is what AWS answers.
Closes 2 TIER 1 and 1 TIER 3 case in the dynamodb-conformance suite.
* fix(dynamodb): bound Segment and TotalSegments on Scan
A parallel Scan accepted a negative Segment. A TotalSegments of 0 was
rejected, but with the zero-based wording instead of the AWS constraint
wording. Both are now rejected with the AWS constraint wording, before
the required-parameter checks run. The TotalSegments upper bound from
#3287 moves into the same block, so several violations are reported in
one message.
Closes 1 TIER 3 case in the dynamodb-conformance suite.
* fix(dynamodb): report TotalSegments before Segment on Scan and test the lower bound
* feat(redshift): add RedshiftCredentialBroker for short-lived Db credentials
* refactor(rds-proxy): widen PasswordValidator to a three-value AuthResult
The wire-level password check the PostgreSQL/MySQL proxy handlers take now
returns REJECT / PASSTHROUGH / MASTER_EQUIVALENT instead of a boolean, so a
caller can tell the proxy to open the backend leg as the cluster master for a
client it has vouched for. RdsAuthProxy keeps its own boolean master-password
callback, renamed MasterPasswordCheck to free the PasswordValidator name, and
adapts it at the handler boundary (non-master stays PASSTHROUGH).
* feat(redshift): auth proxy accepts live GetClusterCredentials credentials
passwordValidatorFor now returns AuthResult and consults RedshiftCredentialBroker:
the master pair and any live minted credential resolve to MASTER_EQUIVALENT, a
known broker user with a stale password is REJECTed, everyone else PASSTHROUGH.
* feat(redshift): add default-credential-duration-seconds config
* feat(redshift): implement GetClusterCredentials action
Mints a short-lived DbUser/DbPassword pair via RedshiftCredentialBroker and
returns it as Query-protocol XML. AutoCreate prefixes IAM: on the DbUser,
DbGroups are echoed, DurationSeconds is validated to 900-3600 (default from
the new config key), and an unknown ClusterIdentifier propagates ClusterNotFound.
The two credential actions are registered in AwsQueryController.REDSHIFT_ACTIONS
and the Query dispatch now forwards the Authorization header to the handler.
* feat(redshift): implement GetClusterCredentialsWithIAM action
Derives the DbUser from the caller's IAM identity resolved via the Authorization
header: an IAM user maps to IAM:<name>, an assumed role to IAMR:<role>, and an
unresolvable caller to the IAMR:floci fallback with a WARN so local and CI flows
are not blocked. Any DbUser request parameter is ignored.
* feat(redshift-data): resolve non-master DbUser via GetClusterCredentials
resolveViaDbUser now accepts a DbUser that has a live credential in
RedshiftCredentialBroker, connecting to the container as the cluster master
(the minted DbUser is nominal). An unknown non-master DbUser still fails with
ValidationException.
* test(redshift): end-to-end GetClusterCredentials + Data API non-master DbUser
Docker-gated: mints a credential for a non-master DbUser via GetClusterCredentials
then runs SELECT 1 through the Data API as that DbUser, asserting the result.
* test(compat): SDK coverage for Redshift GetClusterCredentials
Adds getClusterCredentials and getClusterCredentialsWithIAM assertions to the
AWS SDK Redshift compatibility test.
* docs(redshift): document GetClusterCredentials and GetClusterCredentialsWithIAM
Regenerates the redshift.md action table (excluding the DbGroups member-name
switch label), fills the two new descriptions, updates the wire-auth and
redshift-data.md DbUser notes, and bumps the Service Matrix count to 23.
* fix(redshift): reject a wrong master password instead of passing it through
passwordValidatorFor only treated the master pair as MASTER_EQUIVALENT and let
everything else fall to the broker. A request with the master username but a
wrong password is unknown to the broker, so it classified as PASSTHROUGH; the
wire proxy then opened the backend leg as master (isMaster is username-only) and
the client authenticated with the wrong password. Now the master username is
decided on its own password: match to MASTER_EQUIVALENT, mismatch to REJECT.
* fix(redshift): reject proxy logins when the cluster row is gone; strip IAM user path
passwordValidatorFor fell through to the broker when the cluster was absent from
the account partition, classifying an unknown user as PASSTHROUGH; the wire proxy
reads isMaster from its own start-time config, so that still opened the backend
as master for the master username with any password. Return REJECT when there is
no cluster row to validate against.
RedshiftIamDbUserResolver now strips an IAM path prefix from a user ARN
(user/team/alice -> alice), matching how AWS names the DbUser.
* fix(redshift): keep concurrent credentials, revoke on delete, bound the config default
Addresses PR review (greptile):
- RedshiftCredentialBroker now holds every unexpired credential per DbUser instead
of one slot, so a reissue no longer invalidates a still-live password (matches
AWS, which keeps each issued credential valid to its own expiry).
- Add revokeCluster(); RedshiftService calls it on deleteCluster and at the start
of createCluster, so a cluster recreated with the same identifier does not
inherit master-equivalent access from a stale credential.
- resolveDurationSeconds now holds the YAML default to the same 900-3600 bounds as
a request value, falling back to 900 with a WARN instead of minting a credential
that is already expired or over-range.
* fix(redshift): revoke temp credentials on createCluster rollback too
The greptile review asked for revocation on 'relevant rollback paths'. Both
createCluster failure branches that delete the cluster row now also call
credentialBroker.revokeCluster, so a credential issued by a concurrent
GetClusterCredentials while the row briefly existed cannot outlive it.
* fix(redshift): correct GetClusterCredentials AutoCreate prefix
AWS prefixes the returned DbUser with IAM: when AutoCreate is false and
IAMA: when it is true. The handler returned IAM: when true and no prefix
when false, so a client using the returned name could not authenticate
and the value diverged from GetClusterCredentialsWithIAM, which already
issues prefixed identities.
The broker keys on the returned name, so the proxy and Data API now
expect the prefixed DbUser. Tests and the redshift docs are updated to
match.
* test(redshift): give compat GetClusterCredentials tests distinct @Order
Three methods shared @Order(2), leaving their relative order undefined.
Number the two credential tests 3 and 4 and move testDeleteCluster to 5.
CreateDBCluster with Engine aurora-mysql and an Aurora version such as
8.0.mysql_aurora.3.08.0 used the version literally as the container
image tag. Docker has no such tag, leading the pull to 404.
Take the MySQL version in front of the Aurora suffix, so that example
runs mysql:8.0. Plain mysql versions still map to their own tag.
The Go compatibility tests for the RDS Data API on aurora-mysql skip
when the cluster cannot be created, so this failure never showed in
CI. They now run with the mapping fixed.
performReset ran every Resettable.clear() first and storageFactory
.clearAll() last. Services that re-create bootstrap state in clear()
lost it again right away. IAM Identity Center is one: after a
/_floci/state/reset its bootstrap identity store was gone, so every
SCIM call answered 401 until a restart.
This is what broke ScimIntegrationTest in CI shard 3 since #3331.
EmulatorInfoControllerIntegrationTest runs in the same test
application before it and posts the reset endpoints.
Clear storage first, then let services clear and re-seed. The clear()
implementations that iterate state to stop timers or sockets read
in-memory maps, not storage, so the order change does not affect them.
* feat(firehose): validate and persist ProcessingConfiguration
A stream configured with a record transformation was accepted with a 200,
the member dropped by ignoreUnknown, and nothing echoed back. It is now
modelled, validated and stored, so a caller sees what it configured. The
transformation itself is not applied yet: records are still delivered
untransformed, and create and update say so in a warning.
The behavior follows what real AWS does, probed in us-west-2:
- A Lambda processor requires a LambdaArn, which must be a well-formed
function ARN, and BufferSizeInMBs and BufferIntervalInSeconds are
all-or-nothing.
- Processor types and parameter names are checked against AWS's enums,
reproducing the order those sets are printed in and the 1-based member
paths of the constraint messages.
- UpdateDestination replaces the whole block rather than merging it
member-wise, the opposite of DataFormatConversionConfiguration: an update
carrying only {"Enabled": false} leaves no processors behind, and an
update is validated against its own content.
- A stored Lambda processor gains NumberOfRetries 3 and the stream's
RoleArn, echoed in AWS's own parameter order.
Two checks AWS does not make are deliberately absent: NumberOfRetries is
not range-checked, accepted as 0 or 9 despite the documented 1 to 8, and the
function a LambdaArn names is not required to exist, unlike the Glue table a
conversion schema names.
* docs(firehose): record what AWS does with a null processor list member
Probed: real AWS answers InternalFailure for "Processors": [null] and for
"Parameters": [null], a fault of its own rather than a validation error.
Reproducing that helps nobody, so the entry stays ignored, which leaves the
configuration a caller would have had by omitting it, and the deviation is
written down instead. A test pins the choice so it reads as a decision.
The review also asked for a maximum of 3 on the processor list. Probing found
no such bound: three, four and five processors all pass validation and reach
the role check, so nothing is enforced here.
* fix(core): accept ARNs from every AWS partition
Now that ARNs are minted with the region's real partition, the code that reads
them back has to accept them, or Floci emits names it then refuses. Fifteen
sites across eleven services anchored a pattern, a prefix check or a store scan
on a literal arn:aws:.
Two shapes, and the second is the serious one.
Client-supplied ARNs that were rejected as malformed: the KMS key-ARN branch in
resolveKey, the four service probes in ResourceArnBuilder, DynamoDB's
TagResource validation, and SsoAdminService, which now takes the model's
ManagedPolicyArn pattern. That fixes the pinned partition and tightens a .+ tail
that accepted policy names AWS rejects, while still refusing customer-managed
policies, which is correct for that operation.
Values written partition-aware and read back with a literal. These are not
rejections of foreign input, they are the emulator failing to find its own
resources, so in GovCloud or China they are live functional breaks:
- ListStateMachines and ListActivities returned empty. Step Functions is the
only service keying its stores by the full ARN, so its list prefix has to
carry the partition. The prefix deliberately stops before the account
segment, because the store holds more than one account.
- SQS DLQ redrive stopped silently. queueUrlFromArn resolved a
deadLetterTargetArn read back from GetQueueAttributes to null, the move
block was skipped, and nothing was logged.
- An EventBridge bus ARN was taken as a literal bus name, so DescribeEventBus
reported not-found for a bus it had just created.
- A Secrets Manager partial ARN, which AWS lets clients write without the
random suffix, resolved to nothing.
- An ECS task could not read its own configuration: a Secrets Manager
valueFrom fell through to the SSM branch and a parameter ARN was passed
along whole as a parameter name, killing the task at launch.
- AppSync IAM authorisation built its policy resource with a pinned
partition, so a policy naming its own API never matched and the request was
denied.
The IAM trust-policy path failed the same way and needed the regex and the
construction changed together: resolving an STS assumed-role ARN back to its
IAM role rebuilt the role ARN with a hardcoded partition, so widening the
pattern alone would have denied AssumeRole to a caller who is entitled.
Two spellings are deliberate rather than an oversight. EventBridge matches an
ARN prefix instead of a whole ARN, so a truncated arn:aws:events: is still
reported as malformed rather than taken as a bus name. Secrets Manager reads
the name off the parsed resource without splitting it again, because a secret
name may contain colons.
API Gateway is not a widening. ACTION_URI_PATTERN and PATH_URI_PATTERN were
declared and referenced nowhere, so the real gate was a startsWith inside
parseIntegrationUri. The dead patterns are removed and the guard fixed.
Left alone, and not fixable here: IAM SAML providers and the SSO instance ARN
build a region-less arn:aws: ARN by concatenation, store under it, then look it
up by the string given. Widening those turns one miss into a different miss.
They need a deployment-level partition, which nothing in a request supplies.
The Amazon States Language service-integration ids are arn:aws:states::: in
every partition and stay as they are.
Each behavioural fix was checked by reverting its source file and confirming
the new tests fail without it.
* chore(stepfunctions): drop the duplicate AwsArnUtils import
StepFunctionsService imported AwsArnUtils twice. The duplicate arrived with
#2485 and javac accepts it silently, so nothing surfaced it until this branch
added an AwsRegions import above it and a diff view made it look new.
It is the only duplicate import in src/main/java, so there is nothing else of
this shape to sweep up.
Adds CreateDataCatalog, UpdateDataCatalog and DeleteDataCatalog to the Athena
JSON 1.1 handler, backed by a data-catalogs.json store obtained through
StorageFactory. Catalogs accept the four modelled types (LAMBDA, GLUE, HIVE,
FEDERATED) and a FEDERATED catalog reports the ConnectionType carried in its
connection-type parameter.
TagResource and UntagResource are new, and ListTagsForResource now also serves a
datacatalog ARN. Tags live on the record they belong to, so a workgroup keeps
storing its own tags exactly as before.
The built-in AwsDataCatalog keeps the shape it had: it is still listed first and
still resolves as a GLUE catalog, and it is reserved against create, update,
delete and tagging the way the primary workgroup already is.
* feat(verifiedpermissions): add full service emulation
* fix(verifiedpermissions): harden OIDC and schema validation
* test(verifiedpermissions): add service layer coverage
* fix(verifiedpermissions): support native Cedar runtime
* fix(verifiedpermissions): package Cedar native FFI
* fix(verifiedpermissions): register Cedar deserializers for native
* fix(verifiedpermissions): bound JWKS refreshes
* fix(verifiedpermissions): avoid Cedar entity reflection
* fix(verifiedpermissions): register Cedar native reflection
* fix(verifiedpermissions): refresh rotated OIDC keys safely
* fix(verifiedpermissions): retry failed JWKS refreshes
* refactor(verifiedpermissions): isolate Cedar in sidecar
* fix(verifiedpermissions): harden Cedar sidecar runtime
* fix(verifiedpermissions): build cedar sidecar in compatibility CI
* fix(verifiedpermissions): remove stale cedar jni config
* fix(verifiedpermissions): recover cedar sidecar
* fix(verifiedpermissions): bound OIDC document responses
* fix(verifiedpermissions): start cedar sidecar in native sdk CI
* fix(acm): stop hex-shaped names becoming bogus IP address SANs
The SAN type check matched any string of hex digits and colons, which is far
looser than an address. Two things followed, both silent.
A label like 1234 or 0 matched, and InetAddress.getByName decoded it rather than
failing: 1234 became 0.0.4.210. The certificate carried an address nobody asked
for, and the name the caller wanted covered was not in the certificate at all.
Worse, a colon-free label was handed to the resolver, so certificate generation
performed a blocking name-service lookup. If the name happened to resolve, the
resolved address was written as an iPAddress SAN in place of the literal name.
Detection is now a range-checked dotted quad, plus a colon test for IPv6
literals. A colon cannot appear in a hostname, so a colon-bearing value is parsed
as a literal or rejected outright, never looked up. Only values already known to
be literals reach the resolver, which is what keeps generation off the network.
The DNS-name fallback stays. With detection this tight only a malformed IPv6
literal can reach it, and covering the name is the safer failure: dropping it
would stop the server serving that host with nothing to point at, whereas an
unmatched dNSName entry is simply ignored by clients.
Tests cover what was silently wrong: hex-shaped labels stay DNS names, an octet
above 255 is not an address, a malformed IPv6 literal is still covered, and no
colon-free label is ever treated as an address.
* fix(acm): stop a colon-bearing hostname reaching the resolver
The SAN type check treated any value containing a colon as an IPv6 literal, on
the reasoning that a hostname cannot contain one. The JDK does not agree, and
the value was still handed to InetAddress.getByName.
getAllByName only attempts a literal parse when the FIRST character is an ASCII
hex digit or a colon; everything else it resolves. So z:1 has a colon, is not
literal-shaped, and is looked up. Measured on JDK 25: getByName("z:1") takes
tens of milliseconds and fails with the resolver's "nodename nor servname
provided", while getByName("fffff::1") fails in under a millisecond with
"invalid IPv6 address literal". Only the second never left the JVM.
That is the same bug this branch set out to fix, reopened for a narrower shape,
and the method's own javadoc asserted the opposite. Detection now matches the
JDK's dispatch: a colon AND a literal-shaped first character.
Both halves are load-bearing. Inside the JDK's literal branch a failed IPv6
parse only throws when the value contains a colon; without one it falls through
to a lookup. Neither condition alone fails closed.
The leading-character test is spelled out rather than delegated to
Character.digit(c, 16). IPAddressUtil.digit resolves to an ASCII-only parser
unless jdk.net.allowAmbiguousIPAddressLiterals is set, and its own comment gives
the set as [0-9,A-F,a-f], but Character.digit answers 1 for the Arabic-Indic
digit one. The convenient spelling would classify U+0661 followed by a colon as
a literal, hand it to the resolver, and have the JDK decline to parse it and
look it up. Being stricter than the JDK is safe in both directions: if that
property is ever set, this only routes the value to the dNSName fallback.
Tests cover both shapes and were mutation-checked: restoring the colon-anywhere
rule fails the z:1 cases, and switching to Character.digit fails the non-ASCII
digit case.
Reported by pgermosen in review, including the observation that the malformed
IPv6 literal the existing tests cover is genuinely safe.
EmulatorInfoController.performReset() runs every Resettable.clear() (which
re-seeds SsoAdminService's default d-9067f2a3c1 instance) before calling
StorageFactory.clearAll(), which wipes the `instances` backend again right
after. Once any test in the same JVM fork hits /state/reset or /state/nuke,
the default identity store never comes back, so every later SCIM request's
hasIdentityStore check 401s for the rest of that fork — this is why
ScimIntegrationTest passes in isolation but fails in the full suite (#3386).
hasIdentityStore now self-heals the same way listInstances() already does,
by ensuring the bootstrap instance exists before checking.
* fix: isolate MSK clusters by region
* fix(msk): scope broker resources by account and region
* fix(msk): preserve legacy cluster data during identity migration
* fix(msk): restrict legacy storage fallback to old clusters
* ci: retrigger PR checks after unrelated test flake
* fix(kms): report SM2 as region unsupported
* fix(kms): support SM2 in China regions
* fix(kms): enable SM2 signing in China regions
* fix(kms): restrict SM2 to China regions
* fix(kms): accept the SM2DSA wire algorithm
* test(kms): cover SM2 signing validation errors
* fix(lambda): stop rejecting a foreign-platform image the daemon cannot describe
Docker 29 makes the containerd image store its default, and there an image
inspect answers for the index rather than the variant that will run: an empty Os
and Architecture while no other variant of the tag is local, and the host's
variant once one is. ImageCacheService compared that answer with the requested
platform and threw, so every container started for another architecture failed
with "Docker image does not match requested platform" even though the pull had
selected the right variant.
Drop that comparison. The daemon enforces the platform where it counts, choosing
the variant to pull and the variant to create the container from, so resolving
the reference only has to hand back an id.
The integration test verified the platform through the same inspect, so it now
runs the container and reads uname -m, falling back to inspect where the host
cannot run another architecture.
* test(docker): fall back to inspect when the foreign-platform container never reports
awaitStatusCode throws when its timeout expires, so a container that starts but
hangs failed the test instead of reaching the inspect fallback the method
documents. The wait now treats a failure the same way it treats a nonzero exit.
Reading the logs is diagnostic on that path, so it reports a failed read in the
text it returns rather than throwing, as the sibling Docker tests already do.
* feat(firehose): convert JSON records to Parquet via the floci-duck sidecar
Deliver data-format-converting streams for real: each flushed record is
parsed and type-checked in Java against the stream's Glue table schema
(per-record ParseError/MalformedData routing with AWS's probed message
shapes), valid rows are staged as normalized NDJSON and written to the
destination as Parquet by DuckDB's COPY, and failed records go to the
evaluated ErrorOutputPrefix as AWS-shaped NDJSON error lines. Batch-level
failures (missing Glue table, unsupported schema, sidecar errors) route
every record to the error output instead of dropping them. Adds the
floci.services.firehose.staging-bucket setting and replaces the
PR-1-era unconverted-delivery warning.
* fix(firehose): deliver a scheduled flush as the stream's own account
A scheduled flush runs on the flusher thread, where no request context is
active, so the Glue lookup, the staging writes, the destination writes and
the sidecar all resolved the default account instead of the stream's owner.
A stream owned by another account had its Glue table missed and its objects
written to the wrong partition. The delivery now runs under RequestScopes,
which the CUR scheduler already uses for the same reason, so every store the
delivery touches agrees on the owner. The unconverted path gets this too.
Cleanup failures in the compatibility test are logged rather than swallowed,
per the repository rule on tolerated exceptions.
* fix(firehose): cap the staging buffer size hints
rows.size() * 128 overflows an int at about 16.7 million records, so a batch
of many small records failed before writing any of them, and short of that it
asked for a multi-gigabyte array. Both hints are computed as a long and capped
at 8 MiB; the streams grow as needed, so this only affects the first
allocation.
* docs(firehose): state what a failed error-output write actually guarantees
The comment claimed a failure of the error-output write leaves the converted
rows in the staging bucket, but the enclosing finally removes the staged object
however the method exits, and the Parquet bytes are read into memory before
either destination write, so nothing is retained to recover from. What holds is
that nothing is delivered and the flush fails as a whole, which is what it says
now, along with where recovery does live: the source, which a Kinesis-backed
stream has and a DirectPut buffer does not.
The reverse ordering is documented rather than claimed away: the two
destination writes are not atomic, so an error object can land and the Parquet
write then fail, reporting the failed records while the converted ones are
gone.
* fix(cloudfront): report Logging on distribution reads
GetDistribution and GetDistributionConfig omitted the Logging member of
DistributionConfig. It is "Required: No" on input, but CloudFront reports it on
every response with its defaults, and callers read it unconditionally: the AWS
SDKs and the Terraform provider both expect the element to be present.
Report it with the defaults CloudFront uses, a disabled configuration with an
empty bucket and prefix, and echo an explicitly supplied one back in full. The
model already carried the field; it was simply never written to the response.
Restrictions and OriginGroups had the same gap and are already handled, so only
Logging is added here.
Reference: the DistributionConfig members and their types
https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_DistributionConfig.html
* fix(cloudfront): parse the Logging block on distribution writes
Reads report Logging, but parseDistributionConfig never read it from the
request body, so CreateDistribution and UpdateDistribution dropped an
explicit block and the caller read the disabled defaults back. That is the
drift aws_cloudfront_distribution sees on logging_config: it sends a
configuration and gets defaults.
parseLogging follows parseGeoRestriction, extracting Enabled,
IncludeCookies, Bucket and Prefix. An absent block yields an empty map,
which xmlLogging still renders as today's disabled defaults.
The existing coverage built the model in Java and inserted it through
CloudFrontService, so it passed with the parser missing. The new tests POST
and PUT a DistributionConfig body over HTTP and read it back, which is what
puts the parser under test.
* test(cloudfront): take CloudFrontService through the constructor
AGENTS.md asks for constructor injection and this test used an @Inject field.
I had argued against changing it on the grounds that a @QuarkusTest cannot take
constructor injection, since JUnit 5 needs a registered ParameterResolver and I
believed Quarkus does not supply one for CDI beans. That is wrong. A probe with a
constructor taking CloudFrontService compiles and passes, so the 0-of-736 count in
this repo reflects habit rather than a constraint.
209 CloudFront tests still pass.
NAME_PATTERN allowed a dot and MAX_NAME_LENGTH capped a bare name at 256
characters, both more permissive than the live service, which uses
[a-zA-Z0-9-_]+ and a 64-character ceiling for a name-only FunctionName.
Added boundary tests at the 140-character full-input limit for both the
partial-ARN and full-ARN forms.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* Fix#3238
AwsArnUtils.Arn.of hardcoded the "aws" partition, so every ARN the emulator
minted for a GovCloud or China region named the wrong partition. Correctness
here was not a property of the call site: all 115 Arn.of callers and the 132
that reach it through RegionResolver.buildArn were equally wrong, including the
ones following the documented pattern.
AwsRegions gains partitionFor and dnsSuffixFor, with the region patterns
transcribed from botocore's partitions.json regionRegex values so they stay
comparable against it. Only the non-commercial partitions need a rule; an
unrecognised region resolves to "aws", which is what the SDKs do and keeps a
region AWS launches tomorrow working rather than failing closed.
EksTokenMinter carried the same table for STS hostnames and now delegates to
it, so a partition cannot go missing from one and not the other.
Global services pass an empty region and keep "aws". That gap is documented on
Arn.of rather than closed: an IAM ARN in a GovCloud deployment really is
arn:aws-us-gov:iam::..., but nothing in the region argument can say so, and
those call sites need a partition from the deployment instead.
AwsArnUtils is referenced from 120 files and had no test of its own, so this
adds one, written against the previous behaviour before the change and covering
the resource field's colon handling that the callers depend on.
No test in src/test or compatibility-tests constructs an ARN from a
non-commercial region: the six that mention one are parsing a hostname or
validating a supplied ARN. The emitted ARNs are therefore unchanged for the
whole suite.
The sibling Azure emulator lost TLS startup on Windows: a path such as
D:\Dev\floci\data\tls\cert.crt reached the HTTP server as
D:Devflocidatatlscert.crt and died with NoSuchFileException. That is not general
SmallRye behaviour, which is what makes it easy to reintroduce. Expression
handling leaves a value with no '$' untouched and deliberately compiles without
escape processing; the damage comes from StringUtil.split, reached only by the
converter for collection-typed properties, which consumes every backslash.
So the property's declared type is the entire defence. This emitter is safe today
only because it writes quarkus.tls.key-store.pem.0.cert, a scalar Path. The key it
wrote before the TLS registry migration, quarkus.http.ssl.certificate.files, is an
Optional<List<Path>> and is mangled. Nothing recorded that distinction, so moving
back to a plural key would silently break Windows again.
Adds tests that assert a Windows-shaped path round-trips through a scalar
property, demonstrate the mangling on the collection path so the reasoning is
evidence rather than assertion, and fail if the collection-typed keys are ever
emitted again.
Also hoists the internal HTTP and HTTPS port literals into constants on
TlsConfigSource. TlsProxyServer routes to those ports and had its own independent
copies, so the two could drift apart silently.
CloudFront, Route 53 and S3 each stood up a private XMLInputFactory and each
restated the same three hardening properties: namespace-aware, DTDs off, external
entities off. XmlParser already had a fourth copy. Four copies of
security-relevant configuration is three too many, and a copy that one day forgets
a property is an XXE hole with nothing to catch it.
XmlParser gains newStreamReader, exposing the factory it already holds, for
callers whose parsing goes past the extraction helpers because they read
attributes. The three controllers drop their own factories and their ten call
sites go through it.
Behaviour is unchanged by construction: the four factories were byte-identical
before this, same properties and same values, so no test needed touching. That
was the check, not an afterthought.
Tests pin what is being centralised, which nothing covered before. Worth
recording what they found: SUPPORT_DTD=false does not reject a document type
declaration, it silently skips it. The protection is that nothing declared inside
takes effect, so an entity referenced from it fails as undeclared rather than
expanding, and an external one is never read. The tests assert that behaviour
rather than the refusal I first assumed.
* refactor(cloudformation): move the Batch types into a per-service provisioner
AWS::Batch::ComputeEnvironment, JobQueue and JobDefinition move out of the
legacy monolith into BatchCfnProvisioner, continuing the decomposition. The
three provisioning methods and the three helpers only they called
(computeEnvironmentOrder, containerProperties, retryStrategy) move across
unchanged; the generic property helpers they leaned on have other callers and
stay behind, re-expressed here against ProvisionContext, which already offers
resolveOptional, generatePhysicalName and resolveTags.
Behaviour preserving: same request shapes, same physical ids, same Fn::GetAtt
attributes. The defects these arms carry (nothing is deleted on stack delete,
updates re-create rather than update, Priority is defaulted although the schema
requires it) are left exactly as they were and are fixed in the commits that
follow, so this move stays reviewable on its own.
BatchService was the monolith's only remaining use of the field, so the field,
its constructor parameter and its import go too. Batch is absent from
DELETE_NEEDS_STACK_RESOURCE, so that set is untouched.
The inventory rows move from LEGACY_SWITCH to BatchCfnProvisioner and the test
fixture gains the inferred wiring; without the latter a fixture test naming
Batch would fall through to the stub arm and pass on a fake id. docs-sync
reports the generated table already current, and the schema-coverage gate finds
no new attribute gaps: each type's only top-level read-only property is its ARN,
which was already set.
Monolith 6,457 to 6,292 lines, legacy types 47 to 44.
* fix(cloudformation): delete Batch resources when their stack is deleted
The legacy switch had no AWS::Batch arm in any of its delete paths, so deleting
a stack left the compute environment, job queue and job definition behind. The
stack reported DELETE_COMPLETE over resources that were still there, and a
re-created stack then failed on the names it had supposedly released.
Batch refuses to remove a running entity, as AWS does: DeleteJobQueue rejects an
ENABLED queue, and DeleteComputeEnvironment rejects one that is not DISABLED or
is still referenced by a queue. So each delete disables first and then removes,
which is what the real resource handlers do. CloudFormation already tears down
in reverse dependency order, so a queue is gone before the environment it
points at. A job definition is deregistered, which is AWS's own semantic for
that type: the revision goes INACTIVE rather than disappearing.
Deliberately not CfnDeletes.safeDelete. Every BatchService failure carries the
same ClientException code, so tolerating it would be the catch-all AGENTS.md
rules out: a genuine refusal such as "still associated with a job queue" would
be swallowed into a green stack delete instead of surfacing as DELETE_FAILED.
Already-gone is handled by looking first instead, which also keeps the disable
step from throwing on a resource removed out of band, and makes a repeated
delete idempotent. That check matters most for the job definition, the one call
of the three that throws when its target is missing.
Nine unit tests cover the ordering, the idempotent repeat, and that a refused
delete propagates rather than being swallowed.
* fix(cloudformation): update Batch resources in place instead of re-creating them
provision runs again on every UpdateStack, and the legacy switch always created.
That broke both ways. A named compute environment or job queue called create a
second time under the same name, and createComputeEnvironment and createJobQueue
both reject a duplicate, so the stack update failed. An unnamed one generated a
fresh random name each time, creating a second entity and orphaning the first.
An update that keeps the name now goes through UpdateComputeEnvironment or
UpdateJobQueue, the schemas' update handlers, and keeps the prior physical id.
Only the properties those handlers accept are pushed through: the names, Type
and JobQueueType are createOnly, so a change there is a replacement the engine
drives rather than something to force into an update. A job definition needs no
update branch, because RegisterJobDefinition on an existing name records a new
revision, which is exactly how AWS updates one.
The name is kept steady by reading the attribute recorded at create time, the
way SqsCfnProvisioner reads QueueName beside the queue URL. ProvisionContext's
stablePhysicalName and reusesPriorEntity do not fit here: both fall back to the
prior physical id, which for Batch is an ARN rather than a name, so they would
feed an ARN back in as a name. Their javadoc says as much. For a stack created
before that attribute was recorded, the name is recovered from the prior ARN so
those stacks update in place too rather than duplicating.
Six more unit tests: in-place update for both types, a rename creating instead
of updating, an unnamed resource keeping its generated name, the ARN fallback,
and a job definition re-registering under the same name.
* fix(cloudformation): enforce the Batch schemas' required properties
Three properties the registry schemas mark required were optional here, so a
template missing one applied cleanly against floci and then failed on AWS, which
is the divergence the emulator exists to prevent.
AWS::Batch::JobQueue requires Priority; the switch substituted 1, so the
service's own "priority is required" check could never fire. ComputeEnvironment
and JobDefinition both require Type; an absent one reached the service as a null
and JobDefinition additionally defaulted to "container". All three now fail the
resource with the repo's ValidationError wording, matching how
Ec2NetworkCfnProvisioner reports a missing required property.
Also drops the Revision attribute from AWS::Batch::JobDefinition. Revision is
not a property of that type in the registry schema, and the legacy resource
spec gives the type no attributes at all, so Fn::GetAtt on it fails on AWS.
Offering it let a template pass here and break there. Nothing in the repo reads
it. The physical id stays the job definition ARN despite the schema's
primaryIdentifier naming JobDefinitionName, because the legacy spec and the
type's documented Ref both point at the ARN; changing it would be visible to
existing templates on evidence that does not agree with itself.
The integration test now covers the two stack-level defects end to end: an
update that changes only updatable properties keeps both physical ids and moves
the queue's priority, and a stack delete leaves neither entity behind. Both
assertions fail without the preceding two commits.
* fix(cloudformation): clean up the Batch entity a replacing update displaces
Renaming a compute environment or job queue creates the replacement and leaves the
original live in Batch forever. The provisioner recorded nothing, so the engine was
never told a replacement had happened: no DELETE_IN_PROGRESS event, no cleanup phase,
and nothing to delete the displaced entity even under the default UpdateReplacePolicy.
Wired to the shared ReplacementCleanup the way CloudFrontCfnProvisioner does it rather
than re-derived: attributesBefore is copied as the first statement of provision, and
record runs at the end of each arm once the new physical id is assigned, which is what
lets it compare the prior id against the new one. The four hooks delegate straight
through. An in-place update keeps the prior ARN, so it records nothing and stays
outside the cleanup path.
AWS::Batch::JobDefinition is deliberately not wired the same way. The registry schema
gives it primaryIdentifier JobDefinitionName, not the ARN, and registering revision 2
does not retire revision 1 on AWS: the prior revision stays ACTIVE and a running job
may still name it. Every registration mints a new ARN, so treating a changed physical
id as a replacement here would have the cleanup deregister a live revision. Only a
changed name replaces the definition, and that decision is taken before the register
call overwrites the recorded name, since the check reads that attribute.
Five unit tests: a renamed environment recording its predecessor, completeUpdate
actually deleting it, an in-place update owing nothing, a revision bump owing nothing,
and a renamed definition owing its predecessor. Mutation checked by dropping the record
call, which fails the first two and nothing else.
* fix(cloudformation): restore an in-place Batch update when the stack rolls back
An in-place compute environment or job queue update committed and then could not be
undone. Without a rollbackUpdate hook the resource fell to "Rollback is not implemented
for AWS::Batch::JobQueue", which is not a quiet gap: CloudFormationService adds it to
the rollback failures, so the whole stack reports UPDATE_ROLLBACK_FAILED and the
committed template is not restored either. A stack whose Batch resource sat anywhere
ahead of the failing one could not roll back at all.
Snapshot the entity before the update call and put it back, following
LambdaEventInvokeConfigCfnProvisioner: replacement first through the cleanup record,
then the snapshot for the in-place case. The describe is the only source, because the
template holds the desired state rather than the current one. The snapshot is spent
only once the restore succeeded, so a restore that throws leaves it for the next
attempt instead of reporting a rollback that never happened, and a resource this update
never touched carries none and answers false rather than claiming one.
Simpler than the Events rule this pattern comes from: each Batch update is a single
service call, so a throw leaves nothing half-applied and no in-provision restore arm is
needed. A job definition instead names the revision the failed update registered, which
is deregistered on rollback while the resource points at the prior one again.
Snapshotting is best effort. An entity the describe cannot find leaves none, and
rollbackUpdate then answers false rather than restoring a guess; failing the update
there would break a working update over missing rollback insurance.
The integration test is the one that proves the hook is reached: a stack whose later
resource cannot provision now reaches UPDATE_ROLLBACK_COMPLETE with the queue back on
its original priority. Reverting rollbackUpdate puts it back to
UPDATE_ROLLBACK_FAILED, reason "The following resource(s) failed to roll back:
[Queue, Compute]".
* fix(cloudformation): reject a Batch job queue Priority that is not a valid integer
Priority reached Integer.parseInt unguarded on both the create and the update path, so
a template carrying "high", or a Ref resolving to something that is not a number, threw
NumberFormatException out of the provisioner. The stack surfaced that as a 500 rather
than the failed validation it is, while every other bad property in this class raises
ValidationError with a 400.
Parsed through a helper that raises the same ValidationError instead, and bounded while
there: the registry schema types AWS::Batch::JobQueue Priority as integer with minimum 0
and maximum 1000, so a value outside that is as invalid as a non-numeric one and AWS
rejects both. This is the same schema-sourced enforcement the required-properties commit
already applies, reaching the one property it left parsing unchecked.
Three unit tests: a non-numeric value on create, the same on the update path, and an
out-of-range one. Mutation checked by restoring Integer.parseInt, which fails all three
and nothing else.
* docs(cloudformation): say why the Batch deletes cannot use CfnDeletes.safeDelete
The javadoc already said safeDelete was deliberate, but not enough to stop the question
being asked again: it read as a limitation of BatchService rather than of the API.
It is the API. Batch declares exactly two errors on DeleteComputeEnvironment,
DeleteJobQueue and DeregisterJobDefinition, ClientException at 400 and ServerException
at 500, and no not-found code anywhere in the service model. safeDelete takes the
specific already-gone code by design, so there is none here to pass it. Tolerating
ClientException instead would be the catch-all AGENTS.md rules out, swallowing a real
refusal such as "Cannot delete compute environment still associated with a job queue"
into a green stack delete. Giving Batch a Floci-only not-found code to satisfy the
pattern would put a code on the wire AWS never sends, which is the wire contract this
emulator exists to keep.
Also names EcsCfnProvisioner, which does tolerate a blanket ClientException for its
task-definition arm, so the divergence reads as deliberate rather than as an oversight.
Comments only. No behaviour change, so the existing tests are what prove it inert.
* docs(cloudformation): record what a Batch rollback cannot undo
A compute-environment rollback restores every value the environment already
carried and cannot remove one the failed update introduced. The snapshot holds
what the describe returned, so a serviceRole or computeResources key that was
absent beforehand is absent from the snapshot, the restore call omits it, and
UpdateComputeEnvironment leaves an omitted field alone while merging
computeResources rather than replacing it. The value survives a rollback the
stack reports as successful.
That cannot be closed here. UpdateComputeEnvironment is the only way to put the
environment back and its request shape has no removal: every member other than
computeEnvironment is an optional set-value, and the partial-merge semantics are
AWS's own. So this is disclosed on rollbackUpdate and pinned by a test, the way
CognitoCfnProvisioner records its own in-place rollback limitation, rather than
worked around.
Job queues are not affected. updateJobQueue assigns computeEnvironmentOrder
wholesale rather than merging it, and state and priority are always present, so
that restore is exact.
The test asserts the surviving value rather than only that the rollback returned
true, so it goes red if the merge semantics ever change without this note
changing with them. Mutation-checked: making the restore send an empty
serviceRole fails it.
A Fail state now resolves Error and Cause dynamically from ErrorPath and
CausePath, evaluated against the state input through the same JSONPath
resolver a payload template field uses. CreateStateMachine now also rejects
a Fail state that declares both Error and ErrorPath, or both Cause and
CausePath, as AWS does, and rejects a non-string ErrorPath/CausePath value
at definition time rather than letting it reach execution and fail with
States.Runtime.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* Fix#3255
* feat(cloudwatch): provision AWS::CloudWatch::Dashboard
The dashboard name is the physical id, generated when the template gives none
and kept across updates. An update with the same name puts the body again and
drives the tags to the template's set, since PutDashboard leaves an existing
dashboard's tags alone. A changed name creates the new dashboard and leaves
the displaced one to the ReplacementCleanup record, which deletes it once the
update commits or restores it on rollback. The body may be written as a JSON
object in the template and is stored as the string the API takes.
The CloudWatch docs now list the dashboard and tag actions the handlers
already serve.
* fix(cloudwatch): roll back in-place dashboard updates and replace a dashboard whose explicit name is dropped
An in-place update keeps the body and tags it replaces on the resource, or
the fact that the dashboard did not exist, and a failed stack update puts
them back in full. The name mode is recorded as the Logs provisioner does, so
a template that drops an explicit DashboardName gets a generated name and a
replacement, as on AWS, while an unnamed dashboard keeps its generated name.
The Tags list is checked against the schema's cap of 50 on every provision,
since the tag operations an update reconciles through do not enforce it. The
integration test reads stack events with XmlParser.
* fix(cloudwatch): keep the dashboard rollback snapshot until the restore succeeds
A restore that throws left no snapshot behind, so the next rollback attempt
reported success without restoring anything. The snapshot is now spent only
after the body and tags are back.
* fix(cloudwatch): unwind a dashboard update that failed after it changed the body
An in-place update puts the body and then reconciles the tags. When the tag
calls failed, the exception left the dashboard carrying the new body while
CloudFormationService put the resource the stack held before the attempt back
in its place. That object never carried the snapshot taken by the attempt, so
the walker marked it restored and skipped rollbackUpdate: the stack reported a
completed rollback over a dashboard that still had the update's body, or a half
reconciled set of tags.
The mutating calls now unwind themselves through rollbackUpdate, the way
IotDomainConfigurationCfnProvisioner unwinds a replacement, and report the
resource restored. An unwind that cannot put the body back keeps the snapshot
and records the failure on the resource, so the stack ends in
UPDATE_ROLLBACK_FAILED rather than claiming the prior dashboard is intact, and
the original failure is still what the stack reports.
Tests: anInPlaceUpdateThatFailedOnItsTagsPutsTheBodyBack,
anUnwoundInPlaceUpdateIsMarkedRestored,
anUnwindThatCannotRestoreIsReportedAsARollbackFailure.
* fix(cloudwatch): record a dashboard unwind failure before joining it to the update failure
The unwind repeats the tag call the update just made, so a service that
keeps failing hands the unwind the very exception that interrupted the
update. Throwable.addSuppressed rejects a throwable suppressed under
itself, and that IllegalArgumentException escaped the unwind before the
rollback failure was recorded: the dispatcher reported "Self-suppression
not permitted" as the resource failure, no failure attribute reached the
stored resource, and the stack ended UPDATE_ROLLBACK_COMPLETE over a
dashboard whose tags were never put back.
The failure attribute is now written first and the two exceptions are
joined only when they differ, as PipesCfnProvisioner does. Two stack-level
tests drive the whole path through CloudFormationService with a spied
CloudWatchDashboardsService, the way CloudFormationPipesCleanupIntegrationTest
does: a one-off tag failure ends in UPDATE_ROLLBACK_COMPLETE with the prior
body and tags live, a persistent one in UPDATE_ROLLBACK_FAILED naming the
dashboard and carrying the unwind's reason.
Tests: anUnwindThatFailsWithTheUpdatesOwnExceptionIsStillRecorded,
anUpdateThatFailedOnItsTagsPutsTheDashboardBackAndTheStackRollsBackCleanly,
aFailedRestoreLeavesTheStackInUpdateRollbackFailedNamingTheDashboard.
* feat(ec2): answer MonitorInstances and UnmonitorInstances
Both actions returned UnsupportedOperation. Detailed monitoring is a CloudWatch
billing switch with no behaviour an emulator can meaningfully model, which is
presumably why it was left out -- but declining the call is more costly than
answering it, because one unsupported action fails an entire deployment regardless
of how much of the rest of it succeeded. An aws_instance declared with
monitoring = true
calls MonitorInstances immediately after RunInstances, so the whole configuration
is discarded over a flag with no state behind it.
Acknowledge the requested state and echo every instance the caller named. Nothing
is stored: there is no monitoring data to serve, and DescribeInstances does not
report a monitoring state today, so persisting one would only create a second
place for it to be wrong.
Reference: the MonitorInstances response shape -- instancesSet of
InstanceMonitoring, each with instanceId and monitoring.state, plus requestId --
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_MonitorInstances.htmlhttps://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_UnmonitorInstances.html
One deliberate deviation: AWS reports state "pending" because the change is applied
asynchronously, then settles on "enabled". The emulator has nothing to settle, so it
reports the terminal state directly. Reporting "pending" for a transition that would
never complete would be worse for any client that polls.
* fix(ec2): reject monitoring for an instance that does not exist, and store the state
Two problems, both of which made the action answer confidently about something it
had not done.
The handler echoed every InstanceId back with a 200 without resolving it, and did
not even take a region to resolve it with. Naming an instance that does not exist
got a success response saying its monitoring was enabled. Every other instance
operation raises InvalidInstanceID.NotFound; this now does too, by delegating to
the service and resolving each id through getRequiredInstance, which is the same
shape stopInstances and the rest already use.
The state was also never stored. Instance already carries a monitoring member and
DescribeInstances already emits it, so MonitorInstances reported "enabled" while
every subsequent read still said "disabled". The state now persists, so the round
trip agrees with itself.
The previous tests asserted the old behaviour: they passed a made-up instance id and
expected 200. They are rewritten to launch a real instance, and two cases are added
for the not-found path plus one that reads the state back through DescribeInstances.
* test(ec2): name the monitoring suite for what it is, an integration test
It is a @QuarkusTest driving the HTTP endpoint, and the repository's dominant
convention for those is *IntegrationTest: 607 of the 736 @QuarkusTest classes on
main follow it. Renaming rather than arguing, since the evidence here points at
the convention.
* test(ec2): cover monitoring through the SDK path, not only the Query wire
AGENTS.md asks for management APIs to be validated with SDK clients and "not only
handcrafted HTTP requests". The Java test drives the Query endpoint with RestAssured,
which is right for pinning exact XML but does not exercise the path aws_instance
actually takes: monitoring = true calls MonitorInstances through the SDK, which parses
the response rather than reading whatever XML we happen to emit.
Three cases in the awscli suite, which is where EC2 SDK coverage already lives:
enable and read back through DescribeInstances, disable and read back, and reject an
instance that does not exist. The read-backs are the point rather than padding: the
bug this guards against was the handler answering "enabled" while every later read
still said "disabled", which asserting on the mutating call's own response cannot see.
Verified as far as this machine allows. run-instances, the teardown and the harness
plumbing all work against a local emulator; the three assertions themselves cannot
pass here because the released 2.0.1 image predates MonitorInstances, which is the
gap this PR closes. They run against the branch build in CI.