The files a cluster's trino-password-authenticator names were read whole into Floci's heap before being copied
into Trino's container, so a bootstrap action writing a file of several gigabytes could run Floci out of
memory. ContainerFiles.copy now copies a file between containers through an owner-only temporary file, one
Docker request after the other, and refuses one larger than the memory Trino's container gets, which Trino
reads it into, before any of it is written.
The node lifecycle controller marked every node Floci registers for a
joined instance Unknown once node-monitor-grace-period had passed (40
seconds up to Kubernetes 1.31, 50 from 1.32), tainted it unreachable
and evicted its pods, since no kubelet renewed its Lease. Every 10
seconds, as a kubelet does, Floci now renews each running instance's
node Lease in kube-node-lease, owned by the node and 40 seconds long,
and posts Ready again for a node the controller marked not Ready. A
stopped instance's node is not renewed, so it goes not Ready as on EKS.
The renewal runs on a scheduler of its own, apart from the readiness
poller, with each cluster on its own thread, so a slow API server
delays no other cluster's heartbeat, and a sweep that throws is logged
without ending the schedule. The kubectl apply command is now built
once, by EksClusterManager.kubectlApply.
The Service Reference lists lambda:GetLayerVersion among the actions CreateFunction and UpdateFunctionConfiguration
are authorized by, and the Lambda Developer Guide says what it is checked on: "Make sure that you have permission to
call the GetLayerVersion API on the layer version". Floci checked neither operation as it, so a caller allowed to
create or update functions added any layer version of its account, whatever its policies said about reading it.
tools/aws/fetch_lambda_layer_permissions.py vendors that sentence from the adding-layers page, with the action and
the resource it names, and refuses a page asking for permission to call an API in any other wording. The
request-resources generator reads it (api_permission_resources): an operation the Service Reference lists as
authorized by that action is also checked as it on each value of the request's member holding botocore's ARN shape
for the type the words name (`<Type>Arn`, as minted_types reads it; `Layers`, a list of `LayerVersionArn`, for a
`layerVersion`). CreateFunction and UpdateFunctionConfiguration now check lambda:GetLayerVersion on each layer
version their Layers give, and a request giving none is not checked as it; no other operation changes.
--verify reports an operation checked so whose action the Service Reference stops listing (verify_api_actions).
CreateFunction is the first operation checked by parts that also tags what it creates, so IamEnforcementFilter now
checks an operation's own action, where it is one of the parts, as it would be alone: with the request's tags
(aws:RequestTag, aws:TagKeys) and carried values, not the bare part context. The checks made after it, the tagging
action a create also needs, a companion and a forwarded action, are made on the resources that action was checked on,
not on *, so lambda:TagResource is again checked on the function a tagged create makes.
Another account's layer version is checked on its ARN alone: LambdaStoredResourceArns answers reachedInItsAccount
for it, as Lambda reads such a layer in its owner's account through the owner's policy and never as the caller's layer
of that name, where IAM also checked the caller's same-named layer before (GetLayerVersionByArn too).
The table is regenerated against today's Service Reference too, which the online gate this change runs requires: AWS
added SageMaker's leaderboard and model-monitor-config types (their ARN formats and tag keys, and the types of
AddTags, DeleteTags and ListTags) and lists a backup-external namespace the table does not read.
The docs and two comments in LambdaService and LambdaLayerService no longer say Floci implements no layer
permissions.
Adds the two recursion config operations, so Terraform's
aws_lambda_function_recursion_config converges. RecursiveLoop is
stored on the function, Terminate until one is put, and an ARN of
another account or partition is a ResourceNotFoundException.
Allow lifts the 16-hop bound on a chain of asynchronous invocations,
since AWS takes no action on a loop it detects for such a function.
The setting is read from $LATEST whichever version or alias is
invoked, and an invocation past the bound starts on a thread of its
own, so the pool's caller-runs fallback cannot nest the loop on one
stack.
With TLS on, Floci's TLS proxy holds floci.tls.aws-https-port (443 by
default) for AWS API calls and cfn-response callbacks, so an ALB HTTPS
listener on that port could not bind it and received no traffic, where
AWS serves it.
- an HTTPS listener on the proxy's port is served on loopback, and the
proxy reads the ClientHello's SNI without terminating TLS and hands the
connection to the listener that claims the name; Floci's own endpoint
names, no SNI and unclaimed names stay with Floci
- the proxy waits for a whole ClientHello only while such a listener is
served behind it, from one deadline armed by the first bytes, and sends
anything else to Floci on its first bytes as before
- each proxied connection is pinned to the listener its ClientHello
selected, and carries the client the proxy accepted it from, so targets
see the client in X-Forwarded-For and X-Forwarded-Port names the
listener's port
- the proxy and the embedded DNS server share one list of Floci's DNS
suffixes
- a failing route lookup is logged at warn, and the connection goes to
Floci
Refs #8613
Co-authored-by: Jonathan Morley <jonathanmorley@users.noreply.github.com>
A cluster's trino-password-authenticator now makes its Trino's password-authenticator.properties, which a
trino-config http-server.authentication.type of PASSWORD turns on. The files it names (file.password-file,
the LDAP key and trust stores) are copied into Trino's container from the image the cluster's bootstrap
actions left. Trino gets a shared secret for its internal communication unless trino-config names one, as EMR
configures one, and is found ready by its image's health check, which needs no credentials. Trino takes a
password only over HTTPS, so through Floci with its TLS on.
ContainerFiles reads one file out of a container; ElastiCache's snapshot read and Lambda Web's init-error read
move onto it.
AddLayerVersionPermission, RemoveLayerVersionPermission and GetLayerVersionPolicy had no handler, so a layer's owner
could not grant another account, an organization or everyone lambda:GetLayerVersion on one of its versions, as the
Lambda Developer Guide says it must ("To use a layer in another account, the owner of that account must grant your
account permission in a resource-based policy").
LambdaLayerPolicyService keeps a layer version's statements with the version, in the order they were added, each
granting lambda:GetLayerVersion to an account (written as its root ARN), to everyone, or to an organization
(aws:PrincipalOrgID), with a revision each change renews. Its answers are AWS's, as the aws-emulator evaluation
suite records them: a statement id already in the policy is a ResourceConflictException that leaves the revision as
it was; a RevisionId other than the latest a PreconditionFailedException, before anything changes; an OrganizationId
with an account principal an InvalidParameterValueException; a policy past 20480 characters a
PolicyLengthExceededException; the model's constraints a ValidationException in member order; and a version that
never had a policy and one whose every statement was removed answer differently ("No policy is associated with the
given resource." and "Layer version ... does not have any resource policy.").
LambdaResourcePolicyProvider now returns a layer version's policy, owned by the account in its ARN, so under IAM
enforcement a caller in another account is refused lambda:GetLayerVersion on it until its owner grants that account.
Reading another account's layer once granted is not served yet: GetLayerVersionByArn still resolves a layer only in
the caller's own account.
A k3s node whose container exited without Floci stopping it (k3s
crashing, say) stayed stopped until Floci restarted, and a container
started again outside Floci had none of its attached EBS volumes'
devices, so their mounts failed. Floci now watches each node container,
as it watches an EC2 instance's, adopts one that exited again as a
restart adopts it, and makes its volumes' devices again. Once its API
server answers, the readiness poller sets it up and finalizes it as it
does a replaced node, so the link-local metadata and Pod Identity
addresses, the VPC routes and the log follower are made again in the
started container. A node that exits more than three times within ten
minutes is left stopped.
The exit goes to EksService, as EC2 hands a guest's shutdown to
Ec2Service, and EksService starts the node again under the cluster's
capacity lock, which DeleteCluster and the first node group's
replacement hold, so an exit handled while the cluster is deleted, or
once it is gone, leaves the node stopped. Each restart has its own
number that the poller clears only once it finalized that one, so a
restart during the finalize is kept, and deleting a cluster forgets its
restarts. The node restart Docker test's volume helper image is
prefetched under its own class name.
The Service Reference lists the actions each Secrets Manager operation is authorized by without saying when each is
needed, so a request was checked as its own action alone: a BatchGetSecretValue using Filters without
secretsmanager:ListSecrets, a CreateSecret adding replica Regions without secretsmanager:ReplicateSecretToRegions and
a ValidateResourcePolicy without secretsmanager:PutResourcePolicy were all let through.
Each operation's page in the API reference says it, in its required permissions: "If you use filters, you must also
have secretsmanager:ListSecrets", "To add replica Regions, you must also have secretsmanager:ReplicateSecretToRegions",
"Required permissions: secretsmanager:ValidateResourcePolicy and secretsmanager:PutResourcePolicy".
tools/aws/fetch_secretsmanager_required_permissions.py copies that paragraph for each operation the Service Reference
lists as authorized by another of its actions, with each clause's action and what it is needed for or on, into
tools/aws/sources/secretsmanager-required-permissions.json. Two generators read it:
- regen_iam_authorized_actions.py: an action needed when the request does something is a companion of the request
member the clause's words name as the generators' names go (filters is Filters, add replica Regions
AddReplicaRegions), where the Service Reference lists it for the operation and does not mark it as tagging, which
the tag-on-create table checks. A companion a request member sets may now carry no session key.
- regen_iam_request_resources.py: actions an operation always needs beside its own are each checked on what the rules
read for it (ValidateResourcePolicy and PutResourcePolicy on the secret its SecretId names). A request checked by
parts that names nothing is now checked on * as each action the table checks on the same resources as its own, not
as its own alone, so a ValidateResourcePolicy naming no secret still needs PutResourcePolicy.
The fetcher refuses a sentence naming a secretsmanager: action in a wording it does not read, so a reworded page fails
rather than dropping a check, and the enforcement test runs on the AWS SDK.
Not read: GetSecretValue for each secret of a batch, which AWS reports per secret in Errors rather than refusing the
call; PutResourcePolicy for a cross-account replica and DeleteResourcePolicy for one stopped replicating, whose words
name no member of the request; and the KMS permissions of a secret on a customer managed key.
#9743 read which queue each action of a message move task is checked on from two parameter sentences of the API
reference picked one by one (SourceArn's "only ARNs of dead-letter queues (DLQs)", DestinationArn's "specify the
destination queue"), a list of the three operations' pages, and a reading of its own for ListMessageMoveTasks: a queue
no parameter named was the one the row named the operation's own action of.
The developer guide's steps to configure a redrive's minimum permissions group the actions by queue instead:
"Permissions for the DLQ (source queue): sqs:StartMessageMoveTask, ..., sqs:ReceiveMessage, sqs:DeleteMessage,
sqs:GetQueueAttributes" and "Permissions for destination queue: sqs:SendMessage". The fetcher now copies those groups,
and group_permission_resources places each action the Service Reference lists an operation as authorized by on the
queue its group names, the member of the request the group's words name as the generator's names go (the source queue
is SourceArn, the destination queue DestinationArn), as CodeArtifact's destination repository is its
destinationRepository. The parameter sentences, the list of operations and the own-queue reading are gone. The table
is unchanged.
GetApiKeys ignored the name and customerId filters and returned every
key. name now keeps the keys whose name starts with it and customerId
the keys of that customer; the filtered keys are paged by limit and
position as before.
ApiGatewayRestApiPageCapTest and ApiGatewayApiKeyPageCapTest become one
parameterized ApiGatewayPageCapTest over the collections paged through
pageById.
StartMessageMoveTask was checked as sqs:StartMessageMoveTask alone, on both its SourceArn and its DestinationArn, so a
caller granted the permissions AWS requires was refused on the destination, and one granted the action alone on the
dead-letter queue was let through. ListMessageMoveTasks was checked as its own action alone.
The Amazon SQS developer guide's table of a dead-letter queue redrive's minimum permissions gives each task's actions
of each queue: "Add the sqs:StartMessageMoveTask, sqs:ReceiveMessage, sqs:DeleteMessage, and sqs:GetQueueAttributes
of the dead-letter queue", "Add the sqs:SendMessage of the destination queue", and "Add the sqs:ListMessageMoveTasks
and sqs:GetQueueAttributes of the dead-letter queue". The API reference names each queue's parameter: SourceArn "only
ARNs of dead-letter queues (DLQs)", DestinationArn "specify the destination queue". AWS's own fidelity check
(iam__sqs__sts/check_start_message_move_task_requires_composite_source_and_destination_permissions in
aws/aws-emulator-evaluation-suite) refuses a caller granted sqs:StartMessageMoveTask alone on the dead-letter queue,
naming sqs:ReceiveMessage on it, and lets the call through once the five are granted.
tools/aws/fetch_sqs_redrive_permissions.py copies the table's rows and those parameter sentences into
tools/aws/sources/sqs-redrive-permissions.json, a new PERMISSION_SOURCES entry, and the request-resources generator's
task_permission_resources reads it: the row naming the operation's own action, each action on the resource the rules
read from the parameter naming its queue, a queue the request names by no such parameter being the one the row names
the operation's own action of. --verify checks each row's actions against the Service Reference's AuthorizedActions.
Only StartMessageMoveTask and ListMessageMoveTasks change; CancelMessageMoveTask names its task by handle and keeps
its reading.
AWS's Auto Mode instances carry aws:eks:cluster-name and no karpenter.sh/nodeclaim tag (measured). Floci now writes aws:eks:cluster-name and no longer tags an instance with its claim's name: a pass finds each instance's claim by its status.providerID, as Karpenter matches them, else by the old tag on an instance launched before, else by the derived name, another derivation when an older instance's claim has it.
A claim whose launched status write failed keeps the name its launch chose, as claims Auto Mode doesn't manage and claims a provider ID places stay reserved, and with the claims unreadable a pass launches nothing, so a launch can't take a name already in use.
S3 Tables accepted tags only at CreateTableBucket and CreateTable, so a
client could not read them back or change them.
The three operations are served on their modelled restJson1 routes,
POST, DELETE and GET /tag/{resourceArn}, for a table bucket's ARN or a
table's ARN. They read and change the tags the create operations store,
the same ones IAM reads for aws:ResourceTag conditions, so a tag set
with TagResource is what the next request's condition sees. The IAM
route and action tables already mapped the routes to
s3tables:TagResource, UntagResource and ListTagsForResource. Like S3
Tables' other routes, /tag is rewritten only for a request signed for
s3tables, so a path-style S3 request for a bucket named tag still
reaches S3.
A table keeps its tags through a rename, as its ARN ends in a minted id,
and tagging leaves its versionToken. An unknown table bucket answers
NotFoundException "The specified bucket does not exist.", and a table
ARN whose table or bucket is missing "The specified table does not
exist.", as AWS does.
TagResource refuses with BadRequestException a missing or non-object
tags member, a value that is not a string, a key beginning with aws:, a
key outside the tag character set, a key or value outside the modelled
lengths (in Smithy's validation wording), or more than 50 tags on the
resource counting the ones it already has. The aws:, character set, key
length and 50-tag messages are the ones AWS answers. CreateTableBucket
and CreateTable now apply the same rules to the tags they are given,
and no longer store a null or non-string value as its text.
TagResource and UntagResource build the new tags apart and restore the
old ones if the save throws, so a failed WAL write leaves nothing
visible to ListTagsForResource or IAM resource-tag conditions.
Tag condition keys come from generated data, and that table covers only
the IAM namespace, so S3 Tables' TagResource and UntagResource stay
without aws:RequestTag and aws:TagKeys, as most services' tagging
actions do.
AWS invokes a Lambda target with a JSON array of up to MaxBatchSize
events (10 by default), synchronously unless InvocationType is EVENT,
and with LambdaParameters.Qualifier resolved from each event. It checks
a Lambda TargetArn's form, then the Region and account of any target,
then that the parameter block is the target's.
A reset or deleting the subscriber drops the invocations still waiting.
AWS drops a waiting event only once it outlives the subscriber's
MaxEventAgeInSeconds or uses up MaxRetryAttempts, so a burst behind a
slow function is not cut at a fixed count.
Auto Mode's node pool guide: the sum of expireAfter and terminationGracePeriod can't exceed 21 days, and expireAfter can't be Never. The NodePool kind took a Never or 720h pool. It now has the three rules and messages AWS's NodePool kind has on an Auto Mode cluster, keyed on an eks.amazonaws.com NodeClass ref, and expireAfter's schema as AWS's (a 336h default and a duration-or-Never pattern); terminationGracePeriod's schema is Karpenter's published one.
A presigned or browser POST upload answered 204 whatever the form asked.
It now honors success_action_redirect and the deprecated redirect field
with a 303 whose Location is that URL plus bucket, key and etag query
parameters, and ignores a URL S3 cannot interpret, as AWS does. Without
a redirect, success_action_status 201 returns the PostResponse XML with
the object's absolute Location, 200 an empty body, and 204 or any other
value the default. The 201 Location follows the bucket the virtual-host
routing chose and the forwarded host and scheme.
SigV4Canonicalization.percentEncode now shares uriEncode's byte loop.
The generated IAM condition key table had iam:AccountPropertyNamespaces in notRead on both actions the Service
Reference lists it on, so a policy keyed on it matched nothing: the IAM user guide's DenyRoleManagerEnablement
statement, ForAnyValue:StringEquals on RoleManager, let a caller enable role manager, and an Allow requiring the
namespace refused every call.
Neither botocore nor the Service Reference says where the value is; AWS's pages do. The IAM user guide's condition
key table: iam:AccountPropertyNamespaces "Specifies the account property namespaces being read or modified in the
request ... When you call PutAccountProperties or GetAccountProperties". The API reference on PutAccountProperties'
Properties: "Each key uses the format Namespace/PropertyName. The key must contain exactly one / separating the
namespace from the property name". tools/aws/fetch_iam_account_property_namespaces.py copies both sentences into
tools/aws/sources/iam-account-property-namespaces.json with what they name: the key, the operation, the parameter,
the format, its separator and the part that is the namespace. regen_iam_condition_keys.py takes that entry as it
stands, refusing it unless the Service Reference lists the pair and botocore models the parameter as a map of
strings, and writes it to a new fromMapKeys section, which the IAM context resolver reads from the request's map as
the operation's handler does. GetAccountProperties names no properties, so it stays in notRead.
Use the retained stack when a resource read names its ID. This lets SDK
clients inspect the original resources after deletion or name reuse until
the configured retention window expires.
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
SES v2 refused the headers it sets itself (From, To, Cc, Bcc, Subject,
Date, Message-ID, Reply-To, Return-Path, MIME-Version, Content-Type and
Content-Disposition, in any case) only in a SendEmail's
Content.Simple.Headers. Content.Template.Headers and the SendBulkEmail
default and replacement headers now refuse them too, with 400
BadRequestException "Header <Name> is not supported" and the name as
sent. On SendBulkEmail one refused header, default or in any entry,
fails the whole call. As probed on AWS, the refusal comes right after
the request shape, ahead of the sender, content and template data
checks, the destination count, the template and configuration set
lookups and the sender verification.
UpdateClusterConfig refused every kubernetesNetworkConfig member other
than elasticLoadBalancing, so turning EKS Auto Mode on through the
Terraform AWS provider failed: its update carries the cluster's current
ipFamily and serviceIpv4Cidr beside elasticLoadBalancing. The cluster's
own values are now accepted unchanged, ipFamily in any case. Another
value for either is still refused, as EKS sets both only when it creates
a cluster and Floci doesn't change them.
sts.md said Floci did not implement "transitive session tags replace matching ResourceTag values after the evaluation
of the role trust policy". It does, and the IAM user guide's own chain spells out what the rule means: "the inherited
Star = 1 session tag overrides the role Star = 3 tag". The role's trust policy is read with the role's own tag,
aws:ResourceTag/Star of 3, and the session it mints carries the inherited 1 as aws:PrincipalTag/Star, a session tag of
a key shadowing the role's tag of that key as any session tag does.
PrincipalTagEnforcementIntegrationTest now runs the guide's chain: a trust policy requiring aws:ResourceTag/Star = 3
allows the chained assume, and the session is allowed by aws:PrincipalTag/Star = 1 and not denied by = 3. The guide's
"if you try to pass the Sun = 2 session tag, the operation fails" does not follow from the published rule and is
still not refused.
The trust policies of AssumeRoleWithSAML and AssumeRoleWithWebIdentity were read by two condition evaluators of their own, each taking only StringEquals, StringNotEquals, StringLike and StringNotLike: a statement using a set operator (ForAllValues on aws:TagKeys, ForAnyValue on an audience), an IfExists operator or Null never allowed the assume, a negated operator never matched a key the request does not carry, and SAML read a claim under any prefix, so other:sub read the assertion's sub.
Both now read each statement's Condition with IamPolicyEvaluator.conditionMatches, as AssumeRolePolicyEvaluator does, against a context holding the claims under their full keys (the Service Authorization Reference's saml: keys for an assertion, the issuer's prefix for a token), sts:RoleSessionName, the role's tags, the request tags and the source identity. Each keeps its own Federated principal and action matching; the hand condition code is gone.
A token's <issuer>:aud holds the one audience the token was accepted for, the one the response returns as Audience, wherever the token's list names it: the Service Authorization Reference types the key String, a single value. A multivalued key such as aws:TagKeys takes a set operator, as in every other policy, and a negated operator over an empty list of values holds, the NOR of no values.
EC2 user data now appends each part's stdout and stderr to /var/log/cloud-init-output.log in the guest, as cloud-init does on AWS. The guest log keeps the full output; Floci's own 2048-byte summary line is unchanged.
The script still runs as a command, so its shebang selects the interpreter. A POSIX shell wrapper merges stderr into stdout, tees both into the log, and carries the script's exit status on a dedicated file descriptor, so Floci reports the script's code rather than tee's. The script runs with those descriptors closed, so a background service it starts cannot keep the status pipe or the exec stream open. If the guest has no tee or a read-only /var/log, the wrapper falls back to running the script directly and warns on stderr. The EKS caller of the shared UserDataPipeline keeps its current path.
Closes#9386
Under enforcement a role whose trust policy conditions AssumeRoleWithSAML or AssumeRoleWithWebIdentity on aws:RequestTag/<key> or aws:TagKeys refused every tagged assume: neither trust policy saw the tags the assertion or the token passes, which the Service Reference gives both actions and the IAM user guide's SAML ABAC tutorial's trust policy reads. And all three assumes named sts:TagSession by hand, through AssumeRolePolicyEvaluator.TAG_SESSION_ACTION, with the assertion's PrincipalTag attributes and the token's tags claim named by hand too.
The IAM user guide's page on session tags says where an identity provider passes the tags, "include the Attribute element with the Name attribute set to https://aws.amazon.com/SAML/Attributes/PrincipalTag:{TagKey}" and "the nested claim format uses a structure within the https://aws.amazon.com/tags namespace in the JWT", and what passing them needs, "trust policies for all roles connected to the identity provider (IdP) passing tags must have the sts:TagSession permission". tools/aws/fetch_sts_session_tags.py vendors it into tools/aws/sources/sts-session-tags.json, and regen_iam_authorized_actions.py gives both operations a companion naming the attribute or the claim, sts:TagSession, and the reference's aws:RequestTag/${TagKey}, where the reference's action of the operation's name takes that key.
The SAML and web identity trust policies now read the tags as aws:RequestTag/<key> and aws:TagKeys, written as an AssumeRole's are, and check the companion's action for them; the assertion and token verifiers read the companion's attribute and claim. AssumeRole's trust check takes the tagging action the tag-on-create table gives it. TAG_SESSION_ACTION and the allowsTagging methods are gone.
Closes#6640.
Under enforcement a role whose trust policy conditions AssumeRoleWithSAML or AssumeRoleWithWebIdentity on sts:SourceIdentity refused every assume, and one that withheld sts:SetSourceIdentity was never consulted: neither operation read the source identity its identity provider sets, so the session carried none, the response returned none and its requests carried no aws:SourceIdentity. The Service Reference gives both actions sts:SourceIdentity but lists no authorized actions for either operation, and botocore models the value only in the response.
The IAM user guide's page on source identity, which tools/aws/fetch_sts_source_identity.py already vendors, says where each carries it, "to set a SAML attribute for source identity, include the Attribute element with the Name attribute set to https://aws.amazon.com/SAML/Attributes/SourceIdentity" and "include source identity in the https://aws.amazon.com/source_identity namespace in the token", and what it needs, "trust policies for all roles connected to an identity provider (IdP) must have the sts:SetSourceIdentity permission". The fetcher now copies those sentences too, and regen_iam_authorized_actions.py gives each operation a companion naming the attribute or the claim and the key it is read as, where the reference's action of the operation's name takes sts:SourceIdentity.
STS reads the value the table names, holds it to botocore's sourceIdentityType (the shape botocore gives the response's SourceIdentity, as it does AssumeRole's member), and refuses several values or one outside it with InvalidIdentityToken. The trust policy reads it as sts:SourceIdentity, through the keys the federated trust evaluators already read in full, and is checked for sts:SetSourceIdentity before the assume, as for AssumeRole. The session records it under aws:SourceIdentity, which a session assumed from it carries on, and the response returns it.
Part of #6640.
DeleteFunction with a Qualifier refused a version only when an alias
named it as its FunctionVersion, so the second version of a weighted
alias, listed in its RoutingConfig's AdditionalVersionWeights, could
be deleted from under it. A version an alias references either way now
answers ResourceConflictException (409), as the API reference says a
version an alias references can't be deleted, and deleting it succeeds
once the alias no longer routes to it.
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
#9686 refused tag keys with the reserved aws: prefix, and more than 50
tags, on TagResource only. CreateEventBus, CreateSubscriber and
CreateEventSource, and a CloudFormation update of a bus or a
subscriber, now refuse them too, in the order measured on AWS: a
reserved key answers AccessDeniedException (403) right after the
request constraints, ahead of the name clash, the ClientToken replay
and the bus lookup, and more than 50 tags answers
LimitExceededException (400) after those checks, and before a
ClientToken mismatch when the token named another resource. A refused
create stores nothing and makes no secret or managed rule.
Under enforcement an AssumeRole passing a SourceIdentity was neither held to sts:SetSourceIdentity nor read as sts:SourceIdentity, so a trust policy requiring a source identity refused every assume and one granting the permission was never consulted. The session kept no source identity either: the response returned none, its requests carried no aws:SourceIdentity, and a session assumed from it could set another. botocore gives the member and the Service Reference the key and the action, listing sts:SetSourceIdentity among the actions AssumeRole is authorized by, without saying when it is needed or which member carries the key.
The IAM user guide's page on source identity says both: "to pass source identity while assuming a role, use the -–source-identity AWS CLI option or the SourceIdentity AWS API parameter", "to specify a source identity, principals (IAM users and roles) must have permissions to sts:SetSourceIdentity", and when chaining it is "required in both the permissions policy of the principal who is assuming the role and in the role trust policy of the target role". tools/aws/fetch_sts_source_identity.py vendors it into tools/aws/sources/sts-source-identity.json. regen_request_condition_keys.py reads it for sts (CONDITION_SOURCES), so sts:SourceIdentity is read from AssumeRole's SourceIdentity, and regen_iam_authorized_actions.py crosses it with the reference's AuthorizedActions and botocore's request members into a new companions section of iam-authorized-actions.json: AssumeRole needs sts:SetSourceIdentity when it names SourceIdentity or its caller carries aws:SourceIdentity.
Enforcement checks the companion action on the role with the request's keys, and for a caller that is itself a role session checks it of the caller's own permissions alone too, since a trust policy naming the caller's role would otherwise stand in for them in the same account (the table's callerPolicyWhenChained, from the page's sentence on role chaining). STS checks it in the trust policy before the assume, as AWS names it where a statement granting both is conditioned on another sts:SourceIdentity. The session records the value under the key the table gives, aws:SourceIdentity, which its requests carry and a session assumed from it carries on, read there as sts:SourceIdentity too, and the response returns it. A chained request naming another value is refused with ValidationError, "The source identity is already set for this assume role session", and an AssumeRole naming a session tag key twice with InvalidParameterValue, "Duplicate tag keys found. Please note that Tag keys are case insensitive.", both as AWS's evaluation suite records them.
Part of #6640.
EventBridge V2 took tags only when a bus, a subscriber or an event source was created. TagResource, UntagResource and ListTagsForResource now add, remove and list them, and IAM reads the changed tags for aws:ResourceTag conditions.
AWS allows 50 tags on a resource, refuses keys that start with aws: in any case, and refuses to tag or untag a revoked resource. It lists the tags in the order of a HashMap copied from one filled in key order. One lookup finds the taggable resource for the tag calls and for the IAM resource tags, and each kind is tagged through a copy, so a failed write leaves its tags as they were.
Under enforcement a role whose trust policy conditions the assume or sts:TagSession on aws:RequestTag/<key> or aws:TagKeys refused every tagged AssumeRole, and a Deny keyed on them never applied: STS built the trust policy's context by hand, with the session name and external ID alone. The Service Reference gives sts:AssumeRole both keys, and the IAM user guide's session tags page has a trust policy reading them: with aws:RequestTag "you can allow the principal to pass the specified session tags, but only with the specified values", and with aws:TagKeys "pass only session tags with the specified tag keys".
The trust policy's context now takes the request's keys from the generated tables, as the caller's own policies do: the members request-condition-keys.json gives sts:AssumeRole, its RoleSessionName and ExternalId, and the tags iam-tag-on-create.json reads from its Tags, as aws:RequestTag/<key> and aws:TagKeys. The assume and the sts:TagSession permission are each checked once for every set of tags a reading of the list gives, past a gap in its numbering or with each value of a key sent twice, as the enforcement filter checks the caller's policies, so a Deny on a tag holds however the list is sent. The filter's per-set helper moves to IamConditionContextResolver beside requestContextsOfForm, which STS calls, and formParameters shares its first-value reading with it.
Both read the list as STS does. TagOnCreate read sts: tags under Tags.member up to the first gap, while STS reads them through AwsQueryLists, Tags.member.N or the bare Tags.N at every index, so a tag sent as Tags.1, or after a gap, reached the session and not the check, and a policy requiring it refused a call AWS allows. sts: is now read through the shared reader, as iam: is, and the shared reader takes the members in the order of their indices, as AwsQueryLists gives them, so a key sent twice keeps the value the handler keeps.
Part of #6640.
StartConfigurationRecorder marked a customer managed recorder as
recording, with a new start time, even when its account and Region had
no delivery channel. It now refuses that start with HTTP 400
NoAvailableDeliveryChannelException, "Delivery channel is not
available to start configuration recorder.", and leaves the recorder's
status as it was, as AWS does. A missing recorder still answers
NoSuchConfigurationRecorderException first. The start and
DeleteDeliveryChannel take the same recorder lock, so a concurrent
delete can't leave a recorder running without its channel.
Co-authored-by: Andre Kurait <akurait@amazon.com>
Under enforcement a VPC association call scoped by route53:VPCs was refused for every VPC, as #8367 reports: the request condition key table never filled the key, so a condition on it never saw a value. Neither botocore nor the Service Reference says where a request carries the key or in what form.
Route 53's developer guide says both, in its table of condition keys: route53:VPCs "Represents a list of VPCs in the request of AssociateVPCWithHostedZone, DisassociateVPCFromHostedZone, ListHostedZonesByVPC, CreateHostedZone, CreateVPCAssociationAuthorization, and DeleteVPCAssociationAuthorization, in the format of "VPCId=<vpc-id>,VPCRegion=<region>". A vendored source, tools/aws/sources/route53-condition-keys.json, written by tools/aws/fetch_route53_conditions.py from that page, gives each key the table gives in a format of request members, with its operations and members, and the generator reads it for route53 (CONDITION_SOURCES) beside the record keys it already reads.
The table writes a key a format composes as that format with each member's place holding where the request carries it (VPCId={VPC.VPCId},VPCRegion={VPC.VPCRegion}), and a member of the query string as ? and its name (ListHostedZonesByVPC's ?vpcid and ?vpcregion), and the request condition reader fills the format from them, read from an XML body or the query string, when each member holds one value. A request naming no VPC, as a public CreateHostedZone does, carries none.
Route 53 reads the VPC only where its schema puts it, the VPC below the request's root, where IAM reads it, and refuses a second VPC, a second VPCId or VPCRegion, or a repeated vpcid or vpcregion query parameter with InvalidInput, as it already refuses a change batch naming an element twice. It used to take the first VPC anywhere in the body, so a request naming a denied VPC beside another carried no value for the Deny to match and still acted on the denied one.
Closes#8367.
Apply integration and authorizer credential ARNs during stack creation and updates. Clear only credentials removed from previously declared template properties, preserve externally configured values, and restore integration credentials during rollback. Preserve current integration subtype defaults and rollback behavior.
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Under enforcement a CreateAccessEntry scoped by eks:principalArn or eks:accessEntryType was refused for every entry, and an AssociateAccessPolicy scoped by eks:policyArn or eks:namespaces for every association, as #8311 reports: the request condition key table read none of these keys, so a condition on them never saw a value. Neither botocore nor the Service Reference says which request member carries them.
The Service Authorization Reference's table of the keys EKS defines says it: eks:principalArn, eks:kubernetesGroups, eks:policyArn and eks:namespaces filter on "the <member> present in the access entry requests" or in "the associate / disassociate access policy requests", and eks:accessEntryType and eks:username on "the access entry type" and "the Kubernetes username" present in them, the access entry requests' type and username. A vendored source, tools/aws/sources/eks-condition-keys.json, written by tools/aws/fetch_eks_conditions.py from that page, gives each key its member, and the generator reads it for eks (CONDITION_SOURCES) beside the cluster keys it already reads.
The page gives what a request carries, so a vendored key is read from an action's request only where the reference lists it on the action itself; one the reference gives a resource type alone is the stored resource's value. A list's values are each read (kubernetesGroups, accessScope.namespaces). A vendored member the request carries outside its body, as DisassociateAccessPolicy carries policyArn in its path, or as a structure, as accessScope is, the page not saying which of its values the key holds, is not read.
The keys the reference gives the access entry itself, its stored principal, type, groups and username on the operations acting on one, are not read yet: those requests are checked on an access entry ARN whose identity and id are left open, which names no one entry to read them from.
Closes#8311.
An EKS Auto Mode NodeClaim whose expireAfter was Never, longer than 21
days, missing or unreadable never expired, where Auto Mode terminates
an instance once it has lived its 21-day maximum lifetime. A claim now
expires at the earlier of its expireAfter and 21 days from its
creation. A claim whose creationTimestamp can't be read still doesn't
expire, and an unreadable expireAfter is logged.
Under enforcement a PutRule scoped by events:source was refused for every event pattern, and a PutTargets scoped by events:TargetArn for every target, as #8320 reports: the request condition key table never filled either key, so a Null or ForAllValues condition on them never saw a value. The table's reader is generic, but which member carries a key comes from SERVICES in regen_request_condition_keys.py, and EventBridge was not there. Neither botocore nor the Service Reference says where a request carries these keys: botocore models EventPattern as a string ("The event pattern").
EventBridge's user guide says it, in its table of condition keys: events:source is "the literal string for the source field of the event", with events:detail-type, events:detail.service, events:detail.eventTypeCode and events:detail.userIdentity.principalId the same for their fields, which a rule's event pattern gives ("EventPattern is a mandatory argument to PutRule"), and events:TargetArn is "the ARN of the target for the rule". A vendored source, tools/aws/sources/eventbridge-condition-keys.json, written by tools/aws/fetch_eventbridge_conditions.py from that page, gives each key its member, and the generator reads it for events (CONDITION_SOURCES), each key in the one operation the page names: PutEvents, CreateEventSource and UpdateEventSource take events:source too, which the page does not describe, so they are not read there. --verify checks the file against the page.
The table writes a field of a JSON document a string member holds after #: EventPattern#source.* is each literal string of the pattern's source, read by one generic step of the JSON reader. A pattern leaving a field out names nothing, so ForAllValues allows it and a Null check refuses it, as the page's examples show. The fields are read at the pattern's top level, where every example on the page gives them, so a $or branch's names nothing, and a matcher such as {"prefix": "aws."} is no literal string and names nothing. events:TargetArn reads each target's own Arn, not its dead-letter queue's.
Closes#8320.
Under enforcement a REST route no vendored model names runs unchecked, and AWS Backup was among them: a caller could start a backup job or assign resources to a backup plan with any role and no iam:PassRole, and a grant scoped to one backup vault or plan covered every one, as #6255 reports. Backup's model routes are vendored, so each request is checked as its operation's action, and Backup joins the tables of request resources, passed roles and tags on create.
The Service Reference passes most of Backup's roles to one service, which the passed-roles generator reads alone: IamRoleArn to backup.amazonaws.com, a backup plan's scan settings' ScannerRoleArn to malware-protection.guardduty.amazonaws.com, and a restore testing selection's to restore-testing.backup.amazonaws.com. It passes StartScanJob's IamRoleArn and ScannerRoleArn to both of the first two without saying which goes where, so a vendored source, tools/aws/sources/backup-roles.json, written by tools/aws/fetch_backup_roles.py from the developer guide's malware protection page, gives each: the scanner role "trusts malware-protection.guardduty.amazonaws.com", and the backup role is "the same role found in ... the BackupSelection API", linking CreateBackupSelection, whose role the Service Reference passes to backup alone. The generator reads such a role as going where the reference passes that operation's roles, when that is one service.
A backup vault is checked by its name and a backup plan by its id; BackupStoredResourceArns answers the tags Backup holds on either, which an aws:ResourceTag condition reads. A recovery point's format the Service Reference gives with a literal * account, which the reader matches as written, so a request naming a recovery point by its ARN is checked on *, as one naming a DMS endpoint is.
A namespace the table reads is served on the shared tag routes only with a method its model gives on the path, as it already was only on the paths its model gives: Backup removes tags with POST /untag/{resourceArn}, so a DELETE on its /tags/{resourceArn}, which no Backup operation is and no action checks, was let through and removed tags an aws:ResourceTag deny relies on. It is now refused with MethodNotAllowedException (405), as a tag call sent with the other verb is.
Closes#6255.
Under enforcement a REST route no vendored model names runs unchecked, and AWS AppSync was among them: a caller could give a data source any service role and a GraphQL API any CloudWatch Logs or merged API execution role with no iam:PassRole, and a grant scoped to one GraphQL API covered every API, as #6255 reports. AppSync's model routes are vendored, so each request is checked as its operation's action, and AppSync joins the tables of request resources, passed roles and tags on create.
The Service Reference passes every AppSync role to appsync, so the passed-roles generator reads each member alone: a data source's serviceRoleArn, a GraphQL API's logConfig.cloudWatchLogsRoleArn and mergedApiExecutionRoleArn, and an Event API's eventConfig.logConfig.cloudWatchLogsRoleArn, each passed to appsync.amazonaws.com.
The request-resources generator now also fills a variable whose stem no member's matches with the one path label a REST route puts after the literal segment the type's format puts before that variable, or after that segment qualified by the variable's first word: AppSync's apiId in /v1/apis/{apiId} fills apis/${GraphQLAPIId}, and sourceApiIdentifier in /v1/sourceApis/{sourceApiIdentifier} a merged API association's apis/${SourceGraphQLAPIId}. No other namespace's reading changes. An operation on an API's data sources, resolvers, functions, types, API keys or schema, which the Service Reference gives no resource type, stays on *, as AWS checks it. AppSyncStoredResourceArns answers the tags AppSync holds on a GraphQL API or a custom domain name, which an aws:ResourceTag condition reads.
AppSync now mints a channel namespace's ARN as apis/<apiId>/channelNamespace/<name> and an association's as apis/<mergedApiId>/sourceApiAssociations/<associationId>, from the association's own id, as AWS returns them, so a policy naming the ARN AppSync returns names the resource the request is checked on. Floci minted channelNamespaces/<name>, and an association ARN under sourceApis/ or mergedApis/ ending in a second id.
AppSync's tag routes are served, as every namespace's the table reads, on the route its model gives, /v1/tags/{resourceArn} with the ARN encoded as an SDK sends it.
Part of #6255.