Repository navigation
Conversation
EmrServerlessIamIntegrationTest, Route53HostedZonesIamEnforcementIntegrationTest, S3TablesIamIntegrationTest and S3VectorsIamIntegrationTest each built the same identity policy, one or more actions allowed on one resource, in a private allow(actions, resource). It is now IamTestPolicies.allow, and the four tests use it.
The generators give what the Service Reference changed since the tables were last generated: Glue's ListIntegrationTableProperties and Lambda's ListRuntimes act on no resource type; logs:PutIntegration passes a role, and so do Glue's CreateDataQualityEvaluationConfig and UpdateDataQualityEvaluationConfig, which the pinned botocore doesn't have yet; the tag-on-create table gains EC2's CreateTransitGatewayNetworkFunctionAttachment, Glue's CreateDataQualityEvaluationConfig, Kinesis's CreateChannel and CreateQueue and SageMaker's CreateInferenceRouter, and kinesisanalytics:CreateSnapshot and lambda:CreateRuntime take the request's tags. Among the namespaces not read, continuum joins and appstream leaves, the reference no longer giving any AppStream operation a passed role or a tagging action. The reference now also lists iam:PassRole for WAF v2's CreateWebACL and UpdateWebACL, which PassedRoleNamespacesIntegrationTest requires the passed-role generator to read or name as not read, since Floci serves WAF v2. It reads wafv2, and names both operations as passing a role no member of their request names: botocore's model, the pinned release and the latest one alike, has no member naming a role in either request.
…IAM enforcement Under IAM enforcement no Amazon Managed Service for Prometheus request was checked: botocore's amp model was not among the vendored REST routes and the aps namespace's request resources were not read, so no request mapped to an action and every call went through. regen_rest_routes.py now vendors its routes, and the request-resources, tag-on-create and passed-role generators read the namespace, so a workspace call is checked on the workspace its path names, a rule groups namespace call on the namespace its workspace and name give, CreateWorkspace and ListWorkspaces on *, and a create that tags what it makes also as aps:TagResource. Floci tags AMP's resources through the shared tags controller, so amp joins SHARED_ROUTES: a tag call is checked on the ARN it names, sent encoded or unencoded in the path or in the bare /tags. Nothing in IAM is written by hand for it.
PR Summary by QodoEnforce IAM permissions for Amazon Managed Prometheus requests
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
pgermosen
left a comment
There was a problem hiding this comment.
@mrfelek thanks, vendoring amp and reading aps in the three generators checks each workspace and namespace call on the ARN ApsService mints, and the probe matches.
- Adding
amptoSHARED_ROUTESmakes Floci serve and authorize its tagging on the bare/tagsand on an unencoded ARN, which AWS does not have. Withapsnow read,TagDispatcher.resolveHandler(arn, uriInfo)already serves it on its model's/tags/{resourceArn}alone and refuses the rest with the existing 400, as for S3 Vectors, so the entry can go and the tagging test can expect that 400 for the other two forms. - The regeneration of the other services' tables,
wafv2with it, is a change of its own; could it go first as its own PR? iam-request-resources.jsonnow conflicts withmainafter #9074, so it needs a rebase and a regeneration.
Summary
Under IAM enforcement, no Amazon Managed Service for Prometheus request was checked. botocore's
ampmodel wasn't among the vendored REST routes and theapsnamespace's request resources weren't read, so no request mapped to an action and every call went through:CreateWorkspace,DeleteWorkspace, the rule groups namespace calls,TagResource.ampis now vendored byregen_rest_routes.py(its 44 routes, under theapsscope), and the request-resources, tag-on-create and passed-role generators readaps, the way #8518 did for S3 Vectors. Nothing in IAM is written by hand for it:workspaceIdnames,arn:aws:aps:<region>:<account>:workspace/<id>, the ARNApsServicealready mints.workspaceIdandnamegive,.../rulegroupsnamespace/<workspaceId>/<name>, andListRuleGroupsNamespaceson its workspace.CreateWorkspaceandListWorkspacesact on no resource type, so they are checked on*.CreateWorkspace,CreateRuleGroupsNamespace) also needsaps:TagResource, with its tags asaws:RequestTag/<key>andaws:TagKeys, as the Service Reference lists.ampjoins Control Tower, FIS, Resource Explorer and Signer inSHARED_ROUTES: a tag call is checked on the ARN it names whether the ARN is encoded in the path, sent with its slashes unencoded, or given in the body or query of the bare/tags.CreateScraperandUpdateScraperpass the roles inroleConfiguration.sourceRoleArnandtargetRoleArn, which the passed-role table now lists. Floci doesn't serve scrapers yet.A commit of its own first regenerates the authorized-action, passed-role and tag-on-create tables, which picks up what the Service Reference changed since they were generated on 2026-11-16: Glue's
ListIntegrationTablePropertiesand Lambda'sListRuntimesact on no resource type;logs:PutIntegrationpasses a role, and so do Glue'sCreateDataQualityEvaluationConfigandUpdateDataQualityEvaluationConfig, which the pinned botocore doesn't have yet; the tag-on-create table gains EC2'sCreateTransitGatewayNetworkFunctionAttachment, Glue'sCreateDataQualityEvaluationConfig, Kinesis'sCreateChannelandCreateQueueand SageMaker'sCreateInferenceRouter, andkinesisanalytics:CreateSnapshotandlambda:CreateRuntimetake the request's tags; among the namespaces not read,continuumjoins andappstreamleaves, the reference no longer giving any AppStream operation a passed role or a tagging action. Leaving them out would mean editing the generated tables by hand, and the AMP commit's diff is then AMP's alone.The reference now also lists
iam:PassRolefor WAF v2'sCreateWebACLandUpdateWebACL, so a plain regeneration failsPassedRoleNamespacesIntegrationTest: Floci serveswafv2, which the passed-role generator neither read nor named as not read. That commit addswafv2to itsNAMESPACESand names both operations inNOT_READas passing a role no member of their request names (NO_ROLE_MEMBER, as fordms:CreateInstanceProfile): neither request has a member naming a role in botocore's model, the pinned 1.43.118 or the latest 1.44.4.EmrServerlessIamIntegrationTest,Route53HostedZonesIamEnforcementIntegrationTest,S3TablesIamIntegrationTestandS3VectorsIamIntegrationTesteach kept the same privateallow(actions, resource)policy that this test would have copied a fifth time. It is nowIamTestPolicies.allow, in a commit of its own.Not in this PR, each a follow-up:
aws:ResourceTaghas no value to match yet, since AMP gives IAM no stored tags: there is noStoredResourceArnsforaps, so an allow or a deny conditioned on a workspace's or a namespace's tags doesn't match it. Giving it one, as fix(s3tables): give resource-tag conditions the tags of the bucket or table a request names #8505 did for S3 Tables after fix(s3tables): check S3 Tables requests under IAM enforcement #8424, is the next PR.ListWorkspacesandCreateWorkspace, and theaps:TagResourceof aCreateWorkspacewith tags, onarn:aws:aps:<region>:<account>:/workspaces, not on*: a policy allowingaps:ListWorkspaceson that ARN lets the call through, one onworkspace/*doesn't, and one on*does (measured). Floci checks them on*, so only a policy whose resource matches*allows them there, and its denial names*./workspacesis the ARN format of no resource type the Service Reference givesaps, so the request-resources generator'sMEASUREDtable, which givesdsql:ListClustersitscluster/*, can't give it either; #9039 covers such calls across services.CreateScrapernames its workspace and EKS cluster only insidedestinationandsource, which the request-resources table doesn't read, so it is checked on*, andUpdateScraperon its scraper but not on its destination workspace. Floci doesn't serve scrapers, alert manager definitions, logging configurations, anomaly detectors or resource policies; their routes are vendored with the rest.Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Amazon Managed Service for Prometheus authorizes each operation as
aps:<Operation>on the workspace or rule groups namespace it names, as the Service Authorization Reference lists, and a create with tags also asaps:TagResource. Measured on AWS (us-east-1, 2026-11-19, as a role made for the probe and deleted afterwards): a caller without permissions is refusedListWorkspaces,CreateWorkspaceandDescribeWorkspacewith HTTP 403AccessDeniedException, "User: is not authorized to perform: aps: on resource: because no identity-based policy allows the aps: action",DescribeWorkspacenamingarn:aws:aps:us-east-1:<account>:workspace/<id>; and a caller allowedaps:CreateWorkspacealone is refused aCreateWorkspacewith tags, namingaps:TagResource, with no workspace created.Checklist
./mvnw test: the full suite passes on Temurin 25 in CI's five shards (79,269 tests), with checkstyle.IamRestRouteCoverageTestand the three tables' members and namespaces tests (RequestResourceMembersTest,RequestResourceNamespacesIntegrationTest,TagOnCreateMembersTest,TagOnCreateNamespacesIntegrationTest,PassedRoleMembersTest,PassedRoleNamespacesIntegrationTest) pass with the new namespace.ApsIamIntegrationTest, underSignedIamEnforcementProfile, with its six tests failing on main at the first refusal each expects (Expected status code <403> but was <200>, or<202>for a create):DescribeWorkspacewithout a policy, allowed it once a policy allows it on the workspace's ARN, and refused again once that policy is deleted.CreateWorkspace,ListWorkspacesandDeleteWorkspace; nothing is created and the workspace stays.DeleteWorkspace.rulegroupsnamespace/<workspaceId>/*describes, replaces and creates namespaces in that workspace. The same user is refused them in another workspace, andDeleteRuleGroupsNamespace.CreateWorkspaceandCreateRuleGroupsNamespace, andaps:TagResourceonly foraws:RequestTag/teammetrics, is refused both creates with the tagteam=logs, namingaps:TagResource, and neither the workspace nor the namespace is created. Both creates pass withteam=metrics.TagResourceandListTagsForResourceon one workspace's ARN tags it by an encoded ARN, an unencoded ARN and the bare/tags. The same user is refused tagging another workspace each of those ways, listing its tags, andUntagResource; the other workspace keeps no tag.test_regen_rest_routes.pychecks the shared tags routes ofampas those of the other four models.