* fix(dynamodb): use the AWS wording when Query or Scan rejects AttributesToGet with a Select
* refactor(dynamodb): share the Select conflict check for ProjectionExpression and AttributesToGet
CreateReplicationGroup threw ReplicationGroupAlreadyExistsFault, whose modeled wire code is ReplicationGroupAlreadyExists at HTTP 400. ModifyReplicationGroup's duplicate user name check threw DuplicateUserNameFault, whose modeled wire code is DuplicateUserName, matching the user group create path.
A client revalidating with the Last-Modified it was given now gets 304
for If-Modified-Since and 200 for If-Unmodified-Since on GetObject and
HeadObject, as S3 answers.
Objects are stamped to the millisecond while Last-Modified and HTTP
dates carry whole seconds, so at an object's own Last-Modified the
stored time was up to 999 ms later than the header and compared as
modified. checkPreconditions now truncates the stored time to seconds
before the date comparisons, as checkCopySourcePreconditions and
ByteRange.rangeApplies already do.
Tests: a stubbed object stamped .456Z covers both headers at LM-1s, LM
and LM+1s on GET and HEAD, with a .000Z control; the at-LM .456Z cases
fail without the fix. HTTP round-trip tests cover the real write path.
AppSyncDataSourceAuthorizer built its principal as "appsync." plus the
region's DNS suffix, so in China the denial read "service role does not
trust appsync.amazonaws.com.cn". A service principal is
<service>.amazonaws.com in every partition; the trust check already
folded both forms, so only the message was wrong. It now comes from
ServicePrincipals.of, as the repository rules ask.
Two Javadocs said a layer ARN "outside the aws partition" is rejected.
The check compares with the request's partition (the deployment's only
outside a request), so for a China request the foreign partition is
aws. They now say "outside the request's partition".
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
SNS's Query routing set listed ten names that neither SNS handler dispatched, so a
request for any of them was answered UnsupportedOperation. All ten are real SNS
operations, and both the Query and JSON protocols now serve them.
AddPermission and RemovePermission edit the topic's Policy attribute the way AWS
does, going by LocalStack's recordings of the same calls against a live account:
the label becomes the statement's Sid, each account its root principal, and a single
account or action is written as a string. A duplicate label, an action outside SNS
and a missing topic get AWS's errors. A label the policy does not hold leaves it
unchanged, since no source shows what AWS answers there. Floci stores topic policies
but does not evaluate them under enforcement, so the grant only shows in
GetTopicAttributes.
The default topic policy now matches what AWS returns for a new topic: Version
2008-10-17 with an AWS:SourceOwner condition, where Floci has had 2012-10-17 and
AWS:SourceAccount since the first commit. AddPermission builds on it.
GetSMSSandboxAccountStatus reports the account outside the sandbox, because Floci
delivers SMS to any number. The sandbox numbers still work per account and region,
without the limits AWS lifts outside the sandbox. CreateSMSSandboxPhoneNumber texts a
six-digit code through the same path as Publish, so a test reads it from /_aws/sns,
and VerifySMSSandboxPhoneNumber checks it.
No number is ever opted out. AWS opts a number out when its owner replies STOP, and
nothing reaches Floci that way, so CheckIfPhoneNumberIsOptedOut answers false,
ListPhoneNumbersOptedOut is empty, and OptInPhoneNumber checks only the E.164 format,
with AWS's error for a malformed number.
AddPermission takes only twelve-digit account IDs, so a malformed one cannot end up as
a principal in the stored policy.
Each of these edits reads a record, changes it and writes it back. AddPermission,
RemovePermission and SetTopicAttributes, which writes the same Policy attribute, are
synchronized, as are the sandbox's create, verify and delete, so overlapping requests
cannot lose a grant or bring back a deleted number. A number whose verification text
cannot be recorded is put back as it was. The tests park the first of two edits inside
that window and check the second waits. testing.ThreadStates holds the wait they use,
which several other test classes still carry their own copies of.
With SNS dispatching AddPermission and RemovePermission, the last two rows of the
Query routing gap file, SQS's two names reaching SNS without a Version, are gone,
leaving 171. The SNS row in docs/services/index.md now counts 39 operations, up
from a stale 17.
Refs #5549
GetObject and HeadObject ignored partNumber, so a client reading a
multipart object one part at a time downloaded the whole object for
every part, and never learned how many parts there were. The API
Reference describes partNumber as "effectively" a ranged GET or HEAD
for that part, with x-amz-mp-parts-count "only returned if you specify
partNumber in your request and the object was uploaded as a multipart
upload".
Both now answer partNumber as S3 does in LocalStack's AWS-validated
test_get_object_part, test_get_object_part_checksum and
test_complete_multipart_parts_checksum captures: 206 with the part's
Content-Range and Content-Length, the object's ETag, and
x-amz-mp-parts-count for an object completed from a multipart upload.
An object stored in one request is its own part 1. A part the object
does not have is 416 InvalidPartNumber, naming PartNumberRequested and
ActualPartCount, and partNumber with a Range header is 400
InvalidRequest. A part streams from storage like a range, so the parts
of a large object are read one at a time without holding it.
With checksum mode on, a part of an object with a COMPOSITE checksum
gets that part's own checksum, of type COMPOSITE, and a part that is all
of its object gets the object's checksum; any other part of a
FULL_OBJECT multipart object gets none, as the captures show.
A part number below 1 is 400 InvalidArgument, and one above the part
count, past 10,000 or not, is the 416, as the AWS SDK for Java documents
for partNumber; the 400 carries the wording and fields the captures
record for UploadPart. Part 1 of an empty object succeeds, as the AWS
SDKs' integration tests that download an empty object by part expect,
with no Content-Range, which the CRT client reads only from a part with
bytes, and so with 200, since a 206 must carry one (RFC 9110 15.3.7).
GetObject's ranged response and HeadObject now build their common
headers with GetObject's, given the length served.
* feat(rds): IAM role associations for DB clusters and instances
AddRoleToDBCluster, RemoveRoleFromDBCluster, AddRoleToDBInstance and
RemoveRoleFromDBInstance answered UnsupportedOperation, and DBCluster
and DBInstance carried no AssociatedRoles, so Terraform's
aws_rds_cluster_role_association and aws_db_instance_role_association
could not apply.
Clusters and instances now keep their associated roles and report them
as AssociatedRoles, ACTIVE as soon as they are added. The four actions
raise the faults the API model lists, and CreateDBCluster accepts
AssociatedRoles, checked before the cluster is created. Feature names
are not yet validated against the engine.
Closes#5343
* fix(rds): route the instance role actions, and refuse only a repeated cluster role
AddRoleToDBInstance and RemoveRoleFromDBInstance were missing from
RDS_ACTIONS, so a request with no credential scope reached SQS.
DBClusterRoleAlreadyExists covers the role ARN only, so a cluster now
takes a second role for a feature that already has one. Instances keep
refusing a repeated role or feature, as their fault documents.
CreateDBCluster reads every AssociatedRoles index, gaps included, and
refuses an entry without a RoleArn. It associates the roles in one step
and deletes the new cluster if that is refused.
* refactor(rds): import the types parseAssociatedRoles uses
The regex and sorted-set types were written with their packages inline;
AGENTS.md asks for imports. The role association compat test gains a
DisplayName like the others in its class.
* docs(rds): count the role association actions alongside the catalogue reads
#5196 and this branch each added four RDS actions, so the service matrix
count is 98.
GetPublicAccessBlock answered NoSuchPublicAccessBlockConfiguration for a
bucket nobody had configured. AWS has applied all four settings to every
new bucket since April 2023, so a fresh bucket reads back with
BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy and
RestrictPublicBuckets all true. The 404 only follows a
DeletePublicAccessBlock.
Bucket now remembers whether its configuration was deleted, and Get
returns the default when none is stored and none was deleted. The default
is reported, not stored, so enforcement on ACLs and policies is unchanged.
* feat(guardduty): add Malware Protection plans and AWS::GuardDuty::MalwareProtectionPlan
Adds CreateMalwareProtectionPlan, GetMalwareProtectionPlan,
UpdateMalwareProtectionPlan, DeleteMalwareProtectionPlan and
ListMalwareProtectionPlans, and routes plan ARNs through the shared tag
operations.
Adds a CloudFormation provisioner for AWS::GuardDuty::MalwareProtectionPlan.
Ref and Fn::GetAtt MalwareProtectionPlanId return the plan id, and Arn,
CreatedAt, Status and StatusReasons are set. Role, object prefixes, the
tagging action and tags update in place; a different BucketName is rejected
because the update API cannot change the bucket.
Management plane only: no scan runs, so a plan stays ACTIVE.
Closes#4657
* fix(guardduty): address review findings on Malware Protection plans
- Apply a plan update all-or-nothing: validate every supplied field before
storing any, so a rejected request no longer changes the role.
- Page ListMalwareProtectionPlans by the last returned id instead of an
offset, so deleting a plan between pages neither fails nor skips, and use
the documented default page size of 100.
- Restore a plan on a failed CloudFormation stack update from a snapshot
taken before the first change, and delete a plan an update created in
place of one deleted out of band.
- Clear ObjectPrefixes and Actions on a stack update that drops them.
- Apply the creation tag rules to the shared tag routes.
- Require the role to be an IAM role ARN.
- Use explicit types instead of var.
* style(guardduty): import ArrayList instead of fully qualified name
* test(cloudformation): wire GuardDuty into CfnProvisionerFixture
CfnProvisionerFixtureTest requires every provisioner to be reachable through a public Builder setter. Add a guardDuty(...) setter that registers GuardDutyMalwareProtectionPlanCfnProvisioner.
* fix(guardduty): address second review round on Malware Protection plans
- Rolling back a stack update that recreated a plan deleted out of band now
restores the prior plan's Arn, CreatedAt, Status and StatusReasons, not only
its id, so Fn::GetAtt no longer names the deleted replacement. The
out-of-band test now changes the plan's properties: unchanged resources are
skipped on update, so it never reached the create before.
- Plan tag keys are checked against GuardDuty's documented TagKey pattern
(^(?!aws:)[a-zA-Z+-=._:/]+$) on creation and on TagResource.
- The tag routes require the supplied ARN to equal the stored plan's ARN, so
a matching plan id under another account, service or partition is
ResourceNotFoundException.
- The /malware-protection-plan routes move behind a @PreMatching filter that
rewrites only guardduty-signed requests to /_guardduty, as DlmRouteFilter
does, so path-style S3 requests for a bucket of that name reach S3.
* style(guardduty): import Instant and List, drop em-dash, document the plan route
Review on #5373: GuardDutyController used an inline java.time.Instant and its
Javadoc carried an em-dash, which AGENTS.md rules out. The Javadoc's routing
paragraph now names /malware-protection-plan next to /detector and /admin and
says GuardDutyRouteFilter keeps a same-named S3 bucket reachable. The
CloudFormation and plan integration tests import List and nullValue instead of
spelling them out.
* refactor(core): share signed-service route rewriting across DLM, GuardDuty and Resource Explorer 2
DlmRouteFilter, GuardDutyRouteFilter and ResourceExplorer2PathRewriteFilter each
repeated the same path test, credential-scope check and rewrite. They now
delegate to SignedServiceRoute in core.common.
The helper also reads the signing service from the X-Amz-Credential query
parameter when there is no Authorization header, as ServiceEnabledFilter does
(which now uses the same lookup), so a query-signed plan request reaches
GuardDuty instead of S3.
A request sent straight to an internal prefix that is not signed for the
service is refused as S3 refuses that bucket name, rather than reaching the
service's routes. Resource Explorer 2's prefix moves from /re2 to /_re2, since
re2 is a valid bucket name.
* feat(redshift): add snapshot copy and snapshot schedule operations
Terraform's aws_redshift_snapshot_copy, aws_redshift_snapshot_schedule and
aws_redshift_snapshot_schedule_association failed with InvalidAction because
the Query handler had no arms for these actions.
- EnableSnapshotCopy / DisableSnapshotCopy / ModifySnapshotCopyRetentionPeriod
store the copy settings on the cluster, and DescribeClusters reports
ClusterSnapshotCopyStatus while copy is enabled. RetentionPeriod defaults
to 7 and ManualSnapshotRetentionPeriod to -1. Faults follow the Redshift
model: SnapshotCopyAlreadyEnabledFault, SnapshotCopyAlreadyDisabledFault,
SnapshotCopyDisabledFault (modify), InvalidRetentionPeriodFault and
SnapshotCopyGrantNotFoundFault.
- Create/Describe/Modify/DeleteSnapshotSchedule and
ModifyClusterSnapshotSchedule. The association lives on the cluster, so
DescribeSnapshotSchedules derives AssociatedClusters (state ACTIVE) and
filters by ClusterIdentifier from it, and a deleted cluster cannot leave a
stale association. Deleting a schedule in use is refused with
InvalidClusterSnapshotScheduleState.
- Snapshot schedules take part in CreateTags/DeleteTags/DescribeTags as
resource type snapshotschedule.
No snapshot is copied to another region or taken on a schedule; the docs
say so.
* fix(redshift): reject malformed snapshot schedules and in-use copy grant deletion
* fix(redshift): validate snapshot copy region and snapshot schedule identifier
EnableSnapshotCopy now refuses a DestinationRegion that is not a published
AWS region with UnknownSnapshotCopyRegionFault (404), as the model lists.
CreateSnapshotSchedule now refuses a ScheduleIdentifier containing anything
but letters, digits and hyphens with InvalidParameterValue (400). The API
reference allows alphanumerics; the management guide's example uses a hyphen.
* feat(cloudformation): provision ElastiCache serverless caches
Add the AWS::ElastiCache::ServerlessCache provisioner on top of the serverless cache API, with dotted Endpoint.* and ReaderEndpoint.* Fn::GetAtt attributes, in-place modification, rejected immutable changes and replacement on rename.
* fix(cloudformation): reject a malformed NoPasswordRequired on ElastiCache users
* fix(cloudformation): restore serverless cache settings on a failed update and reset removed ones
* refactor(elasticache): inject ElastiCacheService once into the serverless service
* fix(cloudformation): replace a serverless cache on its create-only properties
Register AWS::ElastiCache::ServerlessCache in create-only-properties.json so a
change to ServerlessCacheName, SubnetIds, KmsKeyId or SnapshotArnsToRestore is
reported as a replacement instead of being applied in place or ignored.
Share one Docker availability probe across the ElastiCache integration tests and
validate the tag count in one place in ElastiCacheServerlessService.
* fix(cloudformation): reject custom-named serverless cache replacement on create-only properties
* fix(cloudformation): simplify serverless create-only update check and share replacement error
* fix(ec2): filter network interfaces by primary address association
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(ec2): synchronize EIP associations on supplied interfaces
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(ec2): require disassociation before release in nondefault VPCs
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(ec2): keep Elastic IP associations aligned with interface lifecycle
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(ec2): preserve retained interface association metadata
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
Use a nonblocking per-transaction lock so overlapping Data API calls fail instead of waiting. Skip active transactions during expiry cleanup and refresh their idle timeout after statements finish.
* feat(rds): engine versions, engine defaults and valid modifications
Serve DescribeDBEngineVersions, DescribeEngineDefaultParameters,
DescribeEngineDefaultClusterParameters and
DescribeValidDBInstanceModifications.
A curated engine catalogue lists one representative version per major
version Floci knows through its managed parameter and option groups.
Each version carries the parameter group family the create path computes
for it, its major version and its upgrade targets; each engine's default
is the version Floci creates when a request names none.
DescribeDBEngineVersions serves it with Engine, EngineVersion (exact or
major), DBParameterGroupFamily, DefaultOnly, the documented filters and
paging, and DescribeOrderableDBInstanceOptions now reads the same
catalogue.
The engine default calls check the family against the catalogue and
return an empty list, as Floci's default parameter groups hold no
parameters. DescribeValidDBInstanceModifications reports the instance's
storage type with a range from its current allocation to the engine's
maximum, and nothing for an Aurora instance.
Closes#5186
* feat(rds): one source for engine defaults, and engine version capabilities
Create paths, the cluster parameter group family check and global
clusters each kept their own default engine version, and Aurora MySQL's
disagreed with the catalogue: 8.0.36 against 8.0.mysql_aurora.3.05.2.
All four now read the catalogue's default, so a create that names no
version gets what DescribeDBEngineVersions reports with DefaultOnly.
DescribeDBEngineVersions and DescribeDBClusterEndpoints share one
offset paging helper and one MaxRecords check, which
DescribeEventSubscriptions also uses.
Each engine version now reports ExportableLogTypes,
SupportsLogExportsToCloudwatchLogs, SupportsReadReplica,
SupportedFeatureNames, SupportsParallelQuery, SupportsGlobalDatabases
and SupportsBabelfish, following what Floci supports.
* fix(rds): route the catalogue reads to RDS without a credential scope
DescribeDBEngineVersions, DescribeEngineDefaultParameters,
DescribeEngineDefaultClusterParameters and
DescribeValidDBInstanceModifications were missing from RDS_ACTIONS, so a
request with no credential scope reached SQS.
* fix(s3): keep versioned buckets until history is purged
Reject DeleteBucket while any account-scoped object metadata remains under the bucket prefix. Cover hidden versions and markers through service, HTTP, and persistent storage tests, and purge them in CLI and Java compatibility cleanup.
* test(s3): purge versioned enforcement fixtures
Delete every listed object version and marker before removing fixture buckets, repeating the first page so deletions do not invalidate continuation markers. Cover null versions, mixed history, and a page boundary inside one key with a direct bucket absence assertion; register the formerly exempt versioned fixture for cleanup.
* test(s3): assert fixture purge removes a null version
Seed an untouched object before enabling versioning and assert that ListObjectVersions reports its literal null version ID. This makes the direct purge guardrail exercise the null-version branch as intended.
* test(s3): encode versioned fixture keys during purge
* test(s3): share SDK bucket cleanup helper
* test(ec2): keep subnet range test secondary block in 10.0.0.0/8
* test(ec2): add same-range secondary blocks in subnet containment tests
* fix(ec2): enforce VPC IPv4 CIDR block association restrictions
* refactor(ec2): add Cidr4.rfc1918Range for the containing private range
* fix(ec2): classify VPC CIDR ranges by containment, not overlap
* test(ec2): drop the /0 primary case now that CreateVpc refuses it
* fix(route53resolver): require at least two IP addresses for CreateResolverEndpoint
A resolver endpoint's IpAddresses member is modeled min 2 / max 20, but the
emulator only rejected an empty list. A request carrying a single address (or
more than twenty) returned HTTP 200 and created the endpoint, which real AWS
refuses. Validate the count on CreateResolverEndpoint and raise the service's
existing InvalidParameterException, creating no endpoint on rejection.
Fixes#4774
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* refactor(route53resolver): fold the two endpoint body builders into one
The request member is modeled min 2 / max 20, so phrase the code and test
comments from the shape rather than the older min 1 note. Replace
createEndpointBody and endpointBody with a single builder taking the
member name, the creator request id and the address count.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Rekognition never looked at the image, so a WebP, a cut-off file, an
oversized Bytes payload or an S3Object that was never uploaded all got
the stub's success response. RekognitionImageValidator now checks every
image as Rekognition does, before the stub or mock response: base64
(SerializationException), Bytes length (ValidationException, every
violation in one error), the S3 object's existence and region
(InvalidS3ObjectException), JPEG/PNG structure
(InvalidImageFormatException) and the 10,000 pixel side limit
(ImageTooLargeException or InvalidImageFormatException, per operation).
Each rule was measured against Rekognition in us-east-2.
The cross-device redirect_uri was matched against the commercial
<region>.signin.aws.amazon.com only, so a login that resolved another
partition's Sign-In host was refused with invalid_request.
regen_partitions.py now reads botocore's signin endpoint ruleset and
vendors one signinHost per partition into aws/partitions.json. The
redirect is accepted on the Sign-In host of a region in the deployment's
partition, and another partition's host is refused. The device
authorization client ids keep their literals: the Sign-In model spells
them the same way in every partition.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(opensearch): serve the legacy Elasticsearch Service 2015-01-01 API
`aws es` and Terraform's aws_elasticsearch_domain call the 2015-01-01
API, which Floci did not route, so every call got
UnknownOperationException.
ElasticsearchController serves the domain lifecycle, ListDomainNames and
the tag operations on that path by delegating to OpenSearchController,
renaming only the members the legacy model spells differently:
ElasticsearchVersion (bare "7.10", stored as "Elasticsearch_7.10") and
ElasticsearchClusterConfig. A legacy create without a version gets
Elasticsearch 7.10 rather than the OpenSearch default.
* fix(opensearch): reject blank legacy ElasticsearchVersion, report legacy instance types
ElasticsearchVersionString's pattern matches no blank or non-string value, so
CreateElasticsearchDomain now returns ValidationException instead of storing
an empty engine version. ESPartitionInstanceType lists only *.elasticsearch
types, so the legacy responses rewrite the store's *.search spelling (including
the m5.large.search default). The legacy test methods get distinct @Order
values.
* fix(opensearch): store legacy .elasticsearch instance types as .search, accept OS_X.Y
The legacy API now respells ElasticsearchClusterConfig.InstanceType from
*.elasticsearch to *.search on create and update, so the 2021 API reports
t3.small.search and the legacy API maps it back. ElasticsearchVersion's
OS_X.Y form is stored as OpenSearch_X.Y instead of Elasticsearch_OS_X.Y.
Replaces the jakarta.ws.rs wildcard import with explicit imports.
* fix(ec2): remove the volume helper container on shutdown
The privileged helper that manages loop devices for EBS volumes was
started on the first volume operation and never stopped or removed, so
it kept running after Floci exited and stayed in the container list.
Ec2VolumeBlockDeviceManager now implements ContainerTeardown. On
shutdown and on a state reset it looks the helper up by name, detaches
the loop devices behind the backing files and removes the container. It
never creates a helper only to remove it, and it also collects one left
behind by an earlier process. Backing files stay in storage and the next
volume operation recreates the helper.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(ec2): leave no volume helper after a reset and report failed loop detaches
A state reset removed the helper in the container teardown and then
started it again to delete the backing files, so the reset ended with a
running helper. clear() now removes the helper once the files are gone.
The script that releases loop devices before the helper is removed
discarded every losetup failure, so the warning that follows could only
fire when the exec itself failed. It now records each loop device that
would not detach and exits non-zero, while still trying every device and
still removing the helper.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Without a usable credential scope, a Query request's service came from the action
name alone, first match wins. Wherever two services define the same name, the later
one was unreachable on that path: an unsigned ElastiCache CreateUser created an IAM
user, SQS AddPermission was answered by SNS, and RDS, ElastiCache and CloudWatch
ListTagsForResource all reached SNS. The parity test pinned 18 such names as claimed
by another service.
Every Query client sends its service's API version as the Version form field, and
those are distinct per service in botocore's models, so Version now chooses among the
services that serve the name, the way isElbClassicRequest already splits the two ELB
APIs. SES and Elastic Beanstalk publish the same version and share no action name, so
the action settles which one a request is for. A Version naming a service that does
not serve the name, or no Version at all, leaves the existing order to decide, so a
request that omits the field routes exactly as before.
IamEnforcementFilter resolves through the same AwsQueryServiceResolver and reads
Version from the form body the way it reads the action, first occurrence, as the
controller's getFirst does. A request is therefore authorized under the namespace of
the service that runs it, which the new enforcement tests hold in both directions.
The if-chain becomes one ordered table of services, each with the API versions its
clients declare and the names it serves, which both paths read, so the order and the
versions cannot drift apart. SQS gets a set for the first time and is tried last, so
by name alone it still takes only what nothing else defines, and its Version wins back
the two names SNS shares.
The parity test now routes each handler's actions with that service's own Version,
and states the versions itself rather than reading them back from the controller. It
also routes them without a Version, where a name two services share may go to either,
but has to reach one whose handler dispatches it. 16 of the 18 claimed entries leave
the gap file. The other 2 are SQS AddPermission and RemovePermission, which without a
Version still reach SNS, whose handler does not implement them. The file is down to
173: those 2 and 171 names missing from their own service's set.
Refs #5032
ChangePassword was the last IAM operation held back for a reason that turned
out not to hold. It was tracked as blocked on disambiguating a shared Query
action name by Version, because Cognito publishes the name too. In fact IAM
sits second in inferServiceFromAction's chain and Cognito ninth, and Cognito's
form path answers UnsupportedOperation to every request, so adding the name to
IAM_ACTIONS routes it to IAM and costs Cognito nothing. A request carrying a
credential scope never reaches that chain at all.
The operation takes no UserName. The API reference says it changes the password
of the IAM user who is calling, and the CLI reference adds that it "can be
called by IAM users only. If this command is called using AWS account (root)
credentials, the command returns an InvalidUserType error", so a signing key
with no stored user behind it, which is Floci's stand-in for that caller,
answers InvalidUserType rather than reporting the key as missing. The resource
the request is evaluated against needed nothing new: ResourceArnBuilder already
resolves the signing user for an action whose UserName is absent, and the
vendored action map already authorizes ChangePassword against a user.
OldPassword is checked against the stored login profile before the new password
is held to the account password policy, so a caller who cannot prove the
current password learns nothing about what that policy requires. A mismatch is
the one refusal the reference leaves unnamed: every error it publishes for this
operation describes something else, so this answers InvalidParameterValue, the
common error type AWS publishes for a parameter value a service cannot accept.
A successful change clears PasswordResetRequired, which is what lets a user
whose password an administrator reset restore their own console access
programmatically, and it moves the password_last_changed the credential report
reads.
The passwordType shape check is now shared and names the member that failed,
because this operation has two password members and a caller told that
'password' failed would have to guess which. An absent member and an empty one
stay different answers.
Two things the login profile needed before a self-service change could be
trusted. The comparison and the write are one step under a new
loginProfileLock, which every login-profile writer takes: read apart from the
write, two requests presenting the same valid old password both pass the
comparison and both are told they set the password, while only the later write
survives, and a guard one writer skipped would leave a racing UpdateLoginProfile
free to overwrite a password a ChangePassword had just promised. And
PasswordReusePrevention is now enforced, on UpdateLoginProfile as well, the two
sharing one bounded history per profile: the reference defines the value as "the
number of previous passwords that IAM users are prevented from reusing" and
makes no window mean no prevention. The password the profile holds is refused
alongside the superseded ones, which the reference leaves open; read the other
way the smallest window the policy accepts would allow setting a password to the
value it already has, and would not refuse the change away and straight back
that the setting is for.
Twelve unit tests, one concurrency test and six integration tests, with each
guard probed by reverting it alone: dropping the old-password comparison, the
reset-flag clear, the policy check or the check order is caught by the test
written for it, and dropping the routing entry leaves the unsigned request
answered by Cognito, which is what the routing parity test says too. Dropping
the lock leaves five of twenty-four racing requests all told they succeeded with
one password stored, neutering the reuse check leaves both refusals silent, and
widening the window by one lets it reach a password that has left it. 1668
tests across all 98 IAM and query-routing classes pass at this commit.
docs/services/iam.md documents the operation, the judgements, and the one thing
Floci still does not model. AllowUsersToChangePassword is accepted and reported
but grants nothing:
the user guide says the option gives all users in the account access to
iam:ChangePassword for only their user and to iam:GetAccountPasswordPolicy,
applied at the account level rather than by attaching a policy, while Floci
authorizes both from identity policies alone, so under enforcement a caller
needs a policy naming their own user however the flag is set. The matrix row
moves 166 to 167.
Was hardcoded to 0L unconditionally. Generic-format bytes are summed live from
the still-existing PublishPackageVersion records (packageVersions), the same
lazily-computed-not-cached pattern repositoryCount already uses. Scoped per
still-live repository rather than one scan over the whole domain, matching
every other read path's own per-repository prefix.
Maven, npm, and pypi have no such record to sum: their publishes go straight to
their own sidecar (Reposilite/Verdaccio/pypiserver) and never create one. Each
proxy now reports its own successfully-written byte count directly through a new
recordContainerBackedAssetBytes, keyed exactly like packageOriginConfigs
(region/domain/repository/format/namespace/package, no version), only once it has
already decided, in its own terms, that a real write just happened:
- Maven: ReposiliteSidecarClient.deployArtifact now returns a DeployOutcome
(status plus whether it actually wrote new content), so the idempotent-match
short-circuit and a genuine redeployment:false conflict both correctly add
nothing. CodeArtifactMavenController parses the GAV path into namespace/package
name, including a group/artifact-level maven-metadata.xml upload, which it
attributes correctly once the metadata filename itself (not the segment count)
tells it apart from a real versioned asset.
- npm: NpmPublishEnvelopeScanner's attachment digest loop now also counts the
real decoded byte count alongside its SHA-512, so a multi-attachment publish is
sized by its actual tarball bytes, not the base64-and-JSON envelope. Recorded
only after Verdaccio's own response confirms a 200/201, off the event loop
(vertx.executeBlocking, on principle, even though the call itself is cheap); the
confirmed-republish short-circuit and a native Verdaccio rejection both add
nothing. A native npm unpublish (Verdaccio's unpublish:$all, bypassing this
service entirely) is detected separately and cleaned up the same way DeletePackage
would have.
- pypi: recorded after a real forwarded upload succeeds, under pypiserver's own
PEP 503 normalized name so an upload and a later delete spelled differently
still address the same count; the byte-identical idempotent short-circuit and the
different-content 409 both add nothing.
DeleteRepository and DeletePackage both clean up every format's own records
(packageVersions and its asset content included) by the same name-based
prefix/key, so a repository or package recreated under the same name never
inherits a predecessor's bytes. A per-package deletion fence, bumped only by an
actual delete (DeletePackage, or a native npm unpublish), replaces a sidecar
existence re-check for the race between an in-flight publish's own accounting and
a concurrent delete: comparing a snapshot taken before the real write against the
fence's current value catches "deleted" and "deleted and republished under the
same name" alike, with no network round trip needed to do it, so nothing here
holds the service-wide lock across a sidecar call. containerBackedAssetBytes
itself is kept in memory only, like the fence, not through StorageFactory: the
sidecar content it counts does not survive a Floci restart either, so neither
does the count.
Verified against real Reposilite, Verdaccio, and pypiserver containers (not just
mocks): each Docker-gated integration suite asserts assetSizeBytes increases by
exactly the real published/uploaded byte count, stays unchanged across an
idempotent retry, and drops back down after a real delete, native unpublish
included.
Known limitations documented: a maven-metadata.xml for a versioned snapshot is
attributed to its version string rather than its real artifact name (still counted
correctly in the domain total, just under a misnamed bucket nothing else looks up
by name); unpublishing a single version of a multi-version npm package is not
detected (this accounting is per-package, not per-version, so there is no
narrower count to subtract from regardless).
Addresses hectorvent's review on the PR: rebased to pick up #5102's
Digests.sha256Hex (the tests were merging clean but failing to compile against
current main), stopped containerBackedAssetBytes from surviving a restart the
content it counts does not, and closed the native-npm-unpublish gap in the
fence's own soundness argument.
SendEmail, SendRawEmail and SendTemplatedEmail (v1) and SendEmail (v2)
accepted any Source or FromEmailAddress, so a send from an address that
was never verified succeeded and landed in /_aws/ses. The SendEmail API
Reference says "The message must be sent from a verified email address
or domain", and AWS rejects anything else with MessageRejected.
The send path now checks every address the developer guide names for
this error ("This error could apply to the "From", "Source", "Sender",
or "Return-Path" address"): the Source or FromEmailAddress, the
ReturnPath or FeedbackForwardingEmailAddress and, on a raw message,
every mailbox of its From header, its Sender and its Return-Path
header. A v2 raw send reads the From header only in place of a missing
FromEmailAddress and accepts any From header when one is given
(probe-confirmed), so the header is checked only then. An address
counts as verified when the address itself, its domain or a parent
domain is a verified identity ("if you create and verify an identity
for example.com, you don't need to create separate identities for
a.example.com, a.b.example.com, user@example.com, user@a.example.com").
The error matches AWS: one MessageRejected, "Email address is not
verified. The following identities failed the check in region
US-EAST-1: <address>, <address>", and nothing is captured or relayed.
The check runs after the request's own validation, so the existing
error order is unchanged.
A delegate sender names the owner's identity with SourceArn, FromArn
and ReturnPathArn, their X-SES-SOURCE-ARN, X-SES-FROM-ARN and
X-SES-RETURN-PATH-ARN headers, or v2 FromEmailAddressIdentityArn and
FeedbackForwardingEmailAddressIdentityArn. These are now read (a
parameter wins over its header, and only the first instance of a header
counts), and an address covered by another account's identity ARN is
not checked against the caller's identities. Floci does not evaluate
sending-authorization policies, so it lets such a send through, as it
did before. On a raw send the source ARN also covers the From and
return-path addresses that have no ARN of their own, as SendRawEmail
describes.
Cognito's verification codes and invitations go through SES too, from
Cognito's own no-reply@verificationemail.com or a pool's
EmailConfiguration sender that Cognito has already found verified. They
now use a separate entry point, sendServiceEmail, that skips the check.
Tests and compatibility tests that sent from an unverified address now
verify it first; where a test sent from an address under a domain
identity, the domain is verified by publishing its DKIM records, since
Floci keeps a domain Pending until they exist. SesDomainIdentityTestHelper
does that, and the two copies of the same setup in the configuration-set
tests and the one in SesV2IntegrationTest now use it.
Closes#5141
The AWS CLI builds the cross-device redirect from the Sign-In endpoint
it resolved, so with --endpoint-url it sends Floci's own address plus
/v1/sessions/confirmation. Floci accepted only an https AWS sign-in host
there and served no confirmation page, so the authorize request was
refused and the remote login could not finish.
A cross-device redirect is now also accepted on the scheme, host and
port the authorize request arrived on, and GET /v1/sessions/confirmation
shows the verification code in the form the CLI decodes. Any other
origin is still refused.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
With floci.partitions.allow-unknown-regions on, a request signed for a
region no partition publishes is served in the deployment's partition,
and its ARNs are minted there. DescribeRegions picked its partition
with forRegionOrCommercial instead, so on a China deployment such a
request listed the commercial regions, and disagreed with the Step
Functions aws-sdk:ec2:describeRegions integration.
The handler now asks RegionResolver for the partition the request is
scoped to. A published region still lists its own partition.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The certificate check on ModifyListener runs twice: once outside IAM's
certificate lock, where it keeps the error precedence AWS has, and once under
the lock, where it is atomic with the write. The second one sat behind the port,
protocol and SSL policy setters, so a DeleteServerCertificate landing between
the two answered CertificateNotFound on a listener that had already moved to its
new port. The comment above the first check says no refusal leaves the listener
changed, which only held for the check it sits on.
Every setter now runs inside the guard, behind the re-check, so a refusal either
lands before anything is written or does not land at all. The guard is still
taken for the certificates the request records, which are the only ones a delete
can race: one the listener already holds is a reference DeleteServerCertificate
finds, and it refuses to delete it. The re-check covers the effective list,
which is what a protocol flip putting the stored certificates into service
needs, so that path is checked under the lock too rather than once on the way
in.
The restartDataPlane local is gone, because a lambda cannot assign a local and
portChanges already says the same thing at the one place it was read.
Two unit tests, both of which fail without the change: a refused modify leaves
the port, protocol, policy and certificates alone and does not restart the data
plane, and a protocol flip refused the same way leaves the protocol alone. The
resolver they wire finds the certificate once and not again, which is what a
delete landing between the two checks looks like from inside the call.
docs/services/elb.md records the guarantee next to the lock it comes from.
Follow-up to the review note on #5474.
* fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists
* fix(elasticache): tolerate UserNotFound on CFN user delete and fix SDK test assertions
The CloudFormation user delete still tolerated the old UserNotFoundFault
code, so deleting a stack whose user was already gone would report
DELETE_FAILED. The SDK compatibility test also asserted
UserAlreadyExistsException on the duplicate replication group test
instead of the duplicate user test.
* feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory
The AgentCore control plane is emulated but had no CloudFormation provisioner,
so the three types fell through to the generic stub that exposes only Arn and
a template using Fn::GetAtt [Memory, MemoryArn] in an IAM policy failed the
stack. BedrockAgentCoreCfnProvisioner maps every template property the
services can store onto CreateAgentRuntime / CreateAgentRuntimeEndpoint /
CreateMemory, publishes Ref as the registry schema's primaryIdentifier and
Fn::GetAtt for every read-only property, updates in place when the
create-only properties are unchanged and replaces otherwise, and deletes on
stack teardown. Properties the emulated services have no model for are logged
once at warn and listed in the docs.
* fix(cloudformation): make AgentCore updates rollback-aware and authoritative
Reachable through CfnProvisionerFixture (two-service inference arm). In-place
updates snapshot the prior runtime, endpoint and memory configuration and tags,
restore them on rollback, and delete a created entity when a later step of the
same provision fails. The template is authoritative: UpdateAgentRuntime replaces
the full configuration as AWS's PUT does (omitted authorizer, protocol and
environment are cleared on the SDK path too), and the partial-update Memory and
Endpoint calls get a replace-omitted overload for the provisioner. Nested
AWS::NoValue members are omitted rather than stored blank, and the control
service validates networkMode and serverProtocol with the API's
ValidationException wording.
* fix(cloudformation): accept AGUI runtimes and share the guarded provision helper
The protocol check left out AGUI, which the AgentCore API and the Runtime
schema allow, so an AG-UI runtime was refused through the API and in a stack.
Ec2NetworkCfnProvisioner and BedrockAgentCoreCfnProvisioner carried the same
guarded helper; it now lives on CfnRollback, taking the provisioner's
in-place undo as a callback, and both use it.
* fix(elbv2): honor SubnetMappings in CreateLoadBalancer and SetSubnets
CreateLoadBalancer and SetSubnets only read Subnets.member.N, so a
network load balancer created with SubnetMappings (the form the AWS Load
Balancer Controller always sends) had no availability zones and an empty
VpcId. The mappings' SubnetId values are now used as the subnet list, and
passing both Subnets and SubnetMappings is rejected with the AWS
ValidationError message.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(elbv2): require every subnet mapping to carry a SubnetId
A mapping member with only AllocationId was silently dropped, so Subnets
plus an allocation-only mapping slipped past the mutual-exclusion check
and a later mapping member with a SubnetId was ignored. Detect mapping
presence from the request keys and reject a member without SubnetId with
the AWS ValidationError text.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>