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.
Under enforcement a REST route no vendored model names runs unchecked, and AWS Batch was among them: a caller could create a compute environment with any service, instance or Spot Fleet role and register a job definition with any job or execution role, as #6255 reports. Batch's model routes are vendored, so each request is checked as its operation's action, and Batch joins the table of request resources and the passed-roles table.
The passed-roles generator reads RegisterJobDefinition's roles, each passed to ecs-tasks.amazonaws.com, alone. The Service Reference passes CreateComputeEnvironment's and UpdateComputeEnvironment's roles to batch, ec2, ecs and spotfleet without saying which member's goes where, so a vendored source, tools/aws/sources/batch-roles.json, written by tools/aws/fetch_batch_roles.py from the Batch API reference and user guide, gives each: serviceRole is trusted by batch.amazonaws.com, a compute resource's instanceRole is an instance profile whose role is trusted by ec2.amazonaws.com, spotIamFleetRole by spotfleet.amazonaws.com, and a managed instances provider's infrastructureRoleArn needs "iam:PassedToService: ecs.amazonaws.com", the update's naming the same role in the same words. SubmitServiceJob, which Floci does not serve, names its role inside the SageMaker request it queues, a string the table does not read.
The request-resources generator reads a type of two variables from a member whose documentation spells it, as it does ECS's "(family:revision)", now also where a variable shares only some of its words with the type's name, so DeregisterJobDefinition's "(name:revision)" names a job definition revision whole, not only its name, and where a member lists the form among those it takes, as SubmitJob's "definition-name, definition-name:revision, or the ARN" does, naming the revision rather than the job definition its name alone fills: "the request ARN includes the revision". BatchStoredResourceArns resolves it as Batch does, a name alone being the latest active revision a job runs, and answers the tags of what Batch stores. A member of a structure documented as "The Amazon Resource Name (ARN) of the" resource is read as one, so a job queue's computeEnvironmentOrder[].computeEnvironment is checked. No other namespace's reading changes.
A role name a path prefixes, which Batch documents ("if a role with the name bar has a path of /foo/, specify /foo/bar as the role name"), is checked on the role IAM holds under that name and path.
Batch'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. Its tag-on-create reading waits: CreateComputeEnvironment is checked as batch:TagResource or batch:SetCapacityTags, and nothing says which of its tag members each is for.
Part of #6255.
#9321 stored a webhook event source's KmsKeyIdentifier without using it. The source's secret is now created with that key, an UpdateEventSource that changes it re-encrypts the secret, and one that leaves it out or sets "" returns the secret to the AWS managed key aws/secretsmanager. A key that does not exist answers AccessDeniedException with KMS_KEY_NOT_FOUND, and an AWS managed key, or a key ARN of another Region or account, answers InvalidInputException, each at the point AWS checks it.
IAM's wording for missing and duplicate entities now matches what AWS answers. A duplicate CreatePolicy is "A policy called <name> already exists. Duplicate names are not allowed.", and a permissions boundary that names no policy, on CreateUser, CreateRole, PutUserPermissionsBoundary or PutRolePermissionsBoundary, answers "Scope ARN: <arn> does not exist or is not attachable.". A version id that names nothing on a policy that exists is named inside the attach sentence on GetPolicyVersion, DeletePolicyVersion and SetDefaultPolicyVersion, inline policies read "The user|group|role policy with name <name> cannot be found.", and instance profiles read "Instance Profile <name> ...". The wording tests share IamWordingRequests, which registers every create with PartitionCleanup.
SimulatePrincipalPolicy ignored ResourcePolicy, so a simulation answered from the identity policies alone. For an IAM user source the supplied resource policy is now evaluated through the same decide the enforcement path uses, with CallerArn, which defaults to the source user, as its principal, and its condition keys counted in MissingContextValues. Each resource's owner is the account its ARN names, otherwise ResourceOwner, otherwise the caller's account, and RoleResourceAccessAuthorizer.relationship picks the same- or cross-account rules. A role source still ignores it, as the reference says resource-based policy simulation isn't supported for roles, and CallerArn is held to its declared length.
An EKS Auto Mode node was named by its instance's private DNS name, as
managed node groups' nodes are, where AWS names Auto Mode's nodes by
their instance ID. The Ready node Floci registers for an Auto Mode
instance now takes the instance ID as its name and its
kubernetes.io/hostname label, and keeps the private DNS name as its
InternalDNS and Hostname addresses, as on AWS. Node DNS answers and
forwarding rules still use the private DNS name.
A cluster kept from before this change has its Auto Mode nodes under
their private DNS names. Once such a node registers again under its
instance ID, Auto Mode's stray-node sweep deletes the DNS-named node,
only when its provider ID is that instance's, whether the instance is
live or terminated.
CreateDistribution, GetDistribution and GetDistributionConfig dropped a
distribution's TenantConfig.ParameterDefinitions. They are now parsed,
stored and returned, with DefaultValue and Comment kept as sent and a
numeric Required (1 or 0) read as an XML boolean. The TenantConfig
subtree is read as a bounded stream: more than five definitions,
CloudFront's quota for parameters per multi-tenant distribution, or
nesting deeper than 32 levels is refused with InvalidArgument.
Closes#9580
EventBridge's storedTags answered only event-bus and rule ARNs, so aws:ResourceTag conditions on EventBridge V2 buses, subscribers and event sources saw no tags, and a Deny keyed on a tag never matched. EventBridgeService now hands an event-busv2, subscriber or event-sourcev2 ARN to EventBridgeV2Service, which reads the tags through findEventBus, findSubscriber and EventBridgeV2EventSources.lookup in the account and Region the ARN names. With V2 disabled or absent the answer stays empty.
SES v2 SendEmail accepted any additional header on a simple message,
but SES refuses the ones it sets itself. A Content.Simple.Headers entry
named From, To, Cc, Bcc, Subject, Date, Message-ID, Reply-To,
Return-Path, MIME-Version, Content-Type or Content-Disposition, in any
case, now answers 400 BadRequestException "Header <Name> is not
supported" with the name as sent, ahead of the configuration set lookup
and the sender verification. Other headers are accepted as before.
CreateDBInstance waited for the Docker backend before answering, so a
client with the SDK's default timeouts could retry a create that had
already succeeded and get DBInstanceAlreadyExists. It now stores the
instance and answers creating, as AWS does. DescribeDBInstances sees the
record while a background worker starts the container and proxy outside
the instance lock, and the worker publishes the backend only if the same
instance is still creating.
ModifyDBInstance and RebootDBInstance refuse a creating instance with
InvalidDBInstanceState and AWS's messages. A delete accepted during
startup keeps the record and the caller's backup choice until the worker
has torn down what it started, and after a restart Floci reopens the
PostgreSQL volume to save a retained backup before removing it. A state
reset waits up to 15 seconds for pending starts and otherwise refuses
with 503 from checkReset, before any container stops.
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Cloud Map lists were filtered by region, but every operation that names a namespace, service or operation by id or ARN fetched it by the bare id, so a request signed for one region read, changed or deleted another region's resource. AWS keeps Cloud Map resources per account and region. GetNamespace, DeleteNamespace, CreateService, GetService, DeleteService, the instance operations, GetOperation and the tag operations now answer a record only in the region recorded for it, with the not-found error each operation declares (NamespaceNotFound, ServiceNotFound, OperationNotFound, ResourceNotFoundException). A record stored without a region is answered in every region, as it was.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
S3 answers a bucket only in its own Region. A SigV4 request signed for
another Region now gets 301 PermanentRedirect with the bucket's Region in
x-amz-bucket-region and Bucket and Endpoint in the error, and a HEAD gets
the status and header with no body, which is what the SDKs' redirect
handling follows. ListBuckets, GetBucketLocation and CreateBucket are served
from every Region, and unsigned, presigned and SigV4A requests and buckets in
another partition are served as before. A bucket stored without a Region is
redirected from the default one, where ListBuckets reports it.
floci-duck now signs each bucket's requests for that bucket's Region through
temporary DuckDB secrets that end with the request, so Athena, S3 Select,
Redshift and the CUR reports keep reading and writing buckets outside the
default Region.
floci.services.s3.region-redirect (FLOCI_SERVICES_S3_REGION_REDIRECT,
default true) turns the redirect off.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Each EKS Auto Mode node now has a karpenter.sh/v1 NodeClaim, as Karpenter
keeps one on AWS, so kubectl get nodeclaims and tools that watch claims see
Auto Mode's nodes.
The claim is named after its pool with a five-character suffix, chosen at
launch so no other instance's claim has it and kept in the instance's
karpenter.sh/nodeclaim tag. It is owned by its NodePool, held by the
karpenter.sh/termination finalizer and labelled as its node is. Its spec
carries the pool's requirements, its pods' requests, and expireAfter and
terminationGracePeriod (336h and 24h0m0s when the pool doesn't say). Its
status goes Launched, then Registered, Initialized and Ready once the node
joins.
A claim whose instance is gone loses Karpenter's finalizer and is deleted, and
a missing one is made again without a new launch. Deleting a claim drains and
removes its node and terminates its instance, as deleting a pool does. A
NodePool being deleted launches nothing more. Only claims labelled
app.kubernetes.io/managed-by: eks are touched.
With floci.services.rds.endpoints-in-vpc on, a DB proxy's default endpoint
is served at its own address in the first of its subnets, under the name
RDS gives it, <proxy>.proxy-<identifier>.<region>.rds.<dnsSuffix>, and each
endpoint added to it at its own address in its own subnets, under
<endpoint>.endpoint.proxy-<identifier>. Each serves the engine family's
port, as "all proxies listen on port 5432 for PostgreSQL" and "on port
3306 for MySQL", so two proxies can both serve 5432; a relay forwards to
the proxy's listener, which takes a free port in the proxy range.
DescribeDBProxies and DescribeDBProxyEndpoints report the names, which
Floci's DNS server answers as soon as the proxy or endpoint exists. An IAM
token generated for any of a proxy's endpoints is good at the proxy, and
the proxies' certificate covers the names. A renamed endpoint answers by
its new name. Deleting an endpoint or the proxy removes its names and then
its relays; one Docker does not confirm removed stays tracked, keeping its
port from other databases, until Floci stops or restarts. A restart serves
them again at the addresses they had, and moves them in or out of the VPC
as the setting now says.
RdsEndpointAddresses gains a relay and name API for endpoints that are not
an instance's, with a best-effort discard, and reaches() replaces
namesCluster() for both clusters and proxies.
Closes#6273
An edge-optimized custom domain reports only its CloudFront distribution: the AWS CLI's create-domain-name example 1 (an EDGE domain) returns distributionDomainName and distributionHostedZoneId and no regional field. Floci wrote regionalDomainName and regionalHostedZoneId, and any regional certificate, on every domain. They are now serialized for regional domains only; the stored regional name is kept, because the custom domain filter still routes on it.
The two routing tests that address a domain through its .regional.local host now create a REGIONAL domain. The GetDomainNames assertion now finds the domain under item, and a new case creates an EDGE domain with a regional certificate name and ARN and checks that CreateDomainName, GetDomainName and GetDomainNames leave all four regional fields off. The custom-domain guide no longer says every domain reports a regionalDomainName and both certificate ARNs.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
AWS's Service Reference lists iam:PassRole for twelve API Gateway
operations, each passing its roles to apigateway.amazonaws.com. Floci
checked none: API Gateway is authorized by HTTP method, the passed-roles
table left the namespace out, and no member naming a role has a name the
table's rule knows (credentials, authorizerCredentials, credentialsArn,
authorizerCredentialsArn). An update names its role as a patch
operation's value, and an import inside its OpenAPI definition.
The roles are now checked for the operation the request's route resolves
to, which the table is keyed by, from three readings. A new vendored
source, tools/aws/sources/apigateway-roles.json, written by its own
script from the API references and developer guide, gives what they
read:
- The members that take a role, by the resource type each describes:
"To specify an IAM role for API Gateway to assume, use the role's
Amazon Resource Name (ARN)". PutIntegration, CreateIntegration,
CreateAuthorizer, CreateApi and UpdateApi read them, REST APIs' and
HTTP APIs' alike.
- A REST API update's patch operation, which names the property it
changes by its path ("the path for this property is /name"): the
value of the one whose path names a role member of the resource the
update returns, so UpdateIntegration reads
patchOperations[path=/credentials].value, UpdateAuthorizer
/authorizerCredentials and UpdateAccount /cloudwatchRoleArn. The
table gains a list step selecting the elements whose field holds a
value.
- An import's OpenAPI definition, JSON or YAML: the
x-amazon-apigateway-integration credentials of each Operation object,
the ANY method's included, and the x-amazon-apigateway-authorizer
authorizerCredentials of each security scheme, OpenAPI 2's and 3's,
where the guide says each extension sits. ImportRestApi and PutRestApi
take the whole body as the definition, ImportApi and ReimportApi a
body member. The definition is read as its service takes
and reads it, through a new PassedRoleLookup hook given the whole body:
API Gateway resolves a REST API definition's ${AWS::Region},
${AWS::AccountId} and ${AWS::Partition} before importing it, so a role
written with them is checked too, and takes an HTTP API's from its
body's body (the REST route's envelope) or Body (the JSON 1.1
handler's), or else the whole body, which the REST route also takes.
A REST JSON model's member is also read by its botocore name where its
wire name differs: Floci serves HTTP APIs over JSON 1.1 too
(AmazonApiGatewayV2.*), whose bodies name members as botocore does
(CredentialsArn, Body), and its handler takes either spelling as the
same member.
apigateway joins the passed-roles namespaces with all twelve operations
read and nothing added to the hand lists.
GetUsagePlanKeys ignored limit and position and returned every key attached to the plan in one response. It now pages with the same id-ordered pageById helper and pageResponse envelope GetUsagePlans and GetAuthorizers use: 25 keys by default, 500 at most, limit=0 rejected, position on nonterminal pages only, and an unknown position rejected with BadRequestException. GetUsage and the data plane keep the unpaged list.
Closes#9062
With floci.services.rds.endpoints-in-vpc on, each instance of an Aurora DB
cluster gets its own address in its VPC, as a standalone instance does, and
serves the cluster's port, which the API reference says "is managed by the
cluster". The cluster reports the names the Aurora user guide gives its
endpoints, <cluster>.cluster-<identifier>, <cluster>.cluster-ro-<identifier>
and <endpoint>.cluster-custom-<identifier>, and Floci's DNS server resolves
them to the instances as Aurora points them: the cluster endpoint to the
writer, following a failover; the reader endpoint to another instance, or
the writer when none is served; a custom endpoint to one of the instances it
holds, picked at random, and none once its static members are all deleted.
Answers live five seconds, the TTL of Aurora's DNS zones. A Multi-AZ DB
cluster, whose instances Floci does not create, and an Aurora Serverless v1
cluster, which has none, keep the proxy endpoint.
The names are routed again whenever a cluster's instances, writer or custom
endpoints change, under one lock, and are restored at restart. An IAM token
generated for any of a cluster's names is good at each of its instances, and
the proxies' certificate covers the names. StopDBCluster removes the
instances' relays and StartDBCluster serves them again; a failed instance
create forgets its name and leaves the names as they were; a cluster
restored from a snapshot serves the snapshot's port.
Refs #6273
AWS's Service Reference lists iam:PassRole for RunJobFlow, passing its
roles to application-autoscaling.amazonaws.com, ec2.amazonaws.com and
elasticmapreduce.amazonaws.com without saying which member's role goes
where, and JobFlowRole names an instance profile rather than a role.
The passed-roles table left the operation unread, so a caller allowed
elasticmapreduce:RunJobFlow could launch a cluster with any service role
and any instance profile.
A new vendored source, tools/aws/sources/emr-roles.json, written by its
own script from the EMR API reference, management guide and AWS CLI
reference, gives each member's role. The guide's page of each role names
its default role ("The default role name is EMR_EC2_DefaultRole"), and
the full access policy it gives users passes each default role to one
service ("iam:PassedToService": "ec2.amazonaws.com*"). The API reference
calls JobFlowRole an instance profile ("Also called instance profile and
Amazon EC2 role"), and the CLI reference's create-cluster examples give
the roles by name (--service-role EMR_DefaultRole). The steps' runtime
role, StepExecutionRoleArn, is not passed: "You can control access to
the runtime role with the condition key elasticmapreduce:ExecutionRoleArn."
The generator reads the source through ROLE_SOURCES, as it reads EKS's,
now taking a documented iam:PassedToService over a trust policy, a member
by name or as an instance profile where the source says so, and leaving
out a member whose role a condition key controls. RunJobFlow moves out of
notRead: ServiceRole to elasticmapreduce.amazonaws.com and AutoScalingRole
to application-autoscaling.amazonaws.com, each by name or ARN, and the
roles of the instance profile JobFlowRole names, by name or ARN, to
ec2.amazonaws.com, found with the instance-profile lookup RunInstances
already uses. A profile IAM does not hold passes no role, as Floci's EMR
already reads JobFlowRole. An instance-profile member is not read for a
call with no request of its own, which has no such lookup.
The instance profile is now found one way everywhere it is used
(IamService.instanceProfileNamed): by its name, or by its own ARN, path
and account included. IAM's passed-role check, EMR's step role and an
EC2 instance's credentials each read it their own way, and EMR kept only
the name after an ARN's last slash. A JobFlowRole ARN of another account
or path then found no role to check but ran the steps as the local
profile's role.
A member's JSON value is now read as the text a handler reads it as, a
number or a Boolean included, as the request resources and condition
keys already read a body's values. The passed-roles reader took strings
alone, while EMR takes "JobFlowRole":123456 as the profile 123456, so a
role named by a number went unchecked.
A v2 SendEmail or SendBulkEmail naming a stored template was not checked
on that template, so a policy granting or denying ses:SendEmail on one
template did not reach a v2 send with it. The request-resources generator
now reads, from botocore's shapes, the name and ARN members of a structure
named after a resource type inside a request structure
(Content.Template.TemplateName and TemplateArn, DefaultContent.Template
for bulk sends), and the table and its reader accept a field of a
structure inside a structure.
With TLS on, CreateEventSource and DescribeEventSource add *.c01.events-webhook.<region>.<host> to Floci's generated server certificate, so a client that verifies the certificate accepts a source's webhook URL. One wildcard covers every source of a Region. The source is stored under the service lock and the certificate is reissued outside it, as the API Gateway, Cognito and IoT custom domain operations do. A user-provided certificate is not changed. The TLS handshake test helper is shared through TlsTestSupport.
With the new opt-in floci.services.rds.endpoints-in-vpc, a standalone DB
instance gets its own address in the subnet of its Availability Zone, as on
RDS, and serves the Port it was created with, or its engine's default, under
the name RDS gives it: <instance>.<identifier>.<region>.rds.<dnsSuffix>, with
one identifier per account and Region. Floci's DNS server answers the name
with the address, so two instances can both serve 5432.
A relay container at the address forwards each connection to the instance's
auth proxy, so IAM authentication, TLS and the master login are unchanged;
IAM tokens bind to the name and port the proxy binding publishes. The
address follows the instance through create, stop and start, a backend
started on retry, a move to another DB subnet group, a blue/green
switchover, delete, a failed create and a restart, and keeps its subnet and
VPC in use for DeleteSubnet and DeleteVpc.
VpcAddressRelays serves any endpoint this way next to VpcContainerLeases,
which now takes back a preferred address; RdsDnsRecordSource answers the
names, and AwsEndpoints builds them. Clusters and DB proxies keep the proxy
endpoint for now.
Refs #6273
CreateCluster and UpdateClusterConfig take EKS Auto Mode's node role in
computeConfig.nodeRoleArn. AWS's Service Reference lists iam:PassRole
for both operations, with iam:PassedToService ec2.amazonaws.com and
eks.amazonaws.com, but not which member's role goes to which service.
Floci never checked the node role: CreateCluster read only its cluster
role, by hand, and UpdateClusterConfig was left out of the table.
A new vendored source, tools/aws/sources/eks-roles.json, written by its
own script from the EKS API reference and user guide, gives each member's
role and the service its trust policy is for. CreateCluster's roleArn is
the cluster IAM role ("provides permissions for the Kubernetes control
plane"), whose page links from the member and whose trust policy names
eks.amazonaws.com. nodeRoleArn is "the IAM Role EKS will assign to EC2
Managed Instances", whose description names the EKS Auto Mode IAM
reference, whose node IAM role section links the guide's page of that
role, whose trust policy names ec2.amazonaws.com. The generator reads
the source (ROLE_SOURCES) to choose, among the services the Service
Reference names for an operation, the one each member's role is for. It
fails on a vendored role for a service the reference does not name, and
on one no operation reads. --verify checks the source against the live
pages.
So CreateCluster now needs iam:PassRole on roleArn for eks.amazonaws.com
and on computeConfig.nodeRoleArn for ec2.amazonaws.com, and
UpdateClusterConfig on its node role for ec2.amazonaws.com. Both move
into the generated table. So do CreateNodegroup, CreateFargateProfile,
CreateAddon and UpdateAddon, whose roles PassedRoles read by hand, the
same members to eks.amazonaws.com the generator gives from botocore and
the Service Reference. Their hand readers are gone, and Step Functions'
EKS tasks now check them as a direct request does.
StatisticValues sent beside Values and Counts is read as a summary of the same distribution, so the weighted samples are kept without counting the summary twice. A conflicting scalar Value or a malformed summary still fails before anything is published. The weighted-summary and metric-math alarm tests share one JSON-to-Query conversion in CloudWatchTestRequests.
PutBucketReplication passes the Role of its ReplicationConfiguration to
S3, and AWS's Service Reference lists iam:PassRole for it with
iam:PassedToService s3.amazonaws.com. Floci never checked it: the
passed-roles table recorded the operation as not read, because its
request body is XML, so a caller allowed s3:PutReplicationConfiguration
could name any role.
PassedRoles now reads a REST-XML body the way the condition keys of a
REST-XML request are read (XmlParser.valuesAt): each member at the
elements botocore serializes it as, below the document element, a
list's elements under the name its shape gives them or as member. The
text is read without surrounding whitespace, which S3 keeps in a Role it
accepts. The generator reads rest-xml models too, and fails on a role
member reached through a map or a flattened list, which an XML body
does not nest as the table's paths do. Two operations move from notRead
into the table: S3's PutBucketReplication (Role, to s3) and S3 Access
Grants' CreateAccessGrantsLocation (IAMRoleArn, with no named service).
Form parameters are now read only from a request the Query controller
dispatches (IamActionRegistry.isQueryRequest: a form posted to the root
path), as formParameters already documented. A request to another
protocol's route is read as its handler reads it, whatever Content-Type
it is sent with: an S3 replication configuration sent as
application/x-www-form-urlencoded was parsed as one form key, so its role
went unchecked while S3 stored the XML. The same held for tag-on-create
and request resources reading a REST request's JSON body.
S3's PutBucketReplication now refuses with MalformedXML a document that
is not well-formed as a whole, or whose configuration does not hold
exactly one Role with text, as it already counts each rule's Destination
and Bucket. It read the first Role anywhere in the document from a parse
that stopped where the configuration ended, so a second Role holding an
element, or content after the configuration, left IAM reading no role
while S3 stored the document.
The table is keyed by operation, as the Service Reference lists it, but
the enforcement filter and the Step Functions request checks looked it
up by the IAM action. The two differ for PutBucketReplication, which is
authorized as s3:PutReplicationConfiguration, so its entry would never
have been found. Both now look roles up by the request's operation, as
tag-on-create already does. DMS's ModifyDataProvider and
ModifyMigrationProject, authorized as UpdateDataProvider and
UpdateMigrationProject, are found the same way once Floci serves them.