mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 11:38:06 -05:00
a9d3f1ecffd024fe0bf8a7994e95d8caa9f92465
115
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
335b66dd27 |
fix(iam): read a DMS resource's tags under the key its type names (#10255)
The Service Reference lists a tag key named after each DMS resource
type, dms:rep-tag/${TagKey} on a replication instance and
dms:endpoint-tag/${TagKey} on an endpoint, which Floci never filled, so
a condition on one never matched. The DMS User Guide says "The tag keys
are prefixed with "dms", the resource type, and the "tag" prefix", in
the format dms:{resource type}-tag/{tag key}, and that such a key
"matches a resource with the given tag".
A fetcher vendors that section of the guide. The request-resources
generator reads a key of the format the reference lists on a type as
that type's stored-tag prefix, leaving out dms:req-tag/, the request's
tags, and refusing a key listed on two types. It writes the format as
tagKeyFormats, which the reader checks those keys against.
The request-resources check now also runs when one of the vendored
sources its generator reads changes, several of which were missing from
the Makefile's paths and the drift workflow's triggers.
|
||
|
|
e41bbd9351 |
fix(ec2): fill ec2:AccepterVpc and ec2:RequesterVpc for VPC peering requests (#10253)
Under IAM enforcement a VPC peering request carried neither key, so a policy scoped by either side of the peering refused what it should allow. Each key is now the ARN of the VPC on that side, in its own Region and account: from the connection EC2 holds for Accept, Reject, Delete and ModifyVpcPeeringConnectionOptions, and from the request for the connection CreateVpcPeeringConnection makes. The generator reads an ARN key named as another type with a word before it from the structure member that begins with the key's name, opted in for EC2. Create's parameters are joined to the record's sides by AWS's own sample request and response on the API reference page, vendored by tools/aws/fetch_ec2_request_samples.py. Closes #8366 |
||
|
|
eb7bdb0a4d |
fix(iam): read a web identity token's claims as the IAM guide's Default mapping gives them (#10254)
A role's trust policy read a web identity token as two keys Floci built by hand, <issuer>:sub and <issuer>:aud, the latter always from the aud claim. The IAM User Guide's Default mapping, for every IdP it gives no tab of its own, also gives amr, email and oaud, and reads aud from azp where the token sets one; its page on creating an OIDC provider says AWS STS uses azp as the audience the provider's client IDs are checked against. A fetcher vendors the Default tab's rows and the provider page's azp sentence. The authorized-actions generator writes them as webIdentityClaims, and AssumeRoleWithWebIdentity reads the trust policy's keys and the token's audience from that section. |
||
|
|
76cc63c900 |
fix(iam): give a table bucket's create its request tags as s3tables:TableBucketTag (#10249)
The S3 User Guide says that when a table bucket is created with tags, s3tables:TableBucketTag acts on the tags in the request. Floci gave the create's check only aws:RequestTag and aws:TagKeys, so a policy conditioning CreateTableBucket on the table bucket key refused every create. A fetcher vendors the guide's two sentences, the key's exception and the one naming CreateTableBucket as the operation creating a table bucket with tags. The tag-on-create generator writes the key as the operation's requestTagKeys where the Service Reference gives its action the key, and TagOnCreate gives each request tag under it as well. |
||
|
|
6a60481f00 |
fix(pricing): match productFamily filters, read AWS's price list files on opt-in (#10244)
A GetProducts filter read only the product's attributes, under the exact spelling of the field, so `productFamily` (held beside the attributes) and `serviceCode` (the attribute is `servicecode`) matched nothing. A filter's field is now one of the product's attributes, or else a member the product holds beside them, as productFamily is. No field is named in the code. The API reference says "Matching isn't case sensitive for any filter type", so fields and values match without regard to case under every filter type, and an exact regionCode in any case picks its Region. With FLOCI_SERVICES_PRICING_AWS_PRICE_LIST=true (off by default), GetProducts answers from the public files of AWS's Price List Bulk API instead of the bundled snapshot. The service is looked up in AWS's offer index. An exact regionCode filter reads the Region's current file, named by the service's region index; without one, the current file for every Region, named by the version index, is read. Each file is downloaded once into <persistent-path>/pricing, and again when AWS publishes a new version. It is read as a stream that keeps only the products of the page, in the file's order, with their terms. An index is reused while AWS's response says it is fresh (Cache-Control max-age less Age), and is otherwise asked for again with its ETag, so an unchanged index comes back as 304 without a body. A connection that takes 10 s to open, or stops sending for 10 s, fails the request. The offer index address is the setting FLOCI_SERVICES_PRICING_AWS_PRICE_LIST_URL. A page holds at most MaxResults products, or the most the operation models when the request names none. Pricing's request constraints come from botocore through tools/aws/regen_pricing_shapes.py, and a request that breaks one is refused in the words AWS answers with: MaxResults out of range, more than 50 Filters, a filter's Field or Value outside 1 to 1024 characters, a missing member, or a filter Type outside the modeled set. The shared request check now words a list of structures, each element's members at its position counting from 1 (filters.1.member.type), as AWS does. A missing required member is InvalidParameterException, the only validation error Pricing models, instead of ValidationException. ListPriceLists holds a timestamp, which the shared check does not word yet, so only its MaxResults is checked. A token names the file version it was read from: a token from a version AWS has replaced has expired (ExpiredNextTokenException), and a token no page wrote is answered as AWS answers it (InvalidNextTokenException). Cost Explorer reads every product of a Region, not only the first 1000, in one pass: the file is read once for where each SKU's terms are, then for the products, reading a match's terms from their place. AWS lists one product per operating system under a usage type, so a usage line is priced at the product for its operation, as the BCM Pricing Calculator matches it. Rates read from a version of AWS's file are kept until AWS publishes another. A usage line with no usage costs nothing at any rate, so no rate is looked up for it, and no Region's file is read for a service nothing used. DescribeServices, GetAttributeValues, ListPriceLists and GetPriceListFileUrl keep answering from the snapshot. Closes #8339 |
||
|
|
bea07871fb |
feat(elasticache): emit Valkey replication groups' OpenTelemetry metrics to CloudWatch (#10173)
Node-based Valkey replication groups emit the OpenTelemetry metrics of the ElastiCache user guide's metrics reference to CloudWatch, where PromQL reads them: the vended metrics every 60 seconds, and those a resource metrics configuration selects every 15 seconds as detailed. Each node's INFO is read straight from its server, as the backend's administrator once a user group has turned the default user off, and each command's type and category come from COMMAND INFO and COMMAND DOCS. The metric table is vendored from the reference page by regen_elasticache_otel_metrics.py, checked by aws-data-check and the drift workflow. VendedOtlpMetrics stores the export requests for the account and Region. Emission is off by default behind FLOCI_SERVICES_ELASTICACHE_OTEL_METRICS_ENABLED, since each node adds about 8 KB to the OTLP store every minute. Part of #7030. |
||
|
|
ebdb9c6615 |
fix(iam): check Bedrock AgentCore by its generated routes, resources, passed roles and tags (#10153)
Under enforcement a REST route no vendored model names runs unchecked, and Bedrock AgentCore was among them: any caller
could create, read, update or delete its runtimes, runtime endpoints, gateways, gateway targets and rules, memories,
harnesses, browsers, code interpreters, workload identities and credential providers, put a resource policy, write and
read memory events and invoke a runtime, with no permission at all. AgentCore's two models are vendored now
(regen_rest_routes.MODELS: bedrock-agentcore and bedrock-agentcore-control, both signed bedrock-agentcore), so each
request is checked as its operation's action, and bedrock-agentcore joins the generated tables of request resources,
passed roles and tags on create: a resource by the id its path gives, the role each create or update passes, and the
tags a create carries.
The Service Reference passes CreateCapacityProvider's roles to bedrock-agentcore and ec2 without saying which member's
goes where. fetch_bedrock_agentcore_roles.py vendors what AWS says of each into
tools/aws/sources/bedrock-agentcore-roles.json, a ROLE_SOURCES entry as Batch's is: the operator role is "the IAM role
that AgentCore assumes to manage the capacity provider" (Control API reference), which AgentCore's capacity provider
sample says must trust bedrock-agentcore.amazonaws.com, and launchParameters.instanceProfileArn is "the IAM instance
profile to associate with launched instances", whose role the IAM User Guide's trust policy for an EC2 instance's role
gives to ec2.amazonaws.com. That member names an instance profile, which the rule does not read by its name, so the
source lists it in roleMembers, and the check that every vendored role is read now counts such members as the table
does.
BedrockAgentCoreStoredResourceArns answers the tags AgentCore holds on the resource an ARN reaches, in its account and
Region, which an aws:ResourceTag condition reads: a runtime, a runtime endpoint, a gateway, a memory or a harness as
the tag routes read the same ARN (a qualified runtime ARN answers the runtime's), and a custom browser, a custom code
interpreter or a browser profile from the tool. The table asks for a consent portal, a code interpreter by its name or
a configuration bundle to be found, which Floci does not serve, and for the memory an event is in, which the path of
GetEvent and DeleteEvent already names. A runtime endpoint's routes are checked on its runtime and a credential
provider's on *, as the generated table reads them: their ARNs end in a ${Name} beside another variable, which no
reading fills.
The tag routes no longer take the agent/<uuid> and agentEndpoint/<uuid> forms Floci wrote before #8088. They name no
AWS resource, so IAM could only check them as named, past a deny on the runtime or endpoint they reached; they now get
a ValidationException, and a legacy agent/ ARN names no runtime on invoke. A CloudFormation stack that holds an
agentEndpoint/<uuid> physical id still updates and deletes that endpoint.
A namespace the table reads is served on its tag routes only at the ARN its path encodes, as Connect's, MSK's and
MWAA's are, so AgentCore's and CloudFormation's AgentCore tests send the ARN encoded, as the SDKs do, and
docs/services/bedrock-agentcore.md says so.
IamRestRouteEnforcementIntegrationTest checks that with no grant a gateway's read is refused, that a grant on one
gateway reads it and refuses another, and that an aws:ResourceTag condition reads its tags; that a gateway create needs
iam:PassRole on its role and bedrock-agentcore:TagResource for the tags it carries; that a data plane event write is
checked on the memory its path names; that an aws:ResourceTag grant reads a browser's tags; and that a deny on a
runtime's tags holds for its ARN and its qualified ARN while the legacy endpoint form is refused.
|
||
|
|
15bcb53828 |
feat(cloudwatch): republish vended metrics for PromQL through OTel enrichment (#10151)
While OTel enrichment runs in an account's Region, each datapoint Floci vends there is republished as an OpenTelemetry data point that PromQL reads, when the CloudWatch user guide's "Supported resources and metrics" page lists its metric for the resource it measures with exactly its dimension names, and the enrichment's filters keep it: include first, then the exclude match set subtracted, empty lists permissive, names matched exactly. The classic datapoint is stored as before. The page's tables are vendored as aws/cloudwatch-otel-enrichment.json by tools/aws/regen_cloudwatch_otel_enrichment.py, which copies each namespace's scope and, per resource, whether its ARN and tags are added and each metric's instrument type and dimension sets, and refuses a reworded page. make cloudwatch-otel-enrichment-check reads the file's shape offline, in aws-data-check; -verify compares it with the live page, in iam-data-verify and the weekly drift run. A republished series carries the guide's labels: the dimensions as data point attributes, cloud.resource_id, provider, Region and account on the resource, the namespace's scope with cloudwatch.source and cloudwatch.solution, and the resource's tags as @aws.tag.<key> with resource tag enrichment while resource tags for telemetry run. Only a request enrichment wrote maps tag.* to @aws.tag; one a client sends keeps @resource.tag.*. A Sum is a delta sum of the datapoint's sum; a Histogram is a delta one-bucket histogram of its sample count, sum, minimum and maximum, as CloudWatch does not document that conversion. SQS queues pass their ARN and tags, and so do paused Aurora Serverless v2 instances and clusters and Redshift clusters; of those the page lists every AWS/SQS metric and the paused instance's ACUUtilization and CPUUtilization. A failed republication is logged and never reaches the classic publication. Part of #7030. |
||
|
|
7064800c45 |
chore(deps): bump botocore to 1.44.18 (#10128)
Bumps botocore from 1.44.17 to 1.44.18 with its regenerated data. 1.44.18 adds RDS data groups and DB cluster groups, whose operations the IAM tables now read from the model rather than marking them as missing from the pinned botocore. The Service Reference lists two tagging actions for rds:CreateDataGroup, rds:AddTagsToDataGroup and rds:AddTagsToResource, without saying whether the tags a create carries need one or both, so the tag-on-create generator stopped on it. The Aurora User Guide's prerequisites for data groups answer it: "To add tags when you create a data group, grant rds:AddTagsToResource and rds:AddTagsToDataGroup on *". fetch_rds_tag_actions.py vendors that page into tools/aws/sources/rds-tag-actions.json, and the generator, granted it for RDS alone (TAG_ACTION_SOURCES), lists both actions for the operation when they are the ones the reference lists. --verify reads the page again. That sentence grants both actions "on *", where the guide grants adding tags to a data group that exists "on data-group:*", so the fetcher copies that resource too and the table marks the operation anyResource: Floci checks the create's tagging actions on *, not on the DB cluster the create itself is checked on. The tag-on-create table and TagOnCreate now carry each operation's tagging actions as a list, and the enforcement filter, RequestChecks and STS's trust policy check every action an operation's tags need. An operation with one tagging action is checked as before. verify_role_sources' body becomes verify_vendored_sources, which both generators use to verify their vendored sources. The guide's IAM page for database cluster groups authorizes rds:CreateDBClusterGroup against "* (the group doesn't exist yet)", where the Service Reference lists cluster-group for it and a group's ARN holds a resource ID the request does not carry. fetch_rds_cluster_group_permissions.py vendors that page's table as RDS's permission source, and the request resources generator checks an action its row authorizes against * alone there. fetch_dms_arn_formats.py refreshes its botocore examples at the new pin, and the authorized-actions table takes the Service Reference's new mapping of budgets:DescribeBudgetSpendForPrincipal to budgets:ViewBudget. |
||
|
|
ae99b5a874 |
feat(observabilityadmin): serve resource tags for telemetry with its Resource Explorer managed view (#10075)
CloudWatch's OTel enrichment reads resource tags through ObservabilityAdmin's resource tags for telemetry feature, which has to be running before StartOTelEnrichment enables tag enrichment. Add the ObservabilityAdmin service with StartTelemetryEnrichment, StopTelemetryEnrichment and GetTelemetryEnrichmentStatus, one feature per account and Region. Starting the feature has Resource Explorer create a LOCAL index when the Region has none and a managed view that includes tags, as the CloudWatch user guide describes. GetManagedView and ListManagedViews now answer the views Floci's services create. A status read before the first start is the modeled ResourceNotFoundException, and a stop of a stopped or never-started feature changes nothing. The passed-roles table now reads ObservabilityAdmin. A vendored source, written from the CloudWatch user guide and the Observability Admin API reference, gives a dataset integration's role to CloudWatch Logs, whose trust policy it names, and gives where a telemetry pipeline's YAML configuration names its roles: its source's and its Secrets Manager extension's, each going to the service its source type's role trusts, and to CloudWatch Logs as well with a lookup processor or a conditional route. Part of #7030. |
||
|
|
e0254217be |
feat(cloudwatch): serve PromQL series and label discovery (#9984)
Part 1 of #7030. GetSeries (/api/v1/series) and GetLabels (/api/v1/labels, /api/v1/label/<name>/values) answer over the metrics the OTLP endpoint ingests, with the labels, selector syntax, limits and Prometheus envelope the CloudWatch user guide's PromQL pages give. Regular expressions are RE2's, as Prometheus's are. The guide's "IAM permissions for PromQL" table is vendored by a new fetcher and read by the authorized-actions generator, so the operations are checked as cloudwatch:ListMetrics, and QueryMetrics carries cloudwatch:ListMetrics as a companion every request needs, which the enforcement filter checks. @IamOperation can name a method's operation. The OTLP 40 KB metadata limit counts the resource and scope schema URLs, which PromQL reads as labels of the series. |
||
|
|
6b0f628760 |
fix(iam): read the tags of IAM's resource types beyond roles and users (#9946)
The request-resources table gives aws:ResourceTag keys to eight IAM resource types and Floci stores the tags of all
eight, but IAM's tag reader answered for roles and users alone, and regen_iam_condition_keys.py listed every resource
tag pair no RoleName or UserName names as notRead ("no member names a stored role or user whose resource tags can be
read"), which IamConditionKeys strips from the request's context. A condition on aws:ResourceTag for a customer managed
policy, an instance profile, an OpenID Connect or SAML provider, a server certificate or a virtual MFA device was
dropped.
The condition-key generator now puts such a pair in a new fromResourceTags section when iam-request-resources.json
resolves the action's request to a resource of one of the pair's types that it gives the key's prefix (resourceTagKeys):
the condition resolver reads it through its generic resource tag reading, from what IAM holds on the resource the
request names. A create the generated tag-on-create table lists (iam-tag-on-create.json) acts on a resource that does
not exist yet and stays notRead, with the reason a role's or a user's create has. 59 pairs move; none keeps the old
reason. --check re-derives the section from the two tables, and the IAM data drift gate checks the condition keys when
either changes.
IamService.heldTags reads a policy's, instance profile's, OpenID Connect provider's, server certificate's or virtual MFA
device's tags, and SAMLProviderService.heldTags a SAML provider's, each read in place in the ARN's account, a
pre-multi-account entry of the default account included; an instance profile or a server certificate, stored by its
name, only when its ARN, path included, is the one named. IamStoredResourceArns answers them.
The Service Reference now lists IAM's workload identity actions, which pinned botocore 1.44.14 does not model yet, and
the generator stopped on their tagging actions' request tags. Like classify's "no SDK operation of this name",
request_tag_context now skips an action botocore does not model, which no request Floci receives names; the table is
synced with their pairs in notRead.
IamResourceScopedPolicyEnforcementIntegrationTest checks that a caller allowed the read of each of five types only on
resources tagged team=blue reads the blue one and is refused the red one, and
ServerCertificateIamEnforcementIntegrationTest the same of certificates; IamStoredResourceArnsTest the reads and an
instance profile named by another path; test_regen_iam_condition_keys.py the new routing, the create kept unread and the
skipped tagging action.
|
||
|
|
5eebe2f708 |
fix(iam): check the ses v2 legacy GET list routes as their actions (#9826)
The sesv2 model moved ListEmailIdentities and ListConfigurationSets to the POST /v2/email/list-* routes between botocore 1.43.104 and 1.43.105. SDKs built before that move still send GET /v2/email/identities and GET /v2/email/configuration-sets, which matched no route of the model, so those requests were allowed whatever the caller's SES grants were, an explicit Deny included. The REST route generator now reads those routes from botocore 1.43.104's own model: LEGACY names the release, and build_legacy vendors, for an operation both models hold on another route, the older route as an alternative checked as the operation's action. A regeneration carries them over offline, --fetch-legacy (make legacy-routes-sync) reads them again, and --verify compares the vendored block against the release. carried_legacy checks the vendored block. Closes #9818 |
||
|
|
3f881a6e24 |
feat(kinesisvideo): add stream lifecycle (CreateStream, DeleteStream, DescribeStream, ListStreams) (#9586)
Adds Amazon Kinesis Video Streams (kinesisvideo, REST JSON, 2017-09-30) with the stream lifecycle control plane: CreateStream, DescribeStream, ListStreams and DeleteStream, stored per account and Region. A stream's ARN ends with its creation time in milliseconds and is distinct for every stream, even one recreated within the same millisecond, and its KmsKeyId defaults to alias/aws/kinesisvideo. ListStreams pages by the last returned name, so deleting between pages skips nothing. Requests are checked against the constraints of the botocore model, vendored by tools/aws/regen_kinesisvideo_shapes.py, and refusals carry the codes and wording AWS sends. Under IAM enforcement every request is checked as its kinesisvideo: action on the stream it names, read through the stream's stored ARN and tags, and a tagged CreateStream also needs kinesisvideo:TagStream. The IAM data comes from the generators. A stream is ACTIVE as soon as CreateStream returns, and DeleteStream removes it at once, where AWS passes through CREATING and DELETING. |
||
|
|
1dc6478108 |
fix(iam): return GetFunction's tags only to a caller allowed lambda:ListTags (#9782)
The Lambda API reference says of GetFunction's Tags "Lambda returns tag data only if you have explicit allow permissions for lambda:ListTags", and the Service Reference lists lambda:ListTags among the actions GetFunction is authorized by. Floci returned a function's tags to every caller allowed lambda:GetFunction. tools/aws/fetch_lambda_response_permissions.py vendors, from the API reference page of each operation the Service Reference lists as authorized by an action beside its own and the reference's operations page documents, each response element's sentence saying it is returned only with a permission, with the element and the action. It refuses a sentence naming a permission and a lambda: action in any other wording, and a page whose response elements section is missing or lists no element without saying the response is empty, so a reworded or relaid page fails rather than dropping the check. The authorized-actions generator reads it into a returnedOnlyIf section, where botocore's response of the operation has a member of the element's name and the Service Reference lists the action among the operation's: GetFunction returns Tags only with lambda:ListTags. IamAuthorizedActions reads it, and LambdaController leaves the member out of a GetFunction response to a caller not allowed the action on the function, checked with the function's tags through IamEnforcementFilter.authorizeEntryResource. TagsError is not set, as no recording of AWS's answer for that case gives its code and message. IamEnforcementFilter.requestAuthorization, which hands a handler the caller the filter evaluated, now treats a blank Authorization header as no credential, as the filter itself does, and falls back to the presigned X-Amz-Credential; before, a request with a blank header and a query credential passed the filter as that credential and the handler's check as unsigned, so GetFunction returned Tags to a caller not allowed lambda:ListTags. |
||
|
|
6563e6a315 |
fix(iam): check each layer a Lambda function adds as lambda:GetLayerVersion (#9769)
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. |
||
|
|
96819a87fd |
fix(iam): check a Secrets Manager request for the actions its required permissions give (#9758)
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. |
||
|
|
1c84d5eccf |
fix(iam): check an SQS redrive as the actions its guide gives each queue (#9743)
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. |
||
|
|
8440821793 |
fix(iam): read iam:AccountPropertyNamespaces from the keys PutAccountProperties sets (#9736)
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. |
||
|
|
5ed7187e28 |
fix(iam): read a federated assume's tags in its trust policy, and sts:TagSession from the generated tables (#9721)
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. |
||
|
|
cc74f1c3a2 |
fix(iam): read an AssumeRole's source identity as the IAM user guide gives it (#9697)
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. |
||
|
|
ee3970d6c9 |
fix(iam): read route53:VPCs from the vendored Route 53 developer guide (#9687)
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. |
||
|
|
1b7ddb1101 |
fix(iam): read EKS access entry condition keys from the vendored Service Authorization Reference (#9682)
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. |
||
|
|
b4cc436ad0 |
fix(iam): read EventBridge's rule and target condition keys from the vendored user guide (#9673)
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. |
||
|
|
c0c60ea886 |
fix(iam): check AWS Backup by its generated routes, resources and passed roles (#9669)
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. |
||
|
|
739e1274bc |
fix(iam): check AWS Batch by its generated routes, resources and passed roles (#9660)
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. |
||
|
|
a5afece703 |
fix(iam): check iam:PassRole on the roles an API Gateway request names (#9597)
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.
|
||
|
|
1a91dbda76 |
fix(iam): check iam:PassRole on the roles an EMR RunJobFlow request names (#9587)
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.
|
||
|
|
fb0e72c96a |
fix(iam): check iam:PassRole on an EKS Auto Mode cluster's node role (#9576)
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.
|
||
|
|
05b77db069 |
feat(ssm): support agent-backed Session Manager sessions (#9492)
Session Manager for Linux EC2 guests running the stock SSM agent and the Session Manager plugin: interactive shells, SSH and port forwarding, with StartSession, ResumeSession, TerminateSession, DescribeSessions and GetConnectionStatus, and session document validation. Direct SendCommand execution on instances without the agent is unchanged. StartSession and GetConnectionStatus are checked on the EC2 target, and StartSession on the selected or default session document, read from the Session Manager guide and API reference pages vendored in tools/aws/sources/ssm-session-permissions.json. Replaces #9366, rebased onto main with the generated IAM table refreshed. On top of it, GetConnectionStatus echoes the Target it was asked about, as AWS answers. The agent's OpenDataChannel is checked on the session ARN, as the client's is, so a deny on one session reaches the instance role. Starting a session deletes the account's history older than the 30 days DescribeSessions lists. Closes #9365 Co-authored-by: James McMahon <james@jamesmcmahon.co.uk> |
||
|
|
b012f4d6bf |
fix(iam): check VPC endpoint IDs in EC2 tag calls on their endpoint ARN (#9467)
CreateTags and DeleteTags checked a vpce- ID in their Resources list on `*`, because the generated table learns each ID prefix from botocore's examples and botocore gives none for VPC endpoints. A grant on one endpoint was refused and a deny on it never applied. fetch_ec2_id_examples.py copies the identifier examples of the EC2 API reference's CreateVpcEndpoint page into tools/aws/sources/ec2-id-examples.json, and the generator matches their XML paths to botocore's output shapes, which gives VpcEndpointId the vpce- prefix. That prefix joins botocore's in the one prefix map and reads only the tagging calls' generic list, so DeleteVpcEndpoints keeps its typed reader. The source names its namespace and pages, and the shared source verifier checks it against the live page. The regenerated table also takes in what the Service Reference added on 2026-11-25: CloudWatch's omni-slo, experiment and lookup types, which its tag operations now act on, Elastic Load Balancing's proxy type and the amplifygen3 namespace. Co-authored-by: Andre Kurait <AndreKurait@gmail.com> |
||
|
|
215e37eb48 |
fix(cloudtrail): name S3 denials as CloudTrail records the operation's data event (#9460)
IamEnforcementFilter named the CloudTrail data event of a denied S3 request from a hand-written table keyed by the IAM action, so a request checked under another operation's action took that operation's name: HeadBucket was recorded as ListObjects, CopyObject, UploadPart and UploadPartCopy as PutObject, GetObjectTorrent as GetObject, ListBuckets as a data event, and ListObjectVersions, ListParts, DeleteObjects, AbortMultipartUpload and the legal hold and retention calls were not recorded. A denial is now recorded under the data event of the operation the request matched, from src/main/resources/aws/cloudtrail-s3-data-events.json, which tools/aws/regen_cloudtrail_s3_data_events.py generates from botocore's S3 model, the S3 user guide's data events table and its sentence naming the event a call is recorded with (vendored by tools/aws/fetch_cloudtrail_s3_data_events.py), and AWS's S3 service reference. An operation the table for general purpose buckets lists is recorded under its name or the one the guide gives it (PutObjectRetention as PutObjectLockRetention), a versioned one under the version-less name the table lists (ListObjectsV2 as ListObjects), and an operation it does not list records no data event. readOnly is the service reference's, by the reading iam-action-resources.json's readOnlyActions are vendored by, in place of CloudTrailService's hand-written list. The IAM data drift workflow runs on a pull request touching any of the six new files, so the online check covers a change to the table alone. |
||
|
|
3fbb0ced10 |
feat(iam): read Identity Store from the generated tables (#9315)
Move `identitystore` from NOT_COVERED to NAMESPACES in regen_iam_request_resources.py, so Identity Store requests are checked on the resources they name instead of `*`: the identity store its IdentityStoreId names, and the group, user or membership its id names, whose ARNs have no Region and no account; the list calls also on every group, user or membership, as the Service Reference gives them. A type an action requires that its request does not name is now read too. Which types an action requires is what the Service Authorization Reference marks with an asterisk, which neither botocore nor the Service Reference says, so fetch_required_resource_types.py vendors that page's actions table as it stands into tools/aws/sources/required-resource-types.json, granted for Identity Store alone. Two generic readings use it: a required type the record of the resource the request names holds is read through that resource's id (DescribeGroupMembership and DeleteGroupMembership, the membership's group and user), and a required type whose id a lookup returns is found by the members its request gives, each way it may give them apart (GetGroupMembershipId, GetGroupId, GetUserId). The reader lets a find name a field of a structure at any depth and gives the service the members' paths with their values, and Identity Store answers both as its handlers find them. No other namespace's rows change. |
||
|
|
924040aaa1 | chore(eventbridgev2): vendor event source request constraints (#9333) | ||
|
|
64f74c6bc4 |
feat(iam): record IAM API calls in CloudTrail (#9263)
CloudTrail logs every authenticated IAM API request, but Floci recorded none, so a trail showed no user, key or policy change. Each IAM call now reaches the logging trails that select it as a management event: the calls IAM runs, the ones it answers with an error, and the ones IAM enforcement refuses. requestParameters carries the request's members as the IAM model types them, responseElements the result of a call that is not read-only, without sensitive members, and the record carries the caller's address, read through RequestSourceAddress, and user agent. An error IAM models is recorded under its error shape's name (NoSuchEntityException). A refusal, on IAM's policies or because a GetSessionToken session without MFA cannot make the call, is recorded as AccessDenied with "requestParameters": null and the message and request ID of the response the caller receives. The caller is read before the call runs, so a key that deletes itself is recorded as its user's, and every call reaches the account's event history whether or not a trail records it. Basic selectors' ReadWriteType now matches a management event's readOnly. IAM is a global service, so only a trail with IncludeGlobalServiceEvents records its calls, as botocore's CloudTrail model says of the setting. Which calls are read-only is generated from the Service Reference into iam-action-resources.json (readOnlyActions). How members are named, typed and redacted, and each error's shape name, are generated from botocore's IAM model into iam-cloudtrail-shapes.json through request_shapes, the walk every vendored shape file shares, which now keeps an operation's result and its wrapper, the sensitive flag and the modeled errors when a generator asks for them. Both files are checked by make aws-data-check. The integration test reads the trail's log files through CloudTrailLogFiles, calls CloudTrail through CloudTrailRequests, both now in io.floci.aws.testing with an Authorization a test under IAM enforcement signs with, and calls IAM through QueryRequests. Closes #9013 Co-authored-by: Jeremy Chapeau <jeremy.chapeau@gmail.com> |
||
|
|
a4b2f01713 |
feat(iam): read IAM from the generated tables, its paths, signing user and renames from the user guide and API reference (#9252)
IAM is read from iam-request-resources.json now, and ResourceArnBuilder's
IAM branch, the last hand-built namespace, is gone: HAND_BUILT is empty.
What botocore and the Service Reference do not say comes from the IAM
User Guide's identifiers and the IAM API reference, vendored by
fetch_iam_identifiers.py into tools/aws/sources/iam-identifiers.json and
read under PERMISSION_SOURCES.
- A user, group, role, instance profile or server certificate a request
names by its name is checked on the ARN IAM stores it under, path
included (IamStoredResourceArns.find), and one IAM does not hold on its
name under the root path.
- A create is checked on the name its request gives after the Path it
gives (path), as the identifiers say the API's creates take one.
- UpdateUser, UpdateGroup and UpdateServerCertificate are also checked
on the resource under its new name and path (renames), as their API
reference says the caller needs permission on both.
- The twenty operations whose API reference says they act on the user
signing the request when it leaves out UserName, and ChangePassword,
are checked on that user (signer), which the new
StoredResourceArns.signedBy hook gives for the signing key.
- A virtual MFA device is named by its SerialNumber, which the API
reference gives as its ARN; the access key, SSH public key and
service-specific credential operations name the user owning what they
name, and GetServiceLinkedRoleDeletionStatus the role its task
deleted (IamStoredResourceArns.through).
- MEASURED gives UpdateDelegationRequest, which the Service Reference
does not list, the request its DelegationRequestId names, citing its
API reference ("that owner gets a default permission to update the
delegation request") and the user guide's temporary delegation page.
- CreateServiceLinkedRole is checked on role/*, CreateDelegationRequest
on delegation-request/* and CreateOpenIDConnectProvider on *, as the
table gives them. CreateOpenIDConnectProvider refuses an
IdentityCenterInstanceArn that is not the ARN of an IAM Identity
Center instance, with InvalidInput.
- Bedrock's ListTrustedAccessPrograms is checked as
bedrock:CallWithBearerToken, as the Service Reference now authorizes it.
|
||
|
|
3a1ea212f0 |
feat(iam): read DynamoDB from the generated tables, its statement and item permissions from the developer guide (#9235)
DynamoDB is read from iam-request-resources.json now, and
ResourceArnBuilder's DynamoDB branch, the registry's PartiQL action,
the condition resolver's mapping of transaction items and statements to
actions and Step Functions' copy of all three are gone, leaving iam in
HAND_BUILT.
Which action each transaction item and each PartiQL statement is
checked as comes from the developer guide, vendored by
fetch_dynamodb_permissions.py into
tools/aws/sources/dynamodb-permissions.json and read under
PERMISSION_SOURCES: the PartiQL IAM page's required permissions and the
transactions page's paragraph on each kind of item.
- Each transaction item is checked as the action of its kind on the
table its TableName names (TransactItems[].Put.TableName as
dynamodb:PutItem), each PartiQL statement as the action of its verb on
the table or index it names, an EXISTS statement as the SELECT it
evaluates, which DynamoDB's own parser reads through the new
StoredResourceArns.statement hook before it binds the request's
parameters. A request naming nothing is checked as its own action on
*; a state machine's task naming nothing is left to DynamoDB, as
before.
- RequestResources.targets replaces checkedAs: each element of a list is
read apart and returned with its check, so the condition resolver
still gives each item or statement its own keys and
dynamodb:EnclosingOperation.
- BatchGetItem and BatchWriteItem name their tables by the keys of
RequestItems, which the generator reads from botocore (RequestItems{}).
- RequestResourceMembers reads Name{}, Name[].Item.Field and statement
rows (statement, verb, names).
|
||
|
|
739a22ab32 |
feat(iam): read KMS from the generated tables, its permissions from the developer guide (#9221)
KMS is read from iam-request-resources.json now, and ResourceArnBuilder's KMS branch and the enforcement filter's call around the table are gone, leaving dynamodb and iam in HAND_BUILT. What botocore and the Service Reference do not say comes from the KMS documentation, vendored by fetch_kms_api_permissions.py into tools/aws/sources/kms-api-permissions.json and read under PERMISSION_SOURCES: the developer guide's permissions table, the API reference's sentence that Decrypt and ReEncrypt read their key from the ciphertext's metadata, and the guide's key identifier formats. - ReEncrypt is checked as kms:ReEncryptFrom on its source key, or the ciphertext's key without one, and kms:ReEncryptTo on its destination key, ReplicateKey as kms:ReplicateKey and kms:CreateKey. An operation checked as several actions records them (actions, action), which RequestResources.checkedAs reads and the filter checks. - CreateAlias, UpdateAlias and DeleteAlias are checked on the alias and the keys the table names, the alias's current key through the alias. - Decrypt with no KeyId is checked on the ciphertext's key. - KmsStoredResourceArns finds a key in any state, uses only an enabled one for a forwarded request, reaches the key of an alias, a grant or a ciphertext, and gives a key's tags. |
||
|
|
0638a7f1d1 |
feat(iam): read API Gateway from the generated tables, its paths from the developer guide (#9207)
API Gateway leaves ResourceArnBuilder's own branch, and the enforcement filter's call that went around the table for it: its requests are matched on their botocore routes and checked on the resources the request-resources table reads. API Gateway authorizes a management call as the HTTP method of the request, on the resource its path names, which its developer guide says and neither botocore nor the Service Reference does. fetch_apigateway_arn_formats.py copies the guide's IAM page (the action and resource format sentences) and its ARN reference tables unchanged into tools/aws/sources/apigateway-arn-formats.json, which regen_iam_request_resources.py reads: a route authorized as its method is checked on the resource whose published format is its own path, a Service Reference type before the guide's REST row, the /v2 of HTTP and WebSocket API paths left out, and a path neither gives a row on the guide's ARN format with that path as its resource path. The formats the reference does not give are recorded under pathFormats. RequestResourceMembers reads pathFormats beside arnFormats and takes a hyphen in a path label; RequestResources URL-encodes a value filling a UrlEncoded variable, so a tagging route acts on /tags/<URL-encoded ARN> however it sends the ARN, and escapes % and / in a value filling a path-shaped format, so one label cannot pass for several segments. |
||
|
|
84cea7714a |
feat(iam): read S3's actions from its user guide, by model and by version (#9147)
Where the Service Reference gives an S3 operation no one answer, S3's user guide does. tools/aws/fetch_s3_required_actions.py copies its "Required permissions for Amazon S3 API operations" rows unchanged into tools/aws/sources/s3-required-actions.json, and the authorized-actions generator reads them: an operation's one required action (ListObjectsV2 is s3:ListBucket, CopyObject s3:PutObject), the action for one model's requests of an operation S3 and S3 Control both have (authorizedByModel: S3 Control's account-level GetPublicAccessBlock is s3:GetAccountPublicAccessBlock), and an Either row's choice by versionId where botocore gives it in the query (versioned). Measured entries quote the Service Authorization Reference for the account-level GetPublicAccessBlock the page mislabels and the version annotation actions it omits. The one answer the reference gives an operation several clients list goes to the namesake client (S3's GetBucketLifecycleConfiguration is s3:GetLifecycleConfiguration), and the file records the reference's spelling of an action named as its operation in another case (MemoryDB's CreateACL is memorydb:CreateAcl). IamAuthorizedActions reads the new sections and gives an action for a route's model and query, which IamActionRegistry uses wherever it reads a route's action. S3 stays hand-routed, so its rules still decide its requests; only the spellings show, in the action an AccessDenied message names. A hand-routed scope's routes list what their requests must carry, for the coverage test, which now also checks each model-specific action against that model's routes. |
||
|
|
306bcf8c5b |
fix(core): route JSON services over Smithy RPC v2 CBOR (#8592)
* fix(core): share JSON dispatch with RPC v2 CBOR * fix(core): adapt modeled blobs and timestamps for RPC v2 CBOR * fix(core): preserve CBOR event streams and compact wire models * test(paymentcryptography): avoid random CVV verification collisions |
||
|
|
430088b772 |
fix(ci): pass IAM drift changed paths through a file (#9025)
A large pull request diff could fail the IAM data gate before any check
ran, because the workflow passed every changed path in one make argument
("Argument list too long"). The workflow now writes the paths to a file
and iam-data-verify reads it through CHANGED_FILE, keeping affected-check
selection, the CHANGED interface, full verification for an empty diff or
the weekly run, and the report of every failed check. A Python test runs
the target with stubbed checks for each of those cases.
|
||
|
|
3a9f529158 |
fix(sts): give AssumeRole's identity-based policies the sts:RoleSessionName and sts:ExternalId keys (#8922)
With IAM enforcement on, the caller's identity-based policy, permissions boundary, session policy and SCPs were evaluated for sts:AssumeRole without the request's sts:RoleSessionName and sts:ExternalId, which the role's trust policy already sees, so a condition on either never matched. The Service Authorization Reference lists both among the condition keys of AssumeRole. STS now joins the generated request condition key table, which reads them from the AssumeRole form; an AssumeRole without ExternalId names no sts:ExternalId. AssumeRoleWithSAML carries no session name member, so it is listed as not reading it from the request. sts:SourceIdentity, sts:TransitiveTagKeys and the session tag keys are not read: Floci does not model source identity or session tags, as the STS page already says. Closes #8921 |
||
|
|
93c1d39348 | feat(account): implement GetAccountInformation and PutAccountName (#8725) | ||
|
|
ef07bfd4b3 |
feat(athena): check the Glue permissions a DDL statement needs as the caller (#8657)
Athena runs a DDL statement against the Glue Data Catalog with the caller's identity, so on AWS a caller without the Glue permissions a statement needs starts the query, and the query fails with "Insufficient permissions to execute the query." and the Glue denial. Floci never checked them: under IAM enforcement a caller holding only athena:* created and dropped Glue databases and tables through Athena. Neither botocore nor the Service Reference says which Glue actions a statement needs. Athena's user guide does, in its table "Examples of database and table-level permissions": - tools/aws/fetch_athena_glue_ddl_permissions.py vendors that table as it stands into tools/aws/sources/athena-glue-ddl-permissions.json: each statement's sentence and example policy, and the sentence that names the example database and table. --verify compares the file with the live page, and athena-glue-ddl-permissions.prompt.md says how to rebuild it when the page's layout changes. - regen_iam_request_resources.py reads it as a source of the IAM request table (STATEMENT_SOURCES, for this table alone). Each action of a policy statement acts on each of its resources whose type the Service Reference gives the action, the type whose format the example ARN matches, its variables filled with what the page says the example names stand for. The table gains statementActions, the reference's types for each action, and statements. --check derives both offline, and --verify checks the types and the page. The sync also carries the Service Reference's changes since the last one. - IamEnforcementFilter.statementRefusal checks those requests as the caller, the way a forwarded request is checked (aws:ViaAWSService, the caller's keys, the resource's policy), and returns AWS's denial. authorizeAdditionalResource's caller and decision steps move into helpers the two share. - AthenaService checks CREATE DATABASE, CREATE [EXTERNAL] TABLE, DROP TABLE and MSCK REPAIR TABLE in the default catalog before running them, naming the database and table lowercase as Glue stores them (GlueService.normalizeName), and a denial fails the query with AWS's reason. As the guide says, DROP TABLE of a table without partitions needs no partition action; a table Glue cannot read for another reason fails the query. AthenaGluePermissionsIntegrationTest runs the guide's policies under IAM enforcement, and a deny on a lowercase name against a query that spells it in capitals. RequestResourcesTest and the generator's and fetch script's tests cover the rest, and athena.md says so. |
||
|
|
acc8196d80 |
ci: run the IAM data drift check on pull requests touching the documented REST routes (#8552)
documented-routes-verify runs inside iam-data-verify for a pull request touching rest-routes.json, regen_rest_routes.py or its test, but iam-data-drift.yml's pull_request.paths listed none of the three, so a pull request changing only the routes skipped the online check until the weekly run. rest-routes.json is also one of the authorized-action check's paths, which went unchecked the same way. - iam-data-drift.yml lists the three paths, and its header says it checks the routes rest-routes.json takes from the AWS page documenting an endpoint botocore does not model. - DOCUMENTED_ROUTES_PATHS also covers regen_partitions.py and regen_query_services.py, the modules regen_rest_routes.py imports, as every other check's paths cover its generator's imports. |
||
|
|
9eda97cf84 |
feat(emr-containers): emulate the EMR on EKS control plane (#8543)
Floci had no emr-containers service, so Airflow's EmrContainerOperator, the
aws emr-containers CLI and the SDKs had nothing to call. This adds its 25
operations: virtual clusters, job runs, job templates, managed endpoints,
security configurations and tags.
Job runs follow the job run states without running Spark on Kubernetes: a
run completes as soon as it is submitted, or after
floci.services.emrcontainers.job-run-duration-seconds. When Floci's EKS has
no cluster of the virtual cluster's container provider id, the run is FAILED
with "Cluster <id> does not exist." and CLUSTER_UNAVAILABLE, as AWS's "Common
errors when running jobs" page gives it; that page also gives the wording for
a job run on a missing or non-RUNNING virtual cluster. A job template's
${name} placeholders are filled from jobTemplateParameters or the parameter's
default. Deleting a virtual cluster clears its tags, as the development guide
says, only resources in an active state of the request's Region take tags,
and a job run's template and request tags together keep the 50-tag limit. A
virtual cluster created on an EKS cluster whose authenticationMode admits
access entries is access entry integrated, which ListVirtualClusters'
eksAccessEntryIntegrated filters on.
Every request is checked against botocore's emr-containers constraints,
vendored by tools/aws/regen_emr_containers_shapes.py and gated by make
aws-data-check. Routes sit under a signed-service prefix, so a path-style S3
request for a bucket named virtualclusters still reaches S3. The routes are
added to IAM's REST route table, and emr-containers to the IAM generators'
namespaces, so each operation is checked on the resource its path names,
StartJobRun and CreateManagedEndpoint need iam:PassRole on their
executionRoleArn, and the create operations need emr-containers:TagResource
for their tags, all from AWS's Service Reference.
|
||
|
|
0b6077d374 |
fix(glue): check the Iceberg REST endpoint's routes under IAM enforcement (#8548)
No botocore model describes AWS Glue's Iceberg REST endpoint, so no
vendored route mapped its paths to an action, and the endpoint refused
every IAM principal under enforcement, letting only root credentials
and Floci's own query engine through.
- regen_rest_routes.py reads an endpoint botocore does not model from
the AWS page documenting it (DOCUMENTED): Glue's "REST APIs for Apache
Iceberg specifications" gives each operation's REST path, IAM action,
CloudTrail event and a link to its definition in the Apache Iceberg
REST catalog OpenAPI specification. Each row of the Iceberg REST
Catalog API is the Glue operation its IAM action and CloudTrail event
name, refused when they differ, on the method and path of the
definition it links, under the root and the catalogs/{catalog} prefix
the page's path gives. Rows of one operation are its route and its
alternatives. Where the page's own path differs from the definition
(DeleteNamespace's "namespces", CreateTable's GET), the definition is
taken and the difference recorded. Nothing is typed by hand.
- Reading the page needs the network, so a regeneration carries the
routes over from the vendored file, --fetch-documented reads them
again, and --verify checks them against the page;
documented-routes-verify runs in iam-data-verify.
- rest-routes.json gains the endpoint's ten Glue operations under the
glue scope, and iam-authorized-actions.json lists glue's actions of
no resource type, as it does for every routed scope. The same
regeneration takes the actions AWS has added since: GuardDuty's
ListInvestigationRecords and Route 53's IP guardrail policy actions.
- The controller's refusal of IAM principals goes. Each route is now
checked as its Glue operation, on the account's Data Catalog whichever
catalog the prefix names: the request-resource table reads no Glue
member from an Iceberg request, so a grant or deny scoped to a
federated catalog, a database or a table does not apply here.
Floci's own engine's token is not checked again.
- A request a documented route takes is another API's, so it carries
none of its operation's members: the enforcement filter has every
member reader (request resources, condition keys, tag-on-create,
passed roles) read none from it, so a Glue member a caller adds to an
Iceberg body, such as Tags or DatabaseInput, names no resource and
gives no condition key a value.
GlueIcebergIamIntegrationTest checks a principal allowed GetCatalog and
GetDatabase reading the configuration and the namespaces and refused
creating a namespace or loading a table, by GET or HEAD, a deny on the
catalog holding under an allow on everything, and root credentials and
a minted token answered, and a Glue member added to an Iceberg body
neither satisfying an aws:RequestTag condition nor naming a database.
glue.md and iam.md say so.
|
||
|
|
6de963848b |
fix(config): check requests against the modeled constraints (#8363)
The Config handler read each member with asText, asInt or path and checked only some of them by hand, so an empty or over-long Arn on the two recorder Describe calls answered NoSuchConfigurationRecorderException, and an empty ResourceArn on the three tag operations was accepted, as was an over-long one that isn't a Config resource's ARN. tools/aws/regen_config_shapes.py now vendors every Config operation's request constraints from botocore, kept in sync by make aws-data-check, and RequestConstraintCheck checks each served operation's request before it runs. A violation is a ValidationException, which the model documents for missing required fields and input that fails validation, and a Limit out of range answers the InvalidLimitException its operation models. The hand-written checks the table covers are gone, putConfigRule's included: ConfigCfnProvisioner now checks the rule it builds as a PutConfigRule request before storing it, so a template property outside the constraints fails the resource. A rule without a ConfigRuleName keeps its InvalidParameterValueException, since the model doesn't require the member. The loop that drops blob and timestamp members moves into request_shapes as drop_blob_and_timestamp_members, used by both the Config and Kinesis generators. Both vendored files are unchanged. |
||
|
|
259a0737e7 |
fix(eks): populate cluster request IAM conditions (#8336)
* fix(eks): populate cluster request IAM conditions * fix(eks): read cluster conditions through the generated table and refuse mistyped flags |