* fix(s3): refuse a canned ACL sent together with grant headers
PutBucketAcl, PutObjectAcl, PutObject, CopyObject and CreateMultipartUpload now answer 400 InvalidRequest, as S3 does, when x-amz-acl and any x-amz-grant-* header are both set, instead of applying the canned ACL and dropping the grants. The check moves from CreateBucket into the shared ACL header resolver so every operation is covered; blank values still count as absent.
Fixes#5826
* docs(s3): note that a canned ACL and grant headers are refused together
* refactor(s3): share the grant-header check and test header list
Compute one hasGrants flag in resolveObjectAclXml for both the canned-ACL refusal and the no-ACL fallback, and list the five grant headers once in a @MethodSource.
* test(cloudformation): ratchet the writable properties each provisioner reads
* test(cloudformation): use colons in the coverage messages and scope the docs paragraph to the corpus
* test(cloudformation): list the writable properties main and the schema added since the ratchet
* fix(rds): report the RDS hosted zone id on clusters and instances
DescribeDBClusters omitted HostedZoneId and DB instance endpoints omitted
Endpoint.HostedZoneId, so Terraform's aws_rds_cluster.hosted_zone_id was
empty and Route 53 alias records pointing at RDS endpoints failed.
Add a per-region rdsHostedZoneId fact to region-facts.json through the
generator, with the us-east-1 value from the AWS CLI RDS documentation,
and read it through AwsRegionFacts.rdsHostedZoneId. Regions without a
captured value fall back to the us-east-1 zone; Floci's Route 53 resolves
alias targets by DNS name, so the fallback does not affect resolution.
The value is looked up when the response is built, so existing clusters
and instances report it too.
Closes#6778
* fix(rds): read the RDS hosted zone from the CLI example and keep the fallback in RDS
AwsRegionFacts.rdsHostedZoneId now returns an Optional like every other
accessor there, and RdsQueryHandler owns the fallback zone for regions with
no captured value, the way API Gateway keeps its own placeholder. A missing
us-east-1 entry can no longer break a describe call.
The generator reads the us-east-1 zone from a snapshot of the AWS CLI
describe-db-instances example under aws-docs/partition-guides, as the
GovCloud API Gateway zones come from the GovCloud guide, instead of a
typed-in constant. The parse is required and fails on a missing,
wrong-region or ambiguous example. Adding another region is now a data
change.
* fix(cloudwatch): evaluate composite alarms with CloudWatch's reasons and refusals
Composite alarms recorded "AlarmRule evaluated to <state>" with no
StateReasonData, were evaluated only when created, accepted a rule
naming an alarm that does not exist, and let DeleteAlarms remove an
alarm a composite alarm still names. Published CloudWatch captures
show each one differently.
- A change of state records the StateReason CloudWatch writes: "<arn>
was created and its alarm rule evaluates to OK", "<arn> was updated
and its new alarm rule evaluates to ALARM", or "<child arn>
transitioned to ALARM at Monday 14 September, 2026 06:29:58 UTC".
- StateReasonData lists triggeringAlarms: the children whose state
agrees with the new one, most recently changed first. After a child's
change only the children that changed since the composite alarm last
did are listed; the alarm history orders those changes.
- PutCompositeAlarm evaluates an alarm it updates, and its parents
follow the change.
- A rule naming a missing alarm is refused with "Could not save the
composite alarm as alarms [<arn>] in the alarm rule do not exist".
- DeleteAlarms deletes nothing when it names an alarm a composite alarm
references ("Cannot delete <name> as there are composite alarm(s)
depending on it.", or "a,b ... depending on them."), or more than one
composite alarm ("Cannot delete [2] Composite Alarms as only one
composite alarm delete is allowed in single request").
The new service, Query, JSON and SDK tests fail on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudformation): cover a composite alarm over its stack's metric alarm
A stack whose composite alarm names the stack's own metric alarm is
created child first and deleted parent first, so neither the new
refusal of unknown children nor the refusal to delete a referenced
alarm fails it. A stack whose rule names a missing alarm rolls back
with CloudWatch's message; that test fails on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): evaluate composite alarms only when a child changes state
Review follow-ups to the composite alarm evaluation change.
- A child's PutMetricAlarm update, or a SetAlarmState to the state it
already has, no longer re-evaluates its parents. CloudWatch documents
that a composite alarm set with SetAlarmState "returns to its actual
state only once any of its children alarms change state"; such a
parent used to flip back with a reason naming an old transition.
- Application Auto Scaling deletes a policy's alarms one at a time, so
when a composite alarm names one of them only that one stays.
- A changed child that no longer resolves leaves its parent as it is
instead of failing the request.
- The docs say that an update closing a cycle is not evaluated, where
CloudWatch evaluates it.
- Tests: the wire and SDK tests ignore missing data so the alarm
evaluator cannot reset the states they set, one pins the reason when
two children change together, and the self-reference and cross-region
assertions, which pinned texts CloudWatch does not use, are gone.
The new manual-state and Application Auto Scaling tests fail without
this change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): evaluate composite alarms above a cycle
A composite alarm on a cycle stayed pending, which blocked every
composite alarm above it: one whose other child changed state was never
evaluated. Alarms on the cycle are still not evaluated, but they no
longer hold up the ones above them.
Also from the second review: the docs say only a metric alarm child's
update is not a change of state, and that alarms above a cycle are
evaluated; a test covers a rule stored before missing children were
refused, whose child is created later; a test docstring links the
SetAlarmState reference.
The test for an alarm above a cycle fails without this change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* chore(cloudwatch): log a composite evaluation that stops with alarms pending
The third review found one way the evaluation can still stop with
alarms pending: an alarm named like another alarm's ARN makes the cycle
check follow the wrong rule. The debug line removed in the previous
commit is back, so that case is visible again; the name lookup itself
predates this branch. The docs say an alarm above a cycle is evaluated
when one of its children changes state.
No behaviour change.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): count composite StateReasonData in code points
triggeringAlarms stopped adding children once the serialized JSON
passed 4000 UTF-16 units, while the StateReasonData length check
counts Unicode code points, as Smithy's length constraint counts
Unicode scalar values. An emoji is two units but one code point, so
children whose entries still fit were dropped. The cap now counts code
points, shares its constant with SetAlarmState's length check, and the
docs say so.
The new test names fifteen children with emoji and a newest one with a
short name, so that twelve entries come to exactly 4000 code points. It
lists 7 of them before this change and all 12 after; an exclusive cap
would list 11.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudwatch): keep the composite alarm SDK test on Java 17 APIs
CloudWatchCompositeAlarmTest called List.getFirst(), which Java 21
added. compatibility-tests/sdk-test-java compiles for Java 17, and CI
builds it in maven:3.9-eclipse-temurin-17, so its test-compile failed
and took the sdk-test-java and ec2-containers jobs with it. The three
calls use get(0) now.
A test-compile of sdk-test-java with --release 17 fails on those three
lines before this change and passes after it. No other file of the
branch is outside the root module, which builds for Java 25.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(elb): hold an ACM certificate in use while a Classic listener serves it
* fix(elb): accept a blank certificate id on a plain listener
Terraform's aws_elb sends an empty SSLCertificateId on every listener,
so only an HTTPS or SSL listener refuses a blank one. Both certificate
reference walks now share one listing that skips the blank id.
Retain credential choices through management, imports, copies and CloudFormation Body parsing. Carry quick-create credentials only for Lambda targets. Reconcile the accepted shared ARN classifier and CloudFormation import rollback on current main.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(securityhub): standards subscriptions
BatchEnableStandards, BatchDisableStandards, GetEnabledStandards and
DescribeStandards, so Terraform's aws_securityhub_standards_subscription
(and cloudposse's security-hub module) can enable CIS, AFSBP and NIST
800-53. EnableSecurityHub now subscribes AWS's default standards (AFSBP
and CIS 1.2.0) unless EnableDefaultStandards is false, as AWS does.
Subscriptions are READY at once; controls and findings are not evaluated.
Found applying kthw-on-floci's account-baseline: every standards
subscription failed with UnknownOperationException (POST
/standards/register).
BatchDisableStandards checks every ARN before removing any, so a batch
naming one unknown subscription changes nothing (before, the removals ahead
of it stuck in memory without being saved, and came back after a
restart). GetEnabledStandards reads the subscriptions under the same lock
the writers hold.
* fix(securityhub): reject a non-boolean EnableDefaultStandards
EnableSecurityHub coerced EnableDefaultStandards with asBoolean(true), so a
string "false" skipped the defaults and an object enabled them, and the
hub was enabled either way. The botocore model types the member boolean.
Reject it with InvalidInputException before any state changes, as
UpdateSecurityHubConfiguration does for AutoEnableControls.
* fix(securityhub): offer CIS v5.0.0 and take ARN partitions from the region resolver
Add CIS AWS Foundations Benchmark v5.0.0 (standards/cis-aws-foundations-benchmark/v/5.0.0,
regional, not enabled by default) to the standards Security Hub offers.
Mint every Security Hub ARN through RegionResolver: the global CIS 1.2.0 ARN takes
partitionForRegion and the regional ARNs use buildArn, so a region the catalog cannot
place keeps the deployment's partition instead of falling back to aws.
* feat(redshift-serverless): expire snapshots after their retention period
* fix(redshift-serverless): stop the snapshot expiration worker before storage closes
* fix(redshift-serverless): mark pending snapshot cleanup DELETED and test the sweep lock without timing
* refactor(redshift-serverless): run snapshot expiration on a shared sweep worker
* feat(autoscaling): support EnterStandby and ExitStandby
Both actions were routed to Auto Scaling but answered
UnsupportedOperation, so a client taking a node out of service could
lower MinSize and then fail to put the instance in standby.
EnterStandby moves InService instances to EnteringStandby, optionally
lowering desired capacity (refused below MinSize), and returns one
InProgress activity per instance. The reconciler then deregisters them
from the group's target groups and Classic load balancers and sets
Standby. ExitStandby moves Standby instances to Pending, raises desired
capacity (refused above MaxSize) and returns one PreInService activity
per instance; the reconciler registers them again and sets InService.
Descriptions, causes, status codes and progress follow the EC2 Auto
Scaling API reference, user guide and botocore examples. Error texts
follow real AWS responses quoted in public issue reports where one was
found; the others (an instance outside the group, ExitStandby above
MaxSize) are modelled on AWS's texts for similar errors.
Standby members do not count toward desired capacity, including when
AttachInstances raises it, are never scaled in or refreshed, and stay
in the group when their EC2 instance stops. Each member records the
activity of its move in a new optional standbyActivityId field, so a
move interrupted by a restart finishes after it; groups stored without
the field load unchanged. A move whose instance is terminated,
detached, deleted with its group or not running when it leaves standby
is cancelled.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(autoscaling): check EnterStandby and ExitStandby through the Java SDK
The AWS SDK for Java parses both responses into InProgress and
PreInService activities with AWS's descriptions, causes and progress,
the instance reaches Standby and then InService again, desired capacity
follows it, and ExitStandby on an instance in service is a
ValidationError.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(autoscaling): health-check standby returns and lock capacity changes
Review fixes for EnterStandby and ExitStandby:
- An instance whose EC2 instance stopped or terminated while in standby
now fails the health check AWS runs when it exits standby: Floci
terminates it if EC2 still has it, records AWS's "Terminating EC2
instance" activity with the EC2 health check cause, and the group
launches a replacement. Before, it was dropped from the group as a
stale reference, and a stopped instance was left behind in EC2, still
tagged with the group name.
- An instance returning from standby keeps its health status instead
of being reset to Healthy, so a SetInstanceHealth mark made while it
waited survives its return.
- SetDesiredCapacity and UpdateAutoScalingGroup now change the group
under its lock, so they no longer race the capacity changes
EnterStandby, ExitStandby and the reconciler make under it.
- DetachInstances refuses an instance still in EnteringStandby with
AWS's "is not in InService or Standby" error. Other states Floci
still detaches, as before.
- The docs say that instance refresh leaves standby members alone
whatever its StandbyInstances preference says.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(autoscaling): refuse detaching an instance mid standby move
DetachInstances now refuses any instance whose standby move is still in
progress, with AWS's "The instance <id> is not in InService or
Standby." error: one in EnteringStandby, one on its way back from
standby (Pending), and one marked for termination before the
reconciler ended its move. The detach path therefore no longer cancels
a move. Pending launches and Terminating members without a move are
still detached, as before.
Tests now also cover a refused termination of an instance that failed
its health check on return (retried on the next pass, nothing launched
meanwhile), that return across a restart in every storage mode, and an
instance refresh cancelling the move of an instance on its way back.
The docs list that refresh among the reasons a move is cancelled.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(autoscaling): treat an instance EC2 has no record of as missing
The reconciler's stale check asked DescribeInstances for the one
instance and kept the member on any error. EC2 answers an id it has no
record of with InvalidInstanceID.NotFound rather than an empty list, so
a member whose EC2 record was gone was kept forever:
- an instance leaving standby stayed Pending with its PreInService
activity and kept counting toward desired capacity, so no
replacement was launched;
- a Pending launch was never pruned either;
- a Terminating member was never pruned and was reported as a failed
termination.
That error now reads as a missing instance, both when deciding whether
a member is stale and whether it still needs terminating. Other errors
keep the member, as before. The standby tests' EC2 mock now answers a
missing id the way Ec2Service does.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(autoscaling): keep a missing instance out of a termination batch
EC2 terminates the ids of a TerminateInstances batch in order and
stops at the first one it has no record of. The reconciler sent every
Terminating member in one batch, so a member whose EC2 record was gone
kept the members after it from being terminated that pass and had a
failed termination recorded for them.
A member EC2 has no record of now stays out of the batch, since it is
pruned as a stale reference in the same pass. The standby tests' EC2
mock terminates in order as Ec2Service does, and a reconciler test
covers a batch with one missing and one live member.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(autoscaling): say which EC2 errors still count as an instance record
hasNoEc2Record treats only InvalidInstanceID.NotFound (or an empty
answer) as a missing record; any other EC2 error keeps the instance in
the termination batch. The Javadoc now says so.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(autoscaling): use StorageFactories in the standby storage test
storedService built its StorageFactory from hand-stubbed EmulatorConfig
and ServiceConfigAccess mocks, which is what StorageFactories.open in
io.github.hectorvent.floci.testing already provides. Its flush and
compaction intervals are an hour instead of a minute; neither timer
fires during the test either way.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(ec2): read RunInstances security groups from the primary interface spec
RunInstances read security groups only from the top-level
SecurityGroupId.N. With private_ip or associate_public_ip_address set,
Terraform's aws_instance sends them on the primary interface spec
(NetworkInterface.1.SecurityGroupId.N), so the instance landed in the
VPC's default group and the next plan wanted to replace it.
The interface spec's groups apply only when its DeviceIndex is 0 (another
index is a secondary interface), and a request carrying both shapes fails
with InvalidParameterCombination, as on AWS.
* test(ec2): match the capacity reservation argument RunInstances now passes
* test(ec2): fold the interface security group cases into Ec2RunInstancesPublicIpParamTest
Both classes tested what RunInstances takes from the interface spec with
the same handler setup, base params and runInstances stub; only the
captured argument differed. One forward() helper now runs the request and
captures both the security groups and the public-IP override, and the
separate class is gone.
The vendored file carried 52 of IAM's operations and carries 162 now, which
is every one of the 164 that declares a required member, a length, a pattern,
an enum or a range, bar the two account alias operations: those answer their
single member in AWS's own wording, so there is nothing left for the walk to
read on them.
What takes the last of them in is a walk that reads a Query map and anything
nested under one. A map arrives as entries numbered under its own name,
`ReplacementValues.entry.1.key` and `.entry.1.value`, and an entry's value is
named under the key that entry carried, `replacementValues.Department.values`,
which is how both maps this service answered by hand already named one and how
the JSON protocols name a map's value here. An entry is read off its key, so
one numbered with a value and no key is not an entry the map could hold. A
structure's field may be a list, a list's member may hold a list of its own
and a map's value may be a structure, so `AcquireRole`,
`PutAccountProperties`, `CreateDelegationRequest` and both simulators are read
with the rest, and the file refuses to load only for a shape of a type the
walk would pass over unread.
The two hand-written map checks come off with that. `AcquireRole`'s answers do
not move at all: the count of 30, each entry's required `Values` and the 20
values one entry admits read exactly as its own check read them, named by the
key the entry was sent under, which is what the tests it already had pin.
`PutAccountProperties` keeps the set it answered for a key, `Map keys must
satisfy constraint: [...]`, with the minimum length of 1 the model declares
now inside it where the hand-written set listed the maximum and the pattern
alone, and a value outside its bounds is answered in the words every other
member carries rather than the `must have length between 1 and 1024` that
check wrote. The `Namespace/PropertyName` rule stays exactly where it was,
being a rule the service applies after the format is good rather than a
constraint the model declares.
Two reductions keep an answer that is AWS's own rather than rewording it, both
through the hook the shared driver already takes. Eight operations answer a
member the request leaves out with "The request must contain the parameter
CertificateBody.", the wording this emulator answers for a missing Query
parameter in several services, so their shapes are vendored without the
model's required list and keep that refusal while their lengths and patterns
are read. Seventeen more are vendored without a member they answer in a
wording of their own: a service-linked role's principal and suffix, an empty
`ServiceNamespaces`, `statusType` on all four operations that take it,
`Encoding` on `GetSSHPublicKey`, the simulators' empty `ActionNames`,
`PolicyInputList` and `PolicySourceArn`, and `TagKeys` on the eight untag
operations.
Nine wordings this service wrote for itself go with the checks that wrote
them: the three password-policy ranges, the name refusal that spelled out its
own bounds and the group, server certificate and instance profile names beside
it, the path refusal, the authentication code, the virtual MFA device name and
the serial number. Each is answered by the model's own violation now, through
the one writer this package already had.
A member whose shape fixes one length is answered for that length rather than
for a bound it sits under, `Member must have length equal to 6`. That is the
wording a report's 36-character job id already answered by hand, which is why
the three report readers can be read from the model at all, and it reaches
STS through the same writer, whose `TokenCode` and `SigningAlgorithm` each fix
one length too.
Two test fixtures carried values AWS refuses and now carry values it takes.
`SignedIamUsers` named a user with a prefix plus a whole UUID, which reaches
66 characters where `userNameType` declares 64, and the two sibling fixtures
that named one the same way follow it onto the shorter suffix. The SDK suite
registered a SAML provider with a 375-character metadata document where AWS
declares 1000, so each of its two documents is padded to that bound on its
own.
`docs/services/iam.md` carries each reading, the maps among them.
* fix(config): a started configuration recorder keeps recording across a restart
Whether a recorder was recording, and when it last started and stopped,
lived in memory while the recorder itself was persisted. After a restart
with persistent storage every recorder reported recording=false, so
Terraform's aws_config_configuration_recorder_status planned to start it
again on every refresh, and a deployment that relies on Config looked off.
The three are now persisted alongside the recorders.
docs/services/config.md notes that the recording state persists.
* test(config): assert recorder start and stop times survive a restart
The restart test only checked recording(), so reverting either timestamp
store to memory left it green. It now captures lastStartTime after the
start and lastStopTime after the stop, and asserts each keeps its exact
value through a reload.
* test(config): restart AWS Config persistence tests through files on disk
The restart tests shared one set of in-memory stores between service
instances, so nothing was written or read back and a broken save or load
of the recorder state stayed green. Each simulated restart now builds a
fresh factory whose backends are new PersistentStorage files in a
temporary directory, loaded from disk, including the restart after the
recorder is deleted.
* test(config): drop blank lines left at the top of the persistence tests
* test(config): restart persistence tests through StorageFactories.open
GetAuthorizationToken-authenticated Maven GET/HEAD requests now retain a
missing release version from the repository's own public:maven-* external
connection (Maven Central, Clojars, CommonsWare, Google Android, Gradle
Plugins), the way real CodeArtifact does, instead of always 404ing.
Follows AWS's own documented rules: release versions only (SNAPSHOT is
never imported through an external connection); the standard
pom/jar/-javadoc.jar/-sources.jar set imported together on a standard
request, a non-standard asset name imported individually and only on
demand; a retained version's own origin checked against any later asset
request for it, rejecting one from a different connection; package-level
upstream:BLOCK respected; and a direct mvn deploy of a version already
present in the connection rejected (ConflictException), matching AWS's
documented publish-side behavior.
Retained bytes are counted toward DescribeDomain's assetSizeBytes the
same way a direct deploy already is, gated on the real deploy outcome
rather than merely having fetched the bytes, and never double-counted on
an idempotent-match retry.
Verified against the real, live Maven Central in a Docker-gated
integration test (junit 4.13.2), and manually with a real mvn client
through a wildcard mirror.
With TLS on, Floci writes its CA bundle as a Java trust store too, but
only EMR's containers got it: a launcher had to copy it in with
ContainerLifecycleManager.copyJavaTrustStore and point its JVMs at it
with a shell line. So a Java Lambda function, ECS task, Batch job or
Flink application calling Floci over HTTPS still failed with "PKIX
path building failed" unless it brought a trust store of its own.
ContainerBuilder now has withJavaTrustStore(). For a container whose
spec asks for it, the lifecycle manager copies the trust store in
beside the CA bundle as it creates the container, and sets
JAVA_TOOL_OPTIONS to Floci's -Djavax.net.ssl.trustStore ahead of the
value the spec gives it, or the image's own when the spec sets none,
so a trust store the workload names itself still replaces Floci's. A
copy that fails creates the container again without any of the trust
variables, as a failed bundle copy already did, so JAVA_TOOL_OPTIONS
never names a file that is not there.
Lambda functions on a Java runtime or from a container image, ECS task
containers, Batch jobs, and Flink's JobManager and TaskManager ask for
it, and so do EMR steps and EMR Serverless job runs, whose
spark-submit starts directly again. The bootstrap actions' container
keeps the separate copy and the shell line, since it is kept as the
steps' image, which would keep a JAVA_TOOL_OPTIONS set at its
creation. Other containers are unchanged.
The generated table of the resources requests name checked Cost and
Usage Reports' ModifyReportDefinition on the report its ReportName
names and also on its ReportDefinition.BillingViewArn, read as a report
definition's ARN. That member is a billing view's ARN
(arn:aws:billing::<payer account>:billingview/...), never a report's,
so a request carrying a report's ARN there was checked on a report it
does not act on. PutReportDefinition's correction already leaves it
out.
A correction now reads ModifyReportDefinition's report from ReportName
alone, sharing PutReportDefinition's reason, and the table is
regenerated; nothing in it is edited by hand.
Under IAM enforcement, Budgets, Cost and Usage Reports, Service Quotas,
Textract and Translate requests were checked on `*`, so a grant scoped
to a budget, a report definition, a quota, an adapter or a terminology
was refused, and a deny scoped to one never applied.
The generated table of the resources requests name now reads them, 103
operations, from AWS's Service Reference and botocore as it reads the
first three batches: their namespaces move from the generator's
NOT_COVERED to NAMESPACES and the table is regenerated, nothing in it
edited by hand; 717 operations over 17 namespaces. Each resource
type's ARN format is the one Floci mints or reads: `budget/<name>` with
no Region (Budgets' tag handler parses it), `definition/<name>`, and
`<service code>/<quota code>` (Service Quotas' QuotaArn).
Three corrections, each with its reason: CreateBudget and UpdateBudget
name their budget by Budget.BudgetName and NewBudget.BudgetName, and
PutReportDefinition its report by ReportDefinition.ReportName, inside a
structure the rule does not read. Without them UpdateBudget and
PutReportDefinition were checked only on their BillingViewArn, a
billing view's ARN by botocore's pattern, so a caller allowed on one
budget or report could give its ARN there and name another.
Verified Permissions minted a policy store's ARN with a Region, where
AWS gives none: its CreatePolicyStore example answers
arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg111111,
the Service Reference's format alike. It now mints it without one, in
the Region's partition.
Not read yet, each with its reason in NOT_COVERED: Verified
Permissions, whose policyStoreId may name a store by its alias, which
AWS authorizes as the action on the store the alias points to and
GetPolicyStoreAlias on the alias, and whose aliasName carries the
`policy-store-alias/` its format already gives; Auto Scaling, whose
group and launch configuration ARNs Floci mints without AWS's id
(`autoScalingGroup:<name>` for
`autoScalingGroup:<id>:autoScalingGroupName/<name>`), which ECS reads
back; SWF, whose domain format the Service Reference gives no Region
while the SWF Developer Guide gives one; and CloudHSM, whose formats
end in names while its requests give ids.
The seven operations that still answered an absent member from a check of
their own are read against the vendored shapes now, which leaves every STS
operation that models a member reading its constraints from the model:
`AssumeRole`, `AssumeRoleWithSAML`, `AssumeRoleWithWebIdentity`, `AssumeRoot`,
`DecodeAuthorizationMessage`, `GetDelegatedAccessToken` and
`GetFederationToken`. `GetCallerIdentity` carries no member, so there is
nothing to read for it.
Two answers move, both onto the form the model and the rest of this package
give. A member the request leaves out is named as a constraint message spells
it, `roleSessionName` rather than `RoleSessionName`, and every absent member
is reported together in the order the model lists them, where the check it
replaces answered the first it found. A member sent empty is a value the
request carries, so it breaks its own minimum length rather than reading as
absent. That is the reading #6811 settled for the two services and what
`validateRequired` was the last of in this handler.
What the seven gain is every bound beside the required members, none of which
was read at all: `RoleArn` at 20 to 2048 characters, `RoleSessionName` at 2 to
64, `ExternalId`, `SourceIdentity`, `SerialNumber`, `TokenCode`, `Policy`,
`PolicyArns`, `Tags`, `TransitiveTagKeys` and `ProvidedContexts` on
`AssumeRole`, `SAMLAssertion` at 4 to 100000, `WebIdentityToken` at 4 to
20000, `ProviderId` at 4 to 2048, `Name` at 2 to 32, `EncodedMessage` at 1 to
10240, and the `DurationSeconds` and `MinimumSessionTokenSize` ranges each
operation declares. `AssumeRoot`'s own length check on `TargetPrincipal` said
what the model says, so it comes off with the rest.
One reading is this emulator's own, and `docs/services/sts.md` says so.
`TradeInToken` is required and declares no length, so a request sending it
empty carries a value: it reaches the lookup and is answered
`ExpiredTradeInTokenException`, the refusal any token that cannot be redeemed
gets, where the check it replaces called it absent. Nothing published says
what AWS answers an empty trade-in token.
Each operation keeps the refusals it answers ahead of the constraints:
`GetFederationToken` and `GetSessionToken` turn away session credentials
first, and `AssumeRoot` refuses the global endpoint first.
Three test fixtures carried values AWS refuses and now carry values it takes.
A `RoleSessionName` of `s` is one character where the model declares two, and
a `WebIdentityToken` of `jwt` three where it declares four, so the fixtures
that sent them are a character longer, as are the two assertions that read a
session name back out of an assumed-role ARN and a condition key.
The name the shared role-session fixture opens under has one writer now,
`EnforcementFixtures.SESSION_NAME`, read by every test asserting on that session
rather than spelled again in each: an `aws:userid` condition, a `PrincipalArn`
condition, two authorization-denial messages and the ARN two trust-policy cases
read back. Each of those carried the one-character name, which is a 403 where
the case wants a 200, or a prefix match that no longer pins the whole ARN.
With TLS on, every container Floci launches gets the CA bundle and the
SSL_CERT_FILE family of variables, but the JVM reads none of them. So
in the docker runner mode a Spark job's own SDK clients that ignore
AWS_ENDPOINT_URL, the AWS SDK for Java 1.x's or an older 2.x's,
failed with "PKIX path building failed" against Floci's HTTPS, even
with FLOCI_DNS_SPOOF_AWS_ENDPOINTS sending AWS's endpoint names to
Floci. A job could only reach Floci over its HTTP endpoint.
Floci now also writes the bundle's certificates as a PKCS12 trust
store at boot, floci-ca-bundle.p12 beside the bundle. A launcher whose
workload is Java can copy it into a container before the container
starts (ContainerLifecycleManager.copyJavaTrustStore) and point the
container's JVMs at it through JAVA_TOOL_OPTIONS, with a shell line
that does so only when the file is there. The store has no password
and the line gives only its path, so a trust store a job or an image
names itself replaces Floci's, with that store's own type and
password. EMR Serverless job runs and EMR steps copy it into the
driver's container ahead of spark-submit or the step's command, and
the bootstrap actions' container gets it for its actions, then drops
it before the image is kept. Other services' containers are unchanged.
JAVA_TOOL_OPTIONS rather than spark.driver.extraJavaOptions, since
setting that key would replace what the image's spark-defaults.conf
gives it, and a job's own value would drop Floci's. Each JVM prints
"Picked up JAVA_TOOL_OPTIONS: ..." on its standard error, as the docs
now say.
Keep memory item storage current by retaining the concurrent live map. Preserve snapshots for durable backends and cover writes, reloads, restore, and account-scoped storage.
Refs #1292
In the docker runner mode a job run's retryPolicy was stored and
returned, but a run whose driver failed was never tried again: every
run was its one attempt. Now, on release 7.1.0 or later, "EMR
Serverless releases 7.1.0 and higher include support for job
resiliency", a run whose driver fails is tried again as the user
guide's "Job resiliency" gives it:
- a BATCH run until it has made maxAttempts attempts, "The default is
1, which means to not rerun the job";
- a STREAMING run, which "EMR Serverless indefinitely retries", until
it has failed maxFailedAttemptsPerHour times within an hour, "The
default is five".
The failed attempt ends FAILED with its stateDetails, and the next is
SCHEDULED again and runs its driver from the beginning, "its own set
of logs" under attempts/<n>/ in S3 and CloudWatch Logs. A cancelled
run, one past its timeout ("Cancelling: ... or the job run has timed
out"), one Floci's own shutdown stopped and one whose application is
gone are not tried again; a retry is admitted while its application
cannot be deleted, as the first attempt is.
GetJobRun without attempt returns "the latest attempt", and with one
an earlier attempt as it ended; ListJobRunAttempts lists them all,
oldest first, each with its own createdAt and updatedAt. No source says
whether a run's timeout spans its attempts; Floci applies it to each.
Floci sends no EMR Serverless events, so the job run retry event is
not sent.
StartJobRun holds retryPolicy to "Accepted values are 1 to 10,
inclusive" for both members: outside that range is a
ValidationException in the model's constraint form, and a member that
is not an integer a SerializationException, as Smithy's restJson1
malformed-request tests have it.
`GetAccessKeyInfo`, `GetSessionToken` and `GetWebIdentityToken` are held to
the constraints botocore's STS model declares, which
`tools/aws/regen_sts_shapes.py` vendors into `aws/sts-request-shapes.json`
and `StsRequestShapes` reads through the same `QueryConstraintCheck` walk
IAM reads its own file with. The two services share the protocol, the
message wording and the generator, so what is new is which operations are
read rather than how.
What it adds is on `GetSessionToken`: `SerialNumber`, `TokenCode` and
`MinimumSessionTokenSize` are declared and nothing read them, so a serial
number under 9 characters, a token code that is not six digits and a size
past 4096 answer `ValidationError` where they answered credentials. The size
is still only validated, the token staying the length this emulator mints.
`GetAccessKeyInfo` and `GetWebIdentityToken` keep the messages they already
answered, from the same bounds and the same patterns, and about 130 lines
of hand-written audience, tag and access-key checks come out. One answer moves:
a value breaking two constraints is answered for both, where the if-else
chain stopped at the first. That is the reading #6402 settled and #6580
already took for an empty role name.
`jwtAlgorithmType` publishes a fixed length of 5 and no enum, the two values
coming from the reference, so the walk takes a documented constraint keyed
by member name and reports it in that member's place, which keeps a
collected message in the model's order. It is reported only for a member the
request carries that breaks nothing the model declares, which is the
exclusivity the hand-written helper had.
A value that is no number at all stays `InvalidParameterValue`, answered
before the constraints, since the model declares a range and says nothing
about what counts as a number; a digit string is a number of any width, so a
`DurationSeconds` of `99999999999` breaks the maximum rather than being
called no integer, as #6625 settled for an oversized `MaxItems`. Each
operation asks for its violations where its own check ran rather than ahead
of the switch, because `GetSessionToken` refuses session credentials before
it reads anything.
The whitespace around a number comes off wherever this handler reads one. The
check takes a padded value and holds it to its range, so the read behind it
parses the same text: parsing the value as the request spelled it threw there
and fell back to the default, so a ` 3600 ` asking for an hour would have been
handed the twelve hours `GetSessionToken` defaults to, or the five minutes a
web identity token defaults to. IAM reads its own `MaxItems` that way already.
The generator is not new code. `request_shapes.main` already drives the five
generators that vendor member types, so it takes an `operations` argument
now and both Query-protocol generators hand it their model, output and
operations the same two-line way, which takes the hand-rolled driver out of
`regen_iam_shapes.py` as well. ECR and Resource Groups still carry theirs
and are a refactor of their own.
The generator contract tests move with it: that a vendored file carries
exactly the operations its generator lists and resolves every shape it names
is one parametrized test over all four constraints generators rather than a
copy per generator, and `build_constraints`'s own properties are tested
once, where the shared module already tested them. The model transform the
driver takes is driven through it as well, the file it writes carrying what
the transform left and the staleness check calling that file current only
when it prepares the model the same way, and IAM's own tests read the
vendored file for each paged request reduced.
Three sentences this handler wrote out by hand go the same way. The two
range refusals and the length refusal on `TargetPrincipal` come from
`SmithyValidationErrors`, which already wrote them word for word, and the
"Must be an integer." refusal has one writer and three callers. The length
comparison counts code points rather than UTF-16 units as a result, which is
the reading the rest of the package uses.
* fix(ec2): ignore ports when revoking an all-traffic rule
Revoking an "all traffic" (-1) rule compared ports literally. Terraform's
aws_security_group revokes AWS's default egress rule as -1 with FromPort=0
and ToPort=0, which never matched the stored rule (it has no ports), so
every new group kept allowing all egress and the next plan wanted to
remove it again. AWS ignores ports for -1.
Protocols are now compared after the same normalization the security-group
evaluation uses, so a revoke naming protocol 6 also matches a tcp rule, as
on AWS.
* test(ec2): name the all-traffic revoke test a service test
* test(ec2): move the all-traffic revoke tests into Ec2ServiceTest
Use Ec2ServiceTest's existing mockModeService() instead of a copied
mock-mode harness, as requested in review.
On the 15 actions where the Service Reference lists iam:PermissionsBoundary and the request carries no boundary, such as AttachRolePolicy, PutUserPolicy and GetRole, the key is the boundary stored on the role or user named by RoleName or UserName. The generator writes these pairs to a fromTarget section, and IamConditionContextResolver looks the boundary up through IamService. A role or user without one carries no value for the key.
Under IAM enforcement, CodeBuild and Kinesis Data Analytics (Amazon
Managed Service for Apache Flink) requests were checked on `*`, so a
grant scoped to a project, a report group or an application was
refused, and a deny scoped to one never applied.
The generated table of the resources requests name now reads them, 92
operations, from AWS's Service Reference and botocore as it reads the
first two batches: their namespaces move from the generator's
NOT_COVERED to NAMESPACES and the table is regenerated, nothing in it
edited by hand; 614 operations over 12 namespaces. Each resource type's
ARN format is the one Floci's handler mints, which the tests check
against the ARN each create returns: `project/<name>`,
`report-group/<name>`, `build/<project>:<number>` and
`application/<name>`.
Kinesis Data Analytics v1, the KinesisAnalytics_20150814 target of SQL
applications, is not read: Floci serves v2 only, and v1's operations
share v2's names with other members. It joins EventBridge V2 in the
generator's CLIENTS_NOT_READ, with its reason.
CodeBuild authorizes a build on its project: the CodeBuild User
Guide's permissions reference gives BatchGetBuilds, StopBuild,
RetryBuild and BatchDeleteBuilds the resource project/project-name.
Their requests name builds by id, which is `<project>:<id>` (its
CODEBUILD_BUILD_ID example is codebuild-demo-project:b1e6661e-...), so
four corrections read the project from the id up to its `:`. For them
the table may read a member filling a variable up to a character
`before`, as it already read an ARN member, in the generator, the
loader and the reader. Without them a policy granting StartBuild and
BatchGetBuilds on a project, as a pipeline's CodeBuild action role
has, allowed starting a build and refused watching it.
A list filling a type's one variable may mix names and ARNs: CodeBuild's
BatchGetProjects takes either for each of `names`. Each value that is
an ARN of the type now names that resource and the others are read as
names, where the reader took ARNs as given only when every value was
one, and otherwise put an ARN inside the name's format, refusing a
caller granted both projects.
Not in this change: a build batch, whose id the documents give no
format for and which Floci does not serve, and a report, named by a
report ARN where AWS checks its report group, stay on `*`.
In the docker runner mode a cluster's BootstrapActions were stored and
listed but never run, so a step that needed what they install, such as
a Python library a PySpark step imports, failed where on AWS it would
run. Now a cluster with bootstrap actions is BOOTSTRAPPING while they
run, one after the other, in one container of the release's EMR
Serverless image, and that container is then kept as the image the
cluster's steps run in.
- Each action's script is read from Floci's S3 (s3n:// and s3a:// name
the same bucket) and runs with its Args in /home/hadoop through
docker exec, with the credentials of the cluster's instance profile
in that exec's environment alone, so they never become part of the
image.
- "Bootstrap actions execute as the Hadoop user by default. You can
execute a bootstrap action with root privileges by using sudo", but
the image has no sudo: an action runs as root, with a sudo that runs
its command as it is, and what it leaves in /home/hadoop is the
hadoop user's. The kept image runs as the user of the image the
container ran, as the steps do, and the steps get it by its id, which
runs as it is whatever image-registry-base Floci pulls images from.
- An action that exits with another code than 0 ends the cluster
TERMINATED_WITH_ERRORS, with BOOTSTRAP_FAILURE and "On the master
instance (<instance-id>), bootstrap action <n> returned a non-zero
return code", as a real cluster gave it
(hashicorp/terraform-provider-aws#4378) and the Management Guide
quotes it. A script that cannot be read ends it the same way, in
Floci's words; a bootstrap that cannot run, or that a restart cut
short, with INTERNAL_ERROR. TerminateJobFlows stops it at once.
- With a LogUri, each action's stdout.gz and stderr.gz go under
<LogUri>/<cluster-id>/node/<instance-id>/bootstrap-actions/<n>/, the
instance the master as ListInstances gives it. An action's output
goes to Floci's log line by line as it runs, and to those files
gzipped as it arrives, through a file on disk, so however much it
writes, Floci keeps no more than a line of it in memory.
- The image goes once the cluster has ended and its last step is done,
and the cluster names it until it is gone, so a removal Docker
refuses is tried again the next time the cluster is read; a reset
removes them all, and the startup sweep, before any restarted cluster
can move on, the ones of clusters that are gone or have ended.
ContainerExec gets an overload that sets an environment for one
command alone. What the bootstrap has in common with the Spark runner
and the rest of Floci is shared rather than copied:
- core.common.docker.ContainerLaunches: the runs in progress and their
containers, which a stop, a reset or a shutdown removes; both EMR
runners keep theirs in it.
- ContainerLifecycleManager.commit and removeImage.
- ContainerLogStreamer.consoleLines, a stream that logs each line as it
arrives through the line logger its attach methods now share.
- S3Uri.isS3 and parseAnyScheme, which read s3n:// and s3a:// as s3://.
- EmrServerlessSparkRunner.putLogs, the runner's S3 log writing, which
now reads each file from a stream.
* fix(ec2): keep the tags CreateFlowLogs is given
CreateFlowLogs dropped its vpc-flow-log TagSpecification, and
DescribeFlowLogs had no tagSet, so Terraform's aws_flow_log tags never
read back and every plan after apply wanted to add them again. The tags
are now stored with the flow log and returned.
* test(ec2): read a flow log's tags back through the AWS SDK
Lambda refuses a missing or Failed revision, a Failed latest revision and
a connector revision on a PerRegion or MultiRegion endpoint before it
refuses an endpoint past the maxEndpointsPerFunction quota.
* fix(apigateway): default a REST custom domain to EDGE when no endpoint type is given
* docs(apigateway): state the CreateDomainName endpoint type default; cite its source
* test(apigateway): seed the legacy base path mapping test with a REGIONAL domain
The test reads its mappings through the v2 API, which refuses EDGE domains,
and a domain created with no endpoint type now defaults to EDGE.