* fix(appconfig): serve legacy deployed configuration requests
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(appconfig): keep 404 for an unknown application or profile
GetConfiguration now maps only a missing environment to
BadRequestException, as a missing or undeployed environment was
observed on AWS. An unknown application or configuration profile stays
ResourceNotFoundException (404), as the API reference lists.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(appconfig): note GetConfiguration error codes
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* feat(rds): refuse role feature names the engine does not support
AddRoleToDBInstance, AddRoleToDBCluster and CreateDBCluster
AssociatedRoles stored any FeatureName, so Lambda on a MySQL instance
was accepted although MySQL supports no role features.
A FeatureName now has to be one the engine lists in
SupportedFeatureNames, matched without regard to case, or the call is
InvalidParameterValue; CreateDBCluster refuses before any cluster
exists. A cluster role with no feature, and an engine the catalogue
does not list, are left alone. Aurora PostgreSQL also lists Bedrock,
which the Aurora user guide offers next to Comprehend and SageMaker.
Closes#5631
* refactor(rds): keep the two-argument cluster role check
Callers that check an AssociatedRoles list without knowing the engine,
such as the CloudFormation provisioner in #5656, keep the signature they
compile against; it runs the same checks without the feature check.
* fix(rds): match feature names without regard to case in every role check
The supported-feature check matched without regard to case, but the
instance duplicate check and both removal lookups compared exactly, so
an instance could take s3Import and then s3import as two roles. All of
them now match the same way. The two-argument cluster role check, which
nothing here calls, is removed.
* feat(dynamodb): add typed time-to-live operations to the table access
DynamoDbTableAccess gains timeToLive and updateTimeToLive next to the
stream operations. The native engine reads the TTL flag and attribute
from the table definition and calls DynamoDbService.updateTimeToLive
under the scope's account; the Local engine sends DescribeTimeToLive
and UpdateTimeToLive.
* fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables
An AWS::DynamoDB::Table declaring TimeToLiveSpecification reached
CREATE_COMPLETE while DescribeTimeToLive answered DISABLED, because the
provisioner never read the property.
The provisioner now reconciles TTL against what the table reports, so
UpdateTimeToLive is called only when the setting differs: enabled turns
it on, Enabled false or a block removed on an update turns it off with
the current attribute name, and renaming an enabled attribute fails with
the DynamoDB ValidationException before anything changes. Enabled with
no AttributeName fails with ValidationError before the table is created.
An in-place table update now records the tags, stream and TTL setting
it replaces, and rollbackUpdate puts all three back, so a stack whose
update fails on a later resource ends UPDATE_ROLLBACK_COMPLETE instead
of UPDATE_ROLLBACK_FAILED. A restore that throws keeps the snapshot.
* fix(cloudformation): roll back and clean up failed DynamoDB table provisions
A table's in-place update that failed after its snapshot, for example on
UpdateTimeToLive after the tags and the stream had changed, lost the
snapshot: the engine put the previous resource back and reported
UPDATE_ROLLBACK_COMPLETE with the changes still live. The provisioner
now retains a failed attempt that carries its snapshot, so the engine
hands it to rollbackUpdate. A failure before the snapshot changed
nothing and still uses the engine's restore.
A provision that failed after createTable left the new table behind,
on create and on a replacing update alike. The provisioner now deletes
a table this attempt created, tolerating ResourceNotFoundException, and
never one it adopted or updates in place. A delete that fails is logged
and leaves the physical id and the rollback ownership marker, so the
stack's create rollback retries it. A table recreated because the
update target was gone takes no snapshot, since it has no prior state.
* fix(cloudformation): match the AWS status reasons for invalid TimeToLiveSpecification
Renaming an enabled TTL attribute and enabling TTL without an
AttributeName now fail with the handler message AWS CloudFormation
reports, as measured in eu-west-1, and with its InvalidRequest handler
error code. The resource status reason is the AWS inner text exactly;
the type and logical id prefix are gone, since AWS does not include them.
* fix(cloudformation): scope DynamoDB table TTL to the stack and validate Enabled
- An update leaves TTL alone when neither the template nor the previous
one declared TimeToLiveSpecification, so TTL enabled outside the stack
survives, as on AWS.
- A TimeToLiveSpecification without Enabled, or with a non-Boolean one,
fails model validation before the table is created.
- A replacing update whose created table cannot be deleted reports a
rollback failure naming the table instead of leaving it untracked.
* fix(rds): list Aurora engines in DescribeOrderableDBInstanceOptions
DescribeOrderableDBInstanceOptions returned nothing for aurora-mysql or
aurora-postgresql, so clients that pick an instance class from the
orderable list could not create Aurora cluster instances. Add the
default Aurora MySQL (8.0.mysql_aurora.3.05.2) and Aurora PostgreSQL
(16.3) versions with db.t3.medium, db.t4g.medium, db.r5.large and
db.r6g.large.
* fix(ec2): honour block-device-mapping.volume-type in DescribeImages
The filter fell through to the default case and matched every image.
Registered images now match on any block device mapping's EBS volume
type, mirroring block-device-mapping.snapshot-id. Catalog images model
no block devices, so an optional rootVolumeType catalog field carries
the type where the AMI name states it (gp2 for the Amazon Linux 2
image, gp3 for the hvm-ssd-gp3 Ubuntu images); images without it match
no value. DescribeImages output is unchanged.
* fix(rds): report general-public-license for aurora-mysql orderable options
* fix(ec2): carry catalog root volume type into the image's EBS mapping
* fix(ec2,rds): address review on catalog AMI mappings and Aurora default version
- Catalog AMI root mappings no longer advertise an invented SnapshotId that
DescribeSnapshots cannot resolve (EbsBlockDevice.SnapshotId is optional);
a copy or capture still mints a real root snapshot.
- RunInstances sizes the root volume type from the AMI's root mapping,
falling back to gp3, so the gp2 catalog AMI launches a gp2 root.
- aurora-mysql defaults to 8.0.mysql_aurora.3.05.2, the version
DescribeOrderableDBInstanceOptions lists.
* test(ec2): assert the volume-type filter, not a single gp2 volume
Instances launched earlier in the class now get gp2 roots from the gp2
catalog AMI, so filtering on gp2 returns several volumes. Check every
result is gp2 and the created volume is among them.
* test(rds): read EngineVersion with XmlPath, import RequestSpecification
* fix(ec2): honour a RunInstances root BlockDeviceMapping volume type
A request BlockDeviceMapping naming the AMI's root device overrides the
AMI's root VolumeType, as on AWS; previously the launch always took the
AMI mapping, so a gp3 root on the gp2 Amazon Linux 2 AMI came out gp2.
* test: explicit RequestSpecification type in Ec2IntegrationTest (NoVar checkstyle rule)
* refactor(ec2): fold RunInstances BlockDeviceMappings into the placement overload
Adds the mappings parameter to the existing hostId/tenancy overload
instead of a new one, and updates the two callers that named that
signature: Ec2RunInstancesPublicIpParamTest's stub/verify (whose
unmatched stub returned null and NPE'd the handler) and the
dedicated-host race test.
* fix(ec2): apply launch template block device mappings and capture the real root type
RunInstances and CreateFleet now layer the request's BlockDeviceMappings
over the launch template's (a request entry for a device replaces the
template's), so a template asking for a gp3 root is honoured instead of
the AMI's gp2. CreateImage records the instance's actual root volume type
on the new AMI's root mapping rather than the source AMI's.
A mapping naming a VolumeType outside the model's enum (standard, io1,
io2, gp2, sc1, st1, gp3) is rejected with the same InvalidParameterValue
ModifyVolume returns, through one shared check.
The RunInstances-only parser is gone: request mappings are read by the
launch template parser, which already treats every member as optional.
* test(rds): fold the Aurora default-version orderable check into RdsCatalogueReadIntegrationTest
* fix(autoscaling): launch group instances with the template's block device mappings
Auto Scaling scale-out now hands the launch template's BlockDeviceMappings
to runInstances, as RunInstances and CreateFleet do, so a group launched
from a template that asks for a gp3 root gets a gp3 root instead of the
AMI's type. Mixed-instances templates take the same path; launch
configurations pass none.
* test(ec2): template devices the request does not name still apply
Covers a launch whose request maps only a data device: the template's
root mapping still sets the root volume type. Also covers a template
naming an unknown VolumeType, which CreateLaunchTemplate stores and the
launch rejects; the EC2 docs paragraph now says so and is rewrapped to
the file's width.
* fix(ec2): merge launch template block device mappings field by field
EC2 documents template block device overrides per member: a request entry
for a DeviceName the template maps changes only what it sets, and every
other member keeps the template's value. The merge replaced the whole
entry, so a request that only resized the root dropped a template's gp3.
The merged entry is now built from a copy of the template's, overlaid
member by member, leaving the stored template untouched.
* fix(accessanalyzer): route GetAnalyzer through GET /analyzer/<name>
Adds getAnalyzer service method and GET /analyzer/{analyzerName} endpoint
in AccessAnalyzerController to return analyzer details. Returns
ResourceNotFoundException (404) when analyzer does not exist. Adds
integration tests for retrieval and not found cases.
Fixes#5353
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* docs(accessanalyzer): sync the action table for GetAnalyzer
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): share not-found helper and align docs/service matrix
Extract a shared analyzerNotFound helper that returns ResourceNotFoundException
with resourceId/resourceType (analyzer) for both get/delete. Remove trailing
blank lines from the controller. Update docs/services/index.md to list 4
operations. Run make docs-sync to keep action tables in sync.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): reuse getAnalyzer in deleteAnalyzer and assert not-found fields
deleteAnalyzer repeated getAnalyzer's validate-and-lookup; it now calls
getAnalyzer before deleting, so the lookup and the not-found error live in
one place. The 404 test now checks the resourceId and resourceType the
shared helper adds, and the stray blank line before the class's closing
brace is gone.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): implement GetRequestedServiceQuotaChange
RequestServiceQuotaIncrease now persists the requested change so
GetRequestedServiceQuotaChange can read it back by id. An unknown request
id returns NoSuchResourceException, matching AWS.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): unique id, region-scoped storage, history reads store; tests and docs
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): update consumer test for UUID ids and distinct requests
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): refuse a second open increase request per quota
AWS allows only one open service quota increase request per quota, so a
repeat for the same quota in the same region must return
ResourceAlreadyExistsException. Since every request stays PENDING, the
duplicate check and the store are now one atomic unit under a lock, closed
over the per-region store.
Tests that asserted distinct ids now assert the exception, and the two
@QuarkusTest classes reset emulator state before each test so an open
request left by one test cannot refuse the next.
Move the service test's private in-memory StorageFactory into
io.github.hectorvent.floci.testing as a shared helper; migrating the other
copies is a follow-up.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(rds): inherit cluster IAM settings for new members
* fix(rds): keep new member authentication in step with cluster changes
* fix(rds): allow metadata reads during member creation
* fix(rds): keep member creation consistent with lifecycle changes
* fix(rds): preserve metadata access during instance reboot
* fix(rds): use one cluster state for member creation
* test(rds): check IAM authentication consistently
* fix(ses): delete by id and filter by source in /_aws/ses
The inspection endpoint follows LocalStack's contract, as
docs/services/ses.md says, but differed from it in two ways. LocalStack
documents that "The query parameter id can be used to delete only a
specific message", and that "Query parameters id and email can be used
to filter by message ID and message source respectively".
- DELETE /_aws/ses?id=<id> cleared every message. It now deletes only
that message, in whichever region it was sent. An unknown id deletes
nothing.
- GET /_aws/ses?email=<address> matched the address against each
message's ToAddresses. It now matches the message's Source, as
LocalStack does.
GET also listed messages in storage hash order. It now lists them
oldest first by Timestamp, the order LocalStack keeps them in.
Floci's own tests read Cognito codes and other mail with
?email=<recipient>. They now list the mailbox and pick the recipient's
messages out of it, through a new SesMailbox test helper in src/test and
the same filtering in the Java and Node compatibility tests. A raw
send's mailbox entry shows RawData without its recipients, so the test
for recipients read from a raw message's headers checks the stored
record.
* fix(codeartifact): run the pypiserver sidecar under an init process so a stop ends it at once
The pypiserver image's entrypoint execs pypi-server, which installs no SIGTERM handler. The kernel
gives PID 1 no default signal actions, so the container ignored every stop request and went only
when Docker sent SIGKILL at the end of the 5-second timeout: each reset, repository delete and
shutdown waited that long for every pypi repository's container, one after another.
ContainerBuilder gains withInit(), carried on ContainerSpec as init and passed to Docker as
HostConfig.Init (docker run --init), and PypiserverSidecarManager uses it. Docker's init runs as
PID 1 and forwards the SIGTERM, so a stop now returns in a fraction of a second. Verdaccio already
handles the signal itself and is unchanged.
* fix(firehose): check buffers every second so delivery follows the buffering interval
AWS delivers a Firehose buffer once the first buffer condition is met. Floci checked for elapsed
buffering intervals on a 10-second tick, so a buffer was delivered up to 10 seconds after its
IntervalInSeconds ended: a 5-second interval landed anywhere from 5 to 15 seconds after the first
record. The default tick is now one second; the check is a scan of the in-memory buffers.
FirehoseFlushIntegrationTest's profile only set the same one-second tick, so it is removed and the
class shares the default test application. The compat tests that wait for a delivery checked S3
every 2 or 5 seconds; against Floci they now check every 250 ms, and keep their cadence against
real AWS.
* test: make subclass mocks the default so mocking stays cheap in a loaded test JVM
Mockito's default inline mock maker redefines every class it mocks in the running JVM. A
redefinition gets slow once the test JVM has loaded the Quarkus applications of the classes that
ran before, which in CI is most of the run: a unit class's first test spent seconds building its
mocks, and EmulatorLifecycleTest, which mocks some fifty types, spent 22 seconds. Subclass mocks
generate a subclass instead and redefine nothing. After twelve Quarkus applications in one JVM, the
fourteen Mockito classes whose first test was slowest in CI take 20.5 seconds instead of 41.9, and
their first tests 6.9 seconds instead of 27.8.
mockito-extensions/org.mockito.plugins.MockMaker makes the subclass mock maker the default. A
subclass cannot extend a final class, record or enum, so those mocks go through
InlineMocks.inlineMock and inlineSpy, or @Mock(mockMaker = MockMakers.INLINE), and
EmulatorLifecycleTest's static mock of Quarkus asks for the inline maker. The ContainerSpec mocks
a mocked ContainerBuilder.Builder returned were opaque values, so they are real specs now.
* fix(cloudformation): leave the last rollback's failed delete to ContinueUpdateRollback
#4949 refuses an update over UPDATE_ROLLBACK_FAILED until ContinueUpdateRollback finishes the
rollback, as AWS does. #4834, merged minutes earlier, had seven tests that update over that
status, and main has failed them since c4a809f47.
Six are in CloudFormationSchedulerScheduleIntegrationTest. They now reach their next update the
way AWS requires: ContinueUpdateRollback, which retries the schedule's own rollback, or, where the
replacement's delete has to keep failing, a skip of the schedule. The two whose update was meant to
be blocked by the pending rollback now check that the update is refused.
The seventh shows a real clash. #4949 made a second ReplacementCleanup.rollback retry the delete
the first one could not make, which is ContinueUpdateRollback's job. The Scheduler provisioner also
calls rollbackUpdate inside an update, to undo its own failed call, so after a skip a failed group
move deleted the earlier orphan there and then, and a failure of that delete would have failed the
move's restore. An update now ends that retry as it starts, through
ReplacementCleanup.endRollbackRetry, so the orphan stays owed for the next committed update or the
stack delete, as both changes document.
Three more provisioners roll an update back before ReplacementCleanup.record has cleared the retry,
and each returns as soon as the retry ran, skipping its own restore. CloudWatchDashboard and
IotAuthorizer unwind a failed in-place update that way, and CognitoResourceServer's failed attempt
is rolled back the same way, so after a skip the update's snapshot was never put back while the
resource was reported restored. They end the retry as an update starts too.
---------
Co-authored-by: Priamo <pgermosen@gmail.com>
* fix(cloudwatch): route public Query GET requests correctly
Reuse Query dispatch and IAM classification for supported CloudWatch GET requests while preserving S3 and presigned URL routing.
* test(cloudwatch): verify Query header name casing
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): match signed Query GET errors and add SDK coverage
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(test): isolate TLS fixtures and escape invitation passwords
Signed-off-by: Andre Kurait <akurait@amazon.com>
* chore: declare directly used dependency APIs
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): enforce Query GET authentication and IAM policies
Signed-off-by: Andre Kurait <akurait@amazon.com>
* chore: follow existing framework dependency declarations
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): simplify signed Query GET routing
Reuse the existing presigned credential resolver and let the signing scope select CloudWatch before browser or target headers. Match the current and legacy API versions observed in AWS, and cover header/presigned IAM checks. Remove unrelated CI fixture changes from this PR; they remain on the ASG branch.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): isolate Query GET routing and authentication
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cognito): refuse user pool custom domains in GovCloud
The AWS GovCloud (US) User Guide lists "Custom domains for user pools are
not available" among the Cognito differences
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-cog.html),
but CreateUserPoolDomain and UpdateUserPoolDomain treated a
CustomDomainConfig the same in every partition. In a GovCloud region the
request only failed later, on the us-east-1 certificate check, with a
message about the certificate rather than about the feature.
Both operations now refuse a CustomDomainConfig when the request region is
in aws-us-gov, before the certificate is looked at, with an
InvalidParameterException, which the cognito-idp model declares for both.
No source shows AWS's message, so the wording is Floci's own, as for the
API Gateway EDGE gate. Prefix domains keep working in GovCloud. EUSC is
left as it is because no source covers it, and China and the ISO
partitions have no user pools.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(cognito): refuse user pool custom domains in EUSC too
The European Sovereign Cloud guide lists user pool custom domains as not
available, in the same words as the GovCloud guide, so a
CustomDomainConfig in eusc-de-east-1 is now refused with
InvalidParameterException instead of falling through to the us-east-1
certificate check.
The issued-certificate ACM stub the user pool domain unit tests each
carried a copy of moves to one helper, CognitoCertificateStubs.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The AWS GovCloud (US) User Guide lists "AWS Lambda Function URLs is not
available"
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-lambda.html)
and the China guide "Amazon Lambda Function URLs is not available in the
China Regions"
(https://docs.amazonaws.cn/en_us/aws/latest/userguide/lambda.html), but
CreateFunctionUrlConfig created one in every partition, on a host no
source publishes for either of them.
CreateFunctionUrlConfig now refuses a request whose region is in
aws-us-gov or aws-cn with an InvalidParameterValueException, which the
lambda model declares for the operation. No source shows AWS's message,
so the wording is Floci's own, as for the API Gateway EDGE gate. The
AWS::Lambda::Url provisioner creates through the same service method, so
a stack in those partitions fails with that error. Get, Update and Delete
act on an existing config and are unchanged. The ISO and EUSC partitions
are left as they are because no source covers them, and the open
question about the function URL host now names only those two.
The Java compat suite skips LambdaFunctionUrlTest in those two partitions,
so the China partition nightly stays green.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Under enforcement a request naming its operation, in a Query Action or an
X-Amz-Target header, was authorized as <namespace>:<Operation>, the operation's
own name. AWS authorizes some operations as an action of another name: SQS
SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch as
sqs:SendMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility, and SNS
PublishBatch as sns:Publish. None of the batch names is an IAM action, so a policy
AWS honours for a batch call was denied, and a policy naming the batch operation
granted something AWS does not check.
AWS publishes the mapping in the Operations of each Service Reference file.
tools/aws/regen_iam_authorized_actions.py vendors the operations authorized by
exactly one action of their own namespace under another name, 235 over 33
namespaces, into src/main/resources/aws/iam-authorized-actions.json. Everything else
keeps its own name. The generator leaves out operations that list:
- several actions, whose extras apply only when tags or a role are passed;
- no action, which is missing data;
- an action of another namespace;
- another action while one of the operation's own name exists;
- a tagging action alone;
- the same action for several SDK clients, which AWS can authorize differently,
as S3 and S3 Control's GetPublicAccessBlock;
or whose name is listed again with another answer. A record of the wrong shape
fails the run instead of being skipped.
make iam-authorized-actions-check gates the file's shape on pull requests that touch it, and
iam-authorized-actions-verify, run by the IAM Data Drift workflow, checks every
entry against AWS.
IamAuthorizedActions reads the file through the new core.common
VendoredResources, rather than adding one more copy of the read-or-fail block a
dozen catalogs carry, and the Query and X-Amz-Target paths ask it for the action.
DynamoDB TransactGetItems, which AWS authorizes as dynamodb:GetItem, keeps its own
name: the transaction check recognizes the call by it and checks every Get as
dynamodb:GetItem on its own table, with its own dynamodb:LeadingKeys. Renamed, the
call would skip that check and be authorized as one GetItem whose body has no
top-level Key, which a ForAllValues condition accepts, so a fine-grained policy
would grant every key.
The check for operations AWS serves without credentials reads the Query action
directly, rather than through resolve with a placeholder scope, now that resolve
returns the authorized action. A Query request naming no action is not one of them.
An SDK compatibility test covers SendMessageBatch and PublishBatch, granted by
the single-item action and refused under the batch name, with enforcement on.
Under IAM enforcement, a Lambda task naming a function in another account was refused outright,
because Floci evaluated no Lambda function policy when #5079 added the check, and a task on a
function in the state machine's own account was not checked at all. Function policies now take
part in authorization (#5476), so a task is decided the way Lambda decides the Invoke call the
execution role makes (Step Functions Developer Guide, "I can't invoke a Lambda function from
another account"): within one account the role's policies or the function's policy can allow it,
and across accounts both have to (IAM User Guide, cross-account policy evaluation logic).
- LambdaTaskAuthorizer evaluates the role's policies, its permissions boundary and its account's
SCPs together with the function policy LambdaResourcePolicyProvider supplies. The role ARN has
to name an existing role, path included, matched as STS AssumeRole matches one
(IamService.roleArnMatches), and the role is evaluated under the ARN IAM holds for it.
- The task is authorized against the function ARN LambdaArnUtils.functionArn gives for its
reference: a full ARN as written, a name or partial ARN completed in the state machine's
partition, Region and account, with the version or alias it names, as Lambda authorizes an
invoke.
- A task whose Credentials name a role invokes the function as that role, once the execution role
has assumed it (Developer Guide, Task state "Credentials"). The role's trust policy has to allow
the execution role, with the state machine's ARN as sts:ExternalId, which the cross-account
tutorial's trust policy checks. The execution role's own policies have to allow sts:AssumeRole
on the role too when it is in another account, or when the trust policy names only the execution
role's account, since an account principal delegates to the account (IAM User Guide, "AWS
account principals"); AssumeRolePolicyEvaluator.decide tells the two grants apart. RoleArn is
read the way the task's Parameters or Arguments are. A role the execution role cannot assume
fails the task with States.Permissions, the Developer Guide's error for a task without the
privileges to run.
- A refusal to invoke fails the task with Lambda.AccessDeniedException. The cause names the role's
session as the Step Functions Developer Guide shows it
(arn:aws:sts::<account>:assumed-role/<role>) and ends in the IAM User Guide's context for the
policy type that refused it, explicit denials first, each in AWS's evaluation order: service
control policies, the resource-based policy or role trust policy, identity-based policies, the
permissions boundary.
The request context carried seven aws: keys plus aws:PrincipalArn, and none of
the three that say who is calling. A Condition matching on any of them could
not match, which is also why an IAM policy variable has nothing to resolve:
AWS's own IAMUserChangePassword policy scopes itself to user/${aws:username},
and substituting that needs the key to exist before it needs a substituter.
The values come from the user guide's principal key values list, one shape per
principal: Account with the account id for the account-root principal and for a
session token it minted, User with the user's own id for an IAM user access key
and for a session token that user minted, FederatedUser with account:name for a
GetFederationToken session, and AssumedRole with role-id:session-name for a role
session, which for a role on an EC2 instance is role-id:instance-id.
aws:username is the exception and is only published for an IAM user. The guide
is explicit: "always included in the request context for IAM users" while
"anonymous requests and requests that are made using the AWS account root user
or IAM roles do not include this key". Leaving it absent is what makes a
statement matching on it fail to match, which is the documented behaviour for a
key with no value, so the absence is the enforcement rather than a gap in it.
One judgement. The principal key values list renders the role-session type both
as AssumedRole and, twice, as "Assumed role". The unspaced form is the one that
fits the vocabulary of every other value in that list, each a single word or
CamelCase, and it is the form AWS publishes machine-side, as CloudTrail's
userIdentity.type does.
aws:userid was already derived in full by resolveCallerUserId, for every
principal type including the EC2 and ECS session-name fallbacks, so that
derivation is now a shared sessionUserId rather than a second copy inside
resolveCallerArns: reporting one key two ways is how the two readers would
drift. CallerArns carries the three values so they come from the single lookup
its javadoc already required, two lookups being able to straddle a session's
expiry, and it writes them itself, so every context a request is evaluated
against describes the same principal and there is one place that decides which
keys a principal publishes. The enforcement filter builds one context per
resource the request names and, since #5576, one per transaction item, which is
what a policy scoped to dynamodb:LeadingKeys = ${aws:userid} will need. S3
builds one of its own when s3.enforce-auth has it evaluate a bucket policy
there and then, and that one carried aws:PrincipalArn alone, so an inverted
Condition on any of the three keys held against a caller that has them and
fired a Deny the policy meant to leave alone.
Three unit tests and four integration tests, one on the transaction-item path
and one in S3's own bucket-policy class, with the existing caller-ARN
assertions widened to pin the keys for the root, federated and user-minted
session principals they already covered. Each key probed by dropping it alone:
without aws:PrincipalType or aws:userid both enforcement tests fail, without
aws:username one does, and giving a role session a username it should not have
fails the test that asserts the absence. The two contexts outside the filter
are probed the same way, each reverted to aws:PrincipalArn alone, and each
fails its own test. 4489 tests pass at this commit, across all 277 IAM and
core/common classes, the shared enforcement fixtures, and the S3 policy,
enforcement, presigned and account-context ones, the shared filter and
CallerArns reaching all of them. Checkstyle and docs-check clean.
VerifySMSSandboxPhoneNumber's VerificationException declares two required
members, Message and Status, and Floci sent only the message, so status() came
back null in the SDKs.
AWS documents no values for Status, and no recorded response carries one, so
Floci picks one from what the API does publish: the number's own verification
status, which a wrong password leaves Pending. Pending and Verified are the only
statuses SNS defines for a sandbox number, and the developer guide reads a
number left Pending as an unsuccessful verification. docs/services/sns.md says
the value is Floci's choice.
JSON errors already write an exception's extra members into the body. Query
errors did not: SnsQueryHandler built them from the code, message and status
alone. AwsQueryResponse gains an error overload that writes the extra members
into <Error> after <Message>, where the SDKs read them, and every SNS catch site
now passes the exception through it.
Refs #5570
* fix(codepipeline): link approval notifications to the partition's console host
The approval-needed notification built consoleLink and approvalReviewLink on
the commercial console host for every pipeline, so a pipeline in China or
GovCloud sent its approver to a console where the pipeline does not exist.
The console host becomes a vendored per-partition fact, consoleHost in
aws/region-facts.json, read by the generator from the user-guide snapshots
under local/aws/aws-docs/partition-guides: cn/console.md for aws-cn
(console.amazonaws.cn), gov/configure-account.md for aws-us-gov
(console.amazonaws-us-gov.com) and gov/govcloud-organizations.md for the
commercial host. The China guide also spells the host console.www.amazonaws.cn
once, in cn/managing-aws.md; the console page's own statement is the one used.
A guide page that lost its sentence, or states two hosts with it, fails the
generation instead of leaving a stale value.
CodePipelineEventPublisher resolves the host from the execution's region, since
it runs on a worker thread without a request context. No source states a
console host for the ISO or EUSC partitions, which keep the commercial one and
are listed as an open question. The path after the host stays the commercial
console's: no source gives the per-service path per partition.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(codepipeline): parse the China console host from the Markdown guide page, require sourced hosts
AWS serves each user-guide page as Markdown at the same URL with .md in
place of .html, and that rendering writes the China console host as a
link, "[https://console.amazonaws.cn](https://console.amazonaws.cn).".
The aws-cn pattern only took the page-text form, so a snapshot saved
from the Markdown page failed the generator, and with it the rest of
"make aws-data-sync". The pattern now takes both forms.
The docstring names the three guide page URLs and the path each is
saved under.
self_check now requires consoleHost for the three partitions that have
a source (aws, aws-cn, aws-us-gov). The shape-only check used when the
sources are not checked out accepted a file without them, which would
link approval notifications to the commercial console.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
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.
* 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