mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 23:59:27 -05:00
d65e76b7ea8a46bc68036701592c2f82e6e9c430
201
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ddb6680704 |
fix(iam): refuse a resource value that is no string on the way in (#8375)
The values a statement's resource elements name were gathered from the entries that were already text, so "Resource": 123 and "Resource": [123] were stored while "Resource": "123" was refused with Resource 123 must be in ARN format or "*". One text, two answers, depending on whether it was written in quotes. A value that is no string names the text of that value now, which is how the Version and the Effect are already read, so both spellings of the same text are refused alike. An element carrying null still names nothing, which is the element's own sentence rather than a value to check. The policy grammar writes a resource as a <resource_string>, and AWS reports a value whose JSON type is not the expected one as an error of its own, DATA_TYPE_MISMATCH, "The text does not match the expected JSON data type". The two other clauses that can carry a non-string are recorded: a Version of 20121017 and an Effect of true are each refused with that clause's own sentence rather than read past. The second half is which sentence that effect clause gets. A statement declaring an effect the language does not define was answered The policy failed legacy parsing whichever write was handed the document, where the inline validator words it that way and the managed one Syntax errors in policy, both recorded. The sentence follows the validator that read it now, so CreatePolicy and CreatePolicyVersion answer the managed wording while PutUserPolicy, PutGroupPolicy and PutRolePolicy keep theirs. No code and no status moves: every refusal here is MalformedPolicyDocument at 400, as it was. The version and resource sentences are worded alike by both validators and stay that way, and condition values are not read by either. |
||
|
|
1b14d10b1f |
fix(secretsmanager): check Secrets Manager requests from the generated request resources (#8365)
Secrets Manager was built by hand in ResourceArnBuilder. It now moves out of
HAND_BUILT into NAMESPACES, so every operation's resources come from
iam-request-resources.json, and the hand builder and the enforcement filter's
routing to it are gone.
The six characters Secrets Manager mints after a secret's name come from
botocore, which documents CreateSecret's Name: "Secrets Manager automatically
adds a hyphen and six random characters after the secret name at the end of
the ARN". A new rule records them as mintedSuffixes ("-??????") and has the
create name the secret it makes by Name. The reader appends them open to a
secret Secrets Manager does not hold. An ARN given for a secret, a partial
one included, is checked on the ARN of the secret the operations read it as,
alone: SecretsManagerService resolves it through resolveStoredArn to the
caller's secret in the ARN's Region, else to the one the ARN's account holds
under that full ARN, reading only.
ARNs the table renders, and the resource a create makes that its tags are
checked on, take the request's partition for every namespace, as the
Secrets Manager builder did, so a Region Floci does not know keeps the
partition of the request.
|
||
|
|
16745c3804 |
fix(ec2): resolve interface identity for tag authorization (#8352)
* fix(ec2): resolve interface identity for tag authorization * fix(ec2): read resource condition keys through the generated table * fix(ec2): look up a tag batch's interfaces in one pass |
||
|
|
bbcc58f03b |
fix(iam): read a policy value that is no string as naming nothing (#8313)
An action, a resource and a principal are written as strings: the policy grammar spells each one out, as an <action_string>, a <resource_string> and a <principal_id_string>. The evaluator read an element that was no string as naming no value when it stood on its own and as the text of that value when it sat in a list, so "Resource": 123 named no resource while "Resource": [123] named the pattern 123. A list is read like the bare element now, and an entry that is no string names nothing. It tells where the element carves an exception out, since a statement matches on whichever of the two elements it names: a NotAction or a NotResource whose only entry was a number excluded that one text and so covered every action or every resource there is, which made an Allow a grant over everything and a Deny a refusal of everything. Naming no value leaves the statement matching neither. Condition values keep the reading they had. The grammar's JSON rules say quotation marks "are optional for numeric and Boolean values", a lone number or boolean was read as the text of the value already, and a list of them is read that way still, so the two readings sit under names that say which is which. Naming no value is a shape the access report had to learn as well. deniesEveryRequest read a Deny that names no resource as one that bites on every request, where matchesResource reads the same statement as matching nothing, so an allow-everything beside a Deny whose Resource carries only a number took the service off the Organizations access report although every request still reached it. The report reads a statement the way the decision does now: a Deny covers every request only when its Resource names *. |
||
|
|
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 |
||
|
|
aa2adac677 |
fix(iam): look the user up before the service name on a credential request (#8314)
CreateServiceSpecificCredential resolved the service name first, so a request that named a user who does not exist and a service that is not supported was answered for the service. AWS answers for the user: a recording validated against a real account asks for a credential as a user that was never created, once with CodeCommit and once with a service name nothing supports, and both come back NoSuchEntity with "The user with name <name> cannot be found." The user is confirmed before the service name is read now, under the lock it was already taken under. ListServiceSpecificCredentials had the same shape, with its ServiceName filter resolved ahead of the user it lists for, and reads the two the same way round. Under AllUsers there is no user to look up, so an unsupported filter still answers for itself. What the bounds of CredentialAgeDays say is settled ahead of both by the constraints every request is held to, so only the question that needs the service is left behind it: whether this service takes the member at all. The in-operation bounds stay where they are as the backstop they became. |
||
|
|
a138f88094 |
fix(iam): resolve EC2 network resources and ownership tags (#8288)
EC2 network operations with resource-scoped policies were checked against `*`, and stored ownership conditions were missing. Every EC2 request is now read by the generated request-resource rules, its EC2 Query list names from botocore, so a resource-scoped policy applies to each EC2 operation whose request names a resource. A list a type's ARN variable names is the request's targets only when the request names nothing else, and the sg-, acl-, rtb- and eni- id prefixes come from botocore's examples. Each target is evaluated with its own stored tags, under every EC2 type's Service Reference resource-tag keys, and tags on creation are authorized separately. A forged SDK spelling cannot replace an EC2 wire value. ENI creation tags are kept in the regional tag index and stay in sync with CreateTags and DeleteTags. Closes #8286 Closes #8287 Closes #8291 Closes #8295 Closes #8300 Closes #8306 |
||
|
|
e2712cf344 |
fix(route53): populate record change IAM conditions (#8297)
* fix(route53): populate record change IAM conditions * fix(route53): align DNS identity and preserve XML validation errors * fix(route53): read record change conditions from the generated table |
||
|
|
cb03bc373b |
fix(iam): read a statement that names no effect as stating nothing (#8268)
The policy evaluator defaulted a statement's Effect to Allow, so a statement that named none granted what it described. The IAM guide says the element "is required and specifies whether the statement results in an allow or an explicit deny" and that "valid values for Effect are Allow and Deny", so a statement naming neither describes no permission, and a document that describes no permission is not a document that grants one. A resource policy whose statement named a principal and an action but no effect allowed that call, and so did a session policy, a service control policy and an identity policy: a statement is held to naming an action and a resource when a document is stored, not to naming an effect, so such a document is kept as written and was then read as a grant. A statement names one of the two effects the policy language defines or it names none, and one that names none states nothing. An Effect that is absent, that is not a string, or that is some other word is read as neither now: the statement grants nothing, denies nothing, and the request is decided by the rest of the document. That is already this package's reading of a role trust policy, where a statement whose Effect names neither effect matches nothing. The service list behind GetOrganizationsAccessReport read the same default the other way round. Walking the service control policy levels, every statement that was not a Deny was counted as an allow, so a statement naming no effect, or naming some word that is neither, left a service reachable through a statement that permits nothing. Only an Allow counts there. No document is held to a shape here: what is stored is read exactly as it was, and this changes only what reading it comes to. |
||
|
|
58930c9278 |
fix(iam): derive the request resources without corrections (#8187)
The request-resources generator carried 106 CORRECTIONS over 22 namespaces, each a hand-written entry for one operation. They are gone, and no Floci service states what an operation acts on either: a service only looks up what it holds where an entry asks it to. Every operation the corrections covered is now read from botocore's shapes and documentation and the Service Reference, or, in two places, from a fix to the handler whose behavior the correction worked around. One table stays stated by hand, MEASURED, for what AWS was measured to check where neither botocore nor the Service Reference says it. The generator admits an entry only when it links to its measurement, names types the reference does not list for the action, and gives what the rules do not; review admits only real AWS evidence. It holds DynamoDB ListTables, on table/* (#7336's probes and AWS's recorded denial), and Step Functions SendTaskSuccess, SendTaskFailure and SendTaskHeartbeat, on the token's activity or state machine (#7277's probes and AWS's recorded denial). The generator's older hand tables (FOUND_BY, THROUGH, MINTED_IDS, UNQUALIFIED, QUALIFIED_MEMBERS, ID_TARGETS, CLIENTS_NOT_READ, READ_IN_HAND_BUILT) are unchanged. Generator rules: documentation naming the type fills it when it says the member is a name or an id as the variable is; an ARN head noun, or a name ending in ArnList, makes an ARN member; fields of a top-level structure and of the structures in a map are members; the id a create answers beside another type's ARN is that type's (RunJobFlow's JobFlowId and ClusterArn); an account-id member fills AccountId; a qualified member fills first, and a ResourceId variable is the type's own id, filled by a member named ResourceId before one named after the type. An ARN member whose pattern names another service, or which its documentation gives as the ARN of another type of the service, is not read unless named after a type the action acts on. Each SDK client's model is read apart, resources the clients disagree on carry their endpoint, and a v2 load balancer's type is picked by its Type enum and documented default. A variable no member fills is fixed to the one value of an enum named after it that the operation's name gives (CodePipeline's Custom action type owner), and a type named only by an optional member documented as holding what the operation is about is reached through that thing when the member is left out (EMR's ModifyInstanceGroups, through its instance groups). Reader and service changes: a member left out, or a JSON null, names the service's default where it has one (Athena's primary workgroup and AwsDataCatalog, EventBridge's default bus, per PutEvents entry); two types whose formats differ by one variable are told apart by whether the member names that default (EventBridge rules); a name for an id variable is found by the service (Rekognition stream processors, Logs deliveries); a bare id of the type an operation is about reaches the acted-on type through its service (the project CodeBuild holds a build under, the delivery destinations of the source a Logs DeleteDeliverySource deletes). A member given a JSON null names nothing, as the handlers read it, wherever the reader fills a variable from it, so an EMR ClusterId or an IAM Identity Center TargetId of null no longer names cluster/null or account/null. The table no longer has absent or before, and the reader refuses a resource key it does not know. Checks that change where the old correction had no evidence of AWS behind it: a Step Functions Local <stateMachineArn>#<test case> is checked as given; Macie CreateMember on member/*; IAM Identity Center ProvisionPermissionSet for ALL_PROVISIONED_ACCOUNTS on its instance and permission set alone, the request-scoped account pinning that served the account check removed; Logs DeleteDeliverySource on its delivery destinations; a CodeBuild build id of no build Floci holds on *. Handler fixes: Athena's ListDatabases, ListTableMetadata and GetTableMetadata read Glue whichever catalog was named, so they were also checked on AwsDataCatalog. They now refuse a catalog whose metadata is not the account's Glue Data Catalog with MetadataException and are checked on the catalog they name. Cost Explorer's cost reads ignored BillingViewArn, so they were checked on *. They now answer the primary billing view alone, refuse another with ResourceNotFoundException, and are checked on the view they name. The passed-roles table had drifted from the Service Reference and is regenerated. AWS now passes CreateTrainingSession's role to training-session.sagemaker alone, so its RoleArn is read rather than left unread for naming two services, and AWS lists Secrets Manager's new AssociateCrossAccountReplica, which the pinned botocore does not model yet. The generator now leaves an operation no pinned model has unread on its own, until a bump brings it in, in place of a hand-written entry for each, so the two there were are gone. The tag-on-create table had drifted too: AWS no longer lists a tagging action for Network Firewall's CreateProxy, CreateProxyConfiguration and CreateProxyRuleGroup, and lists five operations the pinned botocore does not model yet. It is regenerated. |
||
|
|
9b24a38afe |
fix(iam): hold every policy document a write is handed to being a policy (#8175)
Seven writes take an IAM policy document and every one of them models MalformedPolicyDocument, "the request was rejected because the policy document was malformed". None of them answered it, so a document that was no policy at all was stored and told apart only later, when something tried to decide with it. A role's trust policy was the sharpest case: the trust evaluator reads a document it cannot parse as matching nothing, so a role written that way could no longer be assumed. The reading goes in IamService rather than at the Query front door, for two reasons. Three CloudFormation provisioners write these documents straight through the service and would otherwise be held to nothing. And the order AWS answers in differs per operation, which only the service can express: CreateRole, CreatePolicy, CreatePolicyVersion and UpdateAssumeRolePolicy read the document before the name clash or the entity lookup, where PutUserPolicy, PutGroupPolicy and PutRolePolicy answer NoSuchEntity for a holder that is not there whatever document the request carried. Which reading an operation asks for follows what the document is. A trust policy is held to the grammar alone and under its own validator's wording, "This policy contains invalid Json" for a text that does not parse as a JSON object and "Policy has no statements" for an object carrying no Statement, the element the grammar requires; its statements name a principal rather than resources, so an identity statement's elements are not asked of it. An inline policy is held to that grammar under the identity validator's one sentence for both, "Syntax errors in policy.", and to the values the language defines: a Version outside 2012-10-17 and 2008-10-17, an Effect that is not literally Allow or Deny, and a resource named neither by ARN nor by the wildcard. A managed policy is held to those and to each statement's own elements, "Policy statement must contain actions." and "Policy statement must contain resources.". None of those sentences is published and none is captured. They are the ones AWS's own emulator answers, a first-party implementation rather than a recording, and the split between the two validators' wordings is its reading too, which docs/services/iam.md records. The grammar is read in one place, not two. #8164 landed IamPolicyEvaluator.readsAsPolicyDocument for a document a request supplies to the two simulators or the two context-key readers, which asks exactly what the writes ask of the top level: parses as a JSON object, and carries Statement. The writes need to know which of the two failed in order to word their refusal, so the reading lives here and that method is now its boolean face rather than a second copy of it. Putting a document back is not a new write. A failed CloudFormation update restores the trust policy, the inline policy or the policy version it captured before the attempt, and a document an earlier release accepted must not be refused on the way back: that would leave the role or the policy without what the rollback had just removed, and the stack unable to roll back at all. So those three writes keep the reading on their public entry point and the provisioners restore through restoreAssumeRolePolicy, restoreRolePolicy and restorePolicyVersion, which apply the same write without it. The inline-policy provisioner already restored by writing the captured document straight back, so it needed nothing. This is the same rule as reading a stored document exactly as it was, applied to the one path that writes one. The whole text has to be the document. A member taking one takes "the complete, valid JSON text of an IAM policy", and Jackson reads the first value and stops unless it is told otherwise, so an object with anything after it parsed as a policy. The reader enables FAIL_ON_TRAILING_TOKENS, which is what the reference implementation's parser does by construction. A null document is nothing to judge: a required member the request leaves out is answered as absent by the constraints ahead of the operation. What is already stored is read exactly as it was, so a document an earlier version accepted still decides what it decided. Holding every caller means holding the fixtures too, the compatibility suites included: a Python and a Java SDK test each wrote an inline policy carrying only Version, and two roles in the EKS access-entry test were created with a trust policy of {}. All three are documents IAM refuses, the first two being the case recorded for a document that is valid JSON carrying only Version. Holding every caller means holding the fixtures too. Filler documents across the test tree, "{}" as a trust policy chief among them, were documents real AWS refuses; they now come from one place, io.floci.aws.testing.IamTestPolicies, which also answers a distinct document per marker for a test that needs several. Two fixtures changed in substance rather than in spelling: a Step Functions policy meant to name another event bus named it by bare name, which an identity policy may not, and a managed policy version's statements named no action. |
||
|
|
623bb15283 |
fix(iam): read the documents a request supplies, and hold each to being a policy (#8164)
`SimulatePrincipalPolicy` read neither `PolicyInputList` nor `PermissionsBoundaryPolicyInputList`, so a caller testing a policy it has not attached, or a boundary other than the stored one, was answered about the principal as it stands: a decision about a question nobody asked. Both members have published behaviour, and `SimulateCustomPolicy` already read both, the documents being its whole input, so this is the principal simulator dropping two of its own. A `PolicyInputList` document is "an optional list of additional policy documents to include in the simulation", so each is evaluated with the weight of a policy the principal holds: an allow in one allows an action the attached policies do not, which is what the operation's own example in the API Reference turns on, and a deny in one stops an action they allow. A `PermissionsBoundaryPolicyInputList` document is the boundary that simulation runs with in place of the stored one, "if a permissions boundary is attached to an entity and you pass in a different permissions boundary policy using this parameter, then the new permissions boundary policy is used for the simulation", and it is the boundary when the entity carries none, the member being "the IAM permissions boundary policy to simulate". The one-document limit both simulators are held to is read in one place now rather than two. Neither document is attached to anything, so no `PolicyExclusionList` identifier reaches either: that member names the policies "actually attached to the principal", where these are the request's own. A simulation leaving out every part a `PolicyType` can name therefore still carries what the request handed in, and a boundary handed in still holds the simulation down where the stored one was left out. Reading a document means being able to read it, so each supplied document is held to the grammar before anything is decided from it. Four operations take `PolicyInputList`, the two simulators and the two context-key readers, and each takes "the complete, valid JSON text of an IAM policy". A text that does not parse as a JSON object, and an object carrying no `Statement`, "the main element for a policy. This element is required.", are both refused with the modelled `InvalidInput`, 400, naming the entry by the index the request numbered it with. A supplied permissions boundary carries the sentence that names no entry, the member taking one document. Without that, an unreadable document was answered as though the request had carried nothing at all: an unreadable identity document left an attached allow still allowing, and an unreadable boundary was worse, becoming a ceiling that allows nothing and turning an allow into an implicit deny. The 500 `PolicyEvaluation` the two simulators model is not that answer. It carries no sender fault where `InvalidInput` does, and the two context-key readers take this same member and model no `PolicyEvaluation` at all, so one defect on one member would otherwise be answered two ways across the four operations that take it. A document already stored is read as it always was: it contributes no statements and the decision is made on the rest, because a policy the account accepted once must not make every later call fail. The supplied documents are read ahead of the principal lookup now, which is where this package answers an input. Either supplied document is also held to the shape the model declares, so one past 131072 characters is a `ValidationError` naming the member under the index the request numbered it with. The boundary list was read by the constraint walk already; `PolicyInputList` was carried by hand for both simulators, which only `SimulateCustomPolicy` needs: it requires the member and answers an empty list in its own wording, "At least one PolicyInputList member is required.", where `SimulatePrincipalPolicy` leaves the member optional and so has nothing of its own in front of the walk. So the generator's exemption drops that operation and the vendored shapes are regenerated from the pinned model, which adds the one member to `SimulatePrincipalPolicyRequest`. |
||
|
|
40ec27593e |
fix(iam): check created tags, default views, FIS actions and cross-account ARNs (#8165)
Four gaps in how the request-resources table reads a request, which the review of #8154 found in its services and which hold for any service: - A create whose action acts on no resource type had its tags checked on `*` too, so a tagging grant scoped to the type it makes refused them. The generator gives such a create the resource it makes (`makes`), and its tags are checked there when the request's tagging action acts on that type. - An optional member holding the ARN of a type, left out, names the resource its service uses then (`default`), which the reader asks the service for: Resource Explorer's `Search` and `ListResources` with no `ViewArn` are checked on the Region's default view. - A field of each value of a map of structures, named after a type the action acts on, names one resource for each value: an FIS experiment template's create and update are checked on each action it names. - An ARN naming another account is checked as given alone when its service acts on the resource in that account: an OAM sink a link is made to, a RAM invitation sent to the caller or a share another account owns. |
||
|
|
8b625f7e30 |
fix(iam): hold a blank required member to its shape rather than reading it as absent (#8058)
A required member the request carried empty was answered as a member it never carried: `requireParam` threw the null violation for a blank value as well as for an absent one, and `validatedPolicySourceArn` handed a blank to the resolver that answers an absent `PolicySourceArn`. On this protocol an empty value is a member the request carries, so what a blank breaks is the shape declared for it, and that is the constraint AWS's validation layer reports. For nearly every member nothing moves, because the constraints read ahead of the operation already answer a blank against the minimum, the pattern or the value set its shape declares: `RoleName=` breaks its pattern, `Status=` its value set, `PolicyDocument=` both its minimum and its pattern. Of every member read through `requireParam`, only `serviceName` on `CreateServiceSpecificCredential` declares none of the three. A blank there reaches the operation now, where a service name nothing supports is `NoSuchEntity` with the name echoed as the caller sent it, which is what LocalStack's AWS-validated snapshots record for a malformed name as well as for an unsupported one. `PolicySourceArn` is the one `arnType` member this package reads by hand, the simulators answering an absent one in a sentence of their own. A blank is held to the 20 characters the member declares now, which is the answer `GetContextKeysForPrincipalPolicy` gives for the same member through the model, so the two readers of it agree on the same input. One left out keeps that sentence. `docs/services/iam.md` records the split beside the wording an absent member answers with, and four tests in the constraints class pin both halves on both members. One assertion in the service-specific credential tests pinned the old reading, a blank name said never to reach the service check, and it moves with the fix: the blank reaches it and the absent name is what the required-parameter check answers. |
||
|
|
9f1cccf83f |
feat(iam): check FIS, RAM, OAM and three more services by their REST routes (#8154)
Under enforcement a REST route no rule maps and no vendored model names
runs unchecked. AWS Fault Injection Service, AWS RAM, CloudWatch
Observability Access Manager, AWS Resource Explorer, AWS Account
Management and AWS Control Catalog were among those: none of their 94
served routes had a rule.
Vendors the six models, so each route is checked as its operation's
action, on the resource its request names. A caller holding no grant
for them is now refused where the request used to pass; that is the
behaviour change.
Resource Explorer's five routes that S3 Vectors shares are matched on
the path without the prefix its filter moves them under. The FIS and
Resource Explorer tag routes are the shared controller's and keep its
bare /tags form. OAM's tag routes take the ARN as the rest of the path,
as the controllers serving them do, so an ARN sent with its slash
unencoded is checked too.
The request-resources generator reads these requests with no
hand-written correction, through four rules that hold for any service:
- A bare id after a path segment naming a type names that type:
/safetyLevers/{id}/state is the lever whose state
UpdateSafetyLeverState sets.
- A member fills the variables of a resource's own path before the
account its ARN is in, so Account Management's AccountId is the
member account of an accountInOrganization ARN.
- A type whose ARN is the account alone applies to a request leaving
out its optional account member, when that member names another
type: a request without AccountId acts on the caller's own account.
- A create makes its own type even when a member holds the resources
the action acts on: CreateResourceShare makes the share, and its
resourceArns are what the share holds.
Account Management finds that member account's organization and
management account in the caller's organization, through the lookup
the reader asks a service for the ARNs it stores, so a request naming a
member is checked on the ARN AWS checks.
The first rule also reads four CloudFront web ACL association
operations and four OpenSearch data source attachment operations on the
distribution or application their paths name. Floci serves none of
them.
An ARN fitting both a customer's format and one AWS owns is AWS's, so
an AWS managed permission is not also checked in the caller's account.
Regenerating the tables also brings in what AWS has added since the
last sync: eight Amazon Cognito user pool session operations and eight
Kinesis Analytics snapshot operations, none of which Floci serves. The
snapshot create's tags are read once the pinned botocore has it. The
count of tagged operations in iam.md is now the table's, 589, which
also takes 23 that earlier syncs added without moving it.
|
||
|
|
81894c545d |
feat(iam): check API Gateway's routes by botocore's models (#8060)
API Gateway was the one REST service besides S3 that the registry authorized by hand: seven rules gave every management route its HTTP method's action, apigateway:GET, apigateway:POST and so on, with two named exceptions written in. Its routes were vendored for the coverage test only. The developer guide gives the management API's actions as the HTTP verbs, and the Service Reference lists most API Gateway operations the action of their route's method beside permissions AWS checks only when the request carries what they guard, such as UpdateRestApiPolicy for a resource policy or iam:PassRole for a role. The authorized-actions table now lists those operations, 55 of them, under authorizedByMethod, and a request on such an operation's route is checked as the action its own method names: TagResource is a PUT in v1 and a POST in v2. The other 132 are the single-action renames the table already held, RejectDomainNameAccessAssociation and PutRoutingRule among them, or keep the action of their own name, as the portal, portal product and routing rule operations do. So the rules go and API Gateway leaves the hand-routed scopes. Every route Floci serves is checked as before. Its v1 tag routes are the shared tags controller's, so they take an ARN sent unencoded and keep the bare /tags forms, whose tagging form is a POST although v1 tags with a PUT. v2's tag routes take an unencoded ARN too, as its controller does. The routes Floci does not serve, those of portals, portal products and routing rules, are now checked as the actions AWS names for them rather than as their method. A path no route of either model has, such as a deployed API's execute path signed for apigateway, is no longer checked as a management action: AWS authorizes an invocation as execute-api:Invoke, which the execute path checks itself. Regenerating the authorized-actions table also brings in two Lake Formation operations AWS has added since, GetGlueFunctionSessionContext and GetTemporaryGlueFunctionCredentials, both authorized as lakeformation:GetDataAccess. Floci serves neither. The passed-role generator imports the authorized-actions one, so the online IAM gate checks the passed-role table for this change too, and the table no longer held: AWS now passes EMR StartSession's role to managed-compute.elasticmapreduce alone. Syncing it had failed since AWS listed iam:PassRole for three more operations the generator found no role member on, and asks a reason for. CloudWatch Logs StartQuery names no role at any depth, in the pinned botocore or the newest, so it is not read for that reason. SSM RegisterDefaultHostManagementConfiguration and Kinesis Analytics ImportSnapshot are newer than the pinned botocore, so their requests cannot be read yet. They get a reason the sync and the offline gate both refuse once the pinned models carry the operation, so a bump cannot leave their roles unread. Floci serves StartQuery and neither of the others. That refusal caught two entries the pin had already outgrown. ECS CreateGateway and UpdateGateway were excused as operations botocore does not model, from the day the table was generated, and the pin has had both for a while, each naming the infrastructureRoleArn of "the IAM role that the gateway assumes to create and manage infrastructure on your behalf". The reference passes it to ecs.amazonaws.com, so the table reads it for both now. StartSession's role goes where the reference sends it, and the hand mapping that picked elasticmapreduce out of its two services is gone. Floci serves neither ECS gateway operation nor StartSession. |
||
|
|
2fe25793c8 |
fix(iam): check Security Hub and GuardDuty routes under enforcement (#7874)
Neither REST model was vendored in rest-routes.json and no rule mapped their routes, so under enforcement every Security Hub and GuardDuty request resolved to no action and was let through: a user with no policies could EnableSecurityHub or ListDetectors. - regen_rest_routes.MODELS reads securityhub and guardduty; rest-routes.json takes their routes from botocore 1.43.118, and iam-authorized-actions.json their actions of no resource type (securityhub 31, guardduty 70). Nothing else changed. - Both move from NOT_COVERED to NAMESPACES in the table of request resources: 228 operations, 3350 over 46 namespaces, no other entry changed. Security Hub's hub actions are checked on the caller's hub in the Region, hub/default, the ARN Security Hub gives it, and GuardDuty's detector and publishing destination operations on the detector their path names. - The generator gains a rule: an optional top-level member holding the ARN of a type whose format has no variable of its own also names that type when the request leaves it out. DescribeHub with no HubArn is so checked on hub/default, as AWS checks it, rather than on *, which would refuse a grant scoped to the hub. The rule changes no other operation. - Both move to NAMESPACES in the tag-on-create table too: an EnableSecurityHub carrying tags also needs securityhub:TagResource on the hub, a GuardDuty create carrying tags guardduty:TagResource, and the create is checked with aws:RequestTag and aws:TagKeys. Regenerated from the Service Reference retrieved 2026-11-11. It now also gives two Lake Formation operations, GetGlueFunctionSessionContext and GetTemporaryGlueFunctionCredentials, checked as lakeformation:GetDataAccess; they are left to the next sync, which --verify reports without failing. Macie is read by #7869. IamRestRouteEnforcementIntegrationTest checks both services: a caller with no grant refused, a grant scoped to the hub or detector let through, another Region's hub and another detector refused, and a deny holding under an allow on everything. IamTagOnCreateEnforcementIntegrationTest checks a hub enabled and a detector created with tags: TagResource needed, a request tag condition applied, and an untagged create needing its own action alone. All four fail on main. iam.md says so. Closes #7830 |
||
|
|
d250eb276e |
fix(s3): refuse an unserved sub-resource and keep a key's own slashes (#8019)
A bucket request that names a sub-resource Floci does not serve fell through to the bucket's own operation: DELETE ?metadataConfiguration and ?metadataTable deleted an empty bucket, GET ?abac and ?metadataTable listed it, PUT ?abac created a bucket that did not exist, and HEAD ?acl ran HeadBucket. The same happened to a sub-resource sent with a method AWS defines none for, such as DELETE ?versioning. A POST naming one got a 400 asking for ?delete, and no IAM check at all. The bucket handlers, HEAD and POST among them, now refuse such a request where they would have run the bucket's operation. A sub-resource the AWS model defines for the method is answered 501 NotImplemented, and one it defines for other methods only 405 MethodNotAllowed, as DELETE ?accelerate already was. A browser-form upload and DeleteObjects still run first on a POST. The sub-resources are read from botocore's S3 model in the vendored rest-routes.json, so one AWS adds is refused once the table is regenerated, not run as the bucket, and their names from the parsed query parameters, so an escaped & inside a value, ?prefix=reports%26abac, names none. The IAM check matches: an unserved sub-resource is checked as the action the Service Reference gives the operation it names (DELETE ?metadataTable needs s3:DeleteBucketMetadataTableConfiguration, not s3:DeleteBucket, and POST ?metadataTable s3:CreateBucketMetadataTableConfiguration), which lets the route coverage test drop the two operations it exempted. A key made only of slashes was read as the bucket too: JAX-RS collapses PUT /bucket// to the bucket's path, so it ran CreateBucket and was checked as s3:CreateBucket, where it writes the key "/". A filter now escapes such a key's slashes in the path the router matches, path-style and virtual-hosted, so S3 and the IAM check both act on the object, arn:aws:s3:::bucket//. One trailing slash, /bucket/, is still the bucket. The resource ARN a request is checked against read the same collapsed path, which named another object whenever a key carried a slash of its own. PUT /bucket//email.txt stores the key "/email.txt" and the controller and the condition resolver both read it that way, from the path as it arrived, while the ARN came out as arn:aws:s3:::bucket/email.txt: a grant on that object covered this one, and a statement naming bucket//* matched nothing it names. A key with a double slash inside it, a//b.txt, was checked as a/b.txt the same way. The ARN is now built from the key those two already read, through one reader the three share, so the object stored, the object a condition describes and the object a policy is matched against are the same one. An S3 Control operation, told apart by the operation as before and not by its path, names no object and is left as it was: the ARN in its path is still taken as written. |
||
|
|
d0d0e0eef8 | fix(codedeploy): preserve deployment group creation tags (#8025) | ||
|
|
dfec9737a6 |
feat(iam): check Lake Formation, Macie and Inspector by their REST routes (#7869)
Under enforcement a REST route no rule maps and no vendored model names runs unchecked. Lake Formation, Macie and Inspector were among those: of their 33 served routes only Inspector's Disable had a rule, added by hand. AWS's Service Reference gives 32 of those 33 actions no resource type, so each is authorized on "*", which is what the route join added in #7461 already checks when the model is vendored. Vendors the three models, so all 33 are checked as their operation's action. A caller holding no grant for them is now refused where the request used to pass; that is the behaviour change. The 33rd is Macie's CreateMember, on the POST /members it shares with Security Hub, which AWS authorizes on the member it makes and with the tags it carries. A correction fills the member from account.accountId, so a grant or a deny scoped to one member holds, and Macie joins the tag-on-create table, so a request with tags needs macie2:TagResource and its tags are what aws:RequestTag and aws:TagKeys see. Inspector's Disable rule goes, since the vendored route gives the same action. Macie and Inspector move into the table of request resources, their reason for staying out (no model vendored) no longer being true. Lake Formation has no resource type at all, so that table does not list it. Regenerating the tables also brings in es:UpdateClone, which AWS has added since. Floci does not serve it. |
||
|
|
0197723641 |
fix(iam): simulate a principal without the policies the request excludes (#7865)
`SimulatePrincipalPolicy`'s `PolicyExclusionList` was read by nothing, so a caller excluding a policy was given a simulation that still counted it, which is the decision it had asked not to be given. The member is read now: each `PolicyIdentifier` drops a policy from the set this one simulation evaluates and from nothing else, the attachment and every listing left as they were. The reference states both answers an entry gets, and those are the answers here: "Syntactically invalid identifiers, such as malformed ARNs or wildcards in disallowed positions, cause the request to fail with an InvalidInput error. Syntactically valid identifiers that don't match any attached policy are ignored." The constraints ahead of the operation already hold each member of an entry to the shape the model declares, so an unknown `PolicyType` is the `ValidationError` it always was; what the vendored data does not carry is the union marker, so the rule that an entry names exactly one of the three is held where the entry is read. A `PolicyArn` is held to the one position the member admits a wildcard in, the resource name, so a wildcard in the resource type an ARN carries ahead of it is refused rather than matched: a `poli?y/reader` reads like the `policy/reader` it would reach. It is held to carrying the fields every ARN carries too, its partition, its service and its resource, a blank one being a malformed ARN rather than an identifier that matches nothing. The region and the account are not among those, an AWS managed policy carrying no region. `PolicyType` reads as the part a policy plays rather than the kind of document it is, which is what keeps `permission-boundary` in a value set beside `user-managed`: a boundary is itself a customer managed policy, so a type meaning the kind would match it twice. `scp` matches nothing, this simulation carrying no SCP ceiling, and `rcp` is published as ignored. An ARN names the policy itself, so it reaches that policy in whatever part it plays, the boundary included. The account-level grant an account password policy carries is attached to nothing and reached by nothing. The wording of the two refusals no source gives, and the reading of a wildcard in `AttachmentName`, which the member documents and its own declared pattern admits no character for, are recorded under Policy Simulation in docs/services/iam.md. |
||
|
|
90a4455905 |
chore(iam): sync the tag-on-create table with what AWS has added (#7852)
make iam-tag-on-create-sync has failed since AWS listed three more operations with a tagging action, because the generator found no request member carrying tags on any of them and asks for a reason. SSM's StartExecutionPreview has no such member at any depth, so it is not read for that reason. Athena's CreateSystemTableConfiguration and SageMaker's CreateClusterExtension do take Tags, but the pinned botocore predates both, so their requests cannot be read yet. They get a reason of their own, which the generator refuses once the pinned botocore has the operation, so a bump cannot leave their tags unread. Floci serves none of the three. The sync also lists the new applicationinsights namespace, and iam.md's count of operations read with their tags follows the table. |
||
|
|
69da60d07f |
docs(iam): settle a distribution's IAM certificate on what AWS publishes (#7740)
CloudFront resolves ViewerCertificate.IAMCertificateId by id alone, and two questions about that have sat open. A server certificate meant for CloudFront must be uploaded under /cloudfront, which nothing here enforces, and a blank value is read as naming no certificate at all. The blank is settled by AWS's own text, twice over. The member is declared with a minimum length of 0, so an empty string breaks no bound it carries, and the ViewerCertificate entry tells a caller on the CloudFront domain name to set CloudFrontDefaultCertificate and leave all other fields empty. An element left empty arrives as a blank on this REST XML protocol, so reading it as an id would refuse the very request the reference asks for. The path is a published obligation on the caller, in IAM's UploadServerCertificate note and again in CloudFront's own procedure for uploading a third-party certificate to IAM, and this emulator does not hold callers to it. That is a deliberate divergence rather than a reading of what AWS accepts. What is published is the obligation on the upload rather than a refusal on the write: the Developer Guide's InvalidViewerCertificate page enumerates what CloudFront verifies when an alternate domain name is added, in the order it verifies them, and the certificate's path is not among those checks. Holding a distribution to the path would refuse a write on a rule published for the upload, so the id alone decides until something records otherwise, and a capture of such a refusal moves the reader, the page and the test. The reasoning lives in docs/services/iam.md, with the CloudFront page and the reader's javadoc pointing at it, and two tests pin what each case does: a distribution created through the API with an empty IAMCertificateId element is accepted and holds no certificate, and a certificate uploaded outside /cloudfront serves a distribution and cannot be deleted while it does. |
||
|
|
16ce8261eb |
fix(iam): check an object's tags apart from its members on create (#7739)
The tag-on-create check reads a body's tags under any spelling a handler
might read, so that no tag a handler applies goes unchecked. An object at
the tags member was read both ways into one set: its structures as tags
and its members as a map's tags. A member named as a structure's key then
replaced that structure's tag, so KMS's CreateKey with
{"Tags":{"team":{"TagKey":"team","TagValue":"red"}}} was checked as
team="" while its handler, which iterates Tags whatever it holds, stored
team=red: a deny on aws:RequestTag/team held on neither kms:CreateKey nor
kms:TagResource.
The two readings are now sets of their own, each checked, so the tag the
handler applies is checked whatever the members are named.
OpenSearch's creates refuse such an object as a TagList, but a deny on a
tag in its structure now refuses it first, as it does a list.
|
||
|
|
3c398103ed | fix(iam): resolve missing roles and EC2 tagging targets (#7596) | ||
|
|
ee2cdfc4f8 |
docs(iam): close the service principal's comma on what AWS publishes (#7617)
`CreateServiceLinkedRole`'s AWSServiceName was left with one question open. The capture on #6042 quotes [\w+=.@-]* for it, without the comma the vendored shape admits, and nothing recorded said whether AWS takes a comma or refuses one, so the shape kept the model's pattern and the message the captured text. AWS's own API Reference entry for the operation answers the part that matters. It gives the member a minimum length of 1 and the pattern [\w+=,.@-]+, the comma included, which is what botocore declares for the shape it aliases the member to as well. The comma is therefore what AWS documents for this member rather than something that aliasing brought along, the captured message is the only source that drops it, and a message answers for the text a violation carries rather than for what a value is held to. So what a principal is held to stays the published pattern and nothing moves about what this service admits. The minimum is published there too, which is why an empty principal stays refused for a reason of AWS's own rather than the model's alone. What is left is a reading worth pinning rather than inferred again: a principal carrying a comma clears the shape and reaches the lookup, where a service no recording covers has its role name derived from the principal's labels, the answer any unrecorded principal gets. That reasoning lives in the docs page alone, with the generator's comment and the test's javadoc pointing at it, and a capture of AWS refusing a comma as a pattern violation moves the quoted-pattern entry, the shapes file a regeneration writes from it, and that test. |
||
|
|
6110825561 |
fix(iam): check the tags an OpenSearch domain is created with (#7616)
OpenSearch's CreateDomain and the legacy CreateElasticsearchDomain store the TagList they carry, but the tag-on-create table did not read the `es` namespace, so under IAM enforcement a caller allowed to create a domain could tag it with no es:AddTags, and a policy allowing the create only with some tag did not hold. The reason the generator gave, that no rule maps its REST routes, has not been true since they were vendored. `es` moves to the generator's namespaces. The Service Reference lists OpenSearch Service's operations for the `es` client alone, so, as the request-resources generator does, an operation of a vendored REST model it lists for no client is read as the action of its own name: it needs the tagging actions of the operations the reference lists that action for, and is checked with the request's tags when that action takes them. The `opensearch` client's CreateDomain is es:CreateDomain, which the reference lists for CreateElasticsearchDomain beside es:AddTags, as the OpenSearch Service developer guide's policy for creating a domain only with a tag grants es:CreateDomain and es:AddTags. Both creates now need es:AddTags on the domain they name, and are checked with the tags as aws:RequestTag/<key> and aws:TagKeys (587 operations over 72 namespaces, no other entry changed). The handler also read a TagList the model does not allow, and not as the check reads it: a tag with no value was dropped, though the check lets it replace an earlier tag of its key, and an object's structures were tags, though the check lets a member of the same name replace them. Either got a denied tag past a deny on it. The model requires a list of tags, each with a Key of 1 to 128 characters and a Value of up to 256, so CreateDomain and AddTags now refuse anything else with a ValidationException, before changing anything, and the tags checked are the tags a domain gets. |
||
|
|
1ce40a1c79 | fix(iam): populate stored caller principal tags (#7591) | ||
|
|
c3058a8de4 | fix(iam): generate resource and request tag condition context (#7589) | ||
|
|
b1ba11c61e | feat(stepfunctions): evaluate the execution role on SNS and EventBridge tasks (#7622) | ||
|
|
5bcb83b932 |
fix(iam): check Redshift requests on the resources they name (#7287)
Under IAM enforcement, Redshift requests were checked on `*`, so a grant scoped to a cluster, a snapshot or a database user was refused, and a deny scoped to one never applied. The redshift namespace moves from NOT_COVERED to NAMESPACES in the request resources generator, with corrections where the generated rule checks the wrong resource. GetClusterCredentials now also gives the redshift:DbUser condition key, from a new generated table, to its own check and to the CreateClusterUser check that AutoCreate adds. Refs #5907 fix(redshift): act only on a snapshot of the cluster the request names A snapshot request is checked on snapshot:<cluster>/<name> for the cluster it names, but DeleteClusterSnapshot, RestoreFromClusterSnapshot and DescribeClusterSnapshots found the snapshot by its name alone. A caller allowed on one cluster's snapshots could act on a snapshot of another cluster by naming the allowed one. A snapshot taken from another cluster than the one the request names, in SnapshotClusterIdentifier, the cluster of a SnapshotArn, or DescribeClusterSnapshots' ClusterIdentifier, is now not found. Refs #5907 chore(iam): generate the Lambda Web and Redshift condition keys into one table chore(redshift): read a restore's snapshot ARN once |
||
|
|
0f6d23c917 |
chore(iam): clean up the users a list test leaves and record whose reading the gap is (#7568)
Two follow-ups from the change that read every Query list off the indices a request numbers. The tests holding that reading create a user each and deleted none of them. The emulator is shared between test classes, so those users outlive the class that made them and the next class to list users unscoped reads them. The provider the same class creates is registered with the cleanup extension already, which the class holds for exactly this, so each user is registered beside it. The reading itself is recorded as this service's own. Nothing published says AWS takes a gap in a numbered list, and no SDK sends one: botocore's Query serializer numbers a list from 1 with no gap in it, so a request carrying one is written by hand. What is recorded is that the constraints ahead of each operation read every index a request names, which is the disagreement that change closed, so a gap is read the way the constraint walk already read it until a capture says otherwise. The account properties map says the same of its own entries. Nothing under src/main changes. |
||
|
|
a64fa37cd7 |
feat(iam): read IAM Access Analyzer's request resources (#7567)
Access Analyzer's routes are vendored, but the table of request resources did not read the namespace, so a route of an action AWS checks on an analyzer, GetAnalyzer, CreateAnalyzer and DeleteAnalyzer among the ones Floci serves, was left unchecked under enforcement: a caller with no grant on the analyzer was let through and a deny on it never applied. - access-analyzer moves from NOT_COVERED to NAMESPACES: 39 operations, 1544 over 35 namespaces, no other entry changed. An analyzer is read as analyzer/<analyzerName> from the path or the body, the ARN Floci mints, an archive rule as analyzer/<analyzerName>/archive-rule/<ruleName>, and the operations naming an analyzer by its ARN, in the body or the query, on that ARN. - With every operation of the scope in the table, the routes check each by the resources-read half of the join rule. No vendored route is left unchecked: every routed scope is read, built by hand, or of an action of no resource type. - The REST reason of the namespaces not read yet no longer says the path is not read: RequestResources reads it from the vendored routes, which do not have those namespaces' models yet. - access-analyzer is read by the tag-on-create table too, so a CreateAnalyzer carrying tags also needs access-analyzer:TagResource on the analyzer it names, and its own action is checked with them as aws:RequestTag and aws:TagKeys, as the Service Reference lists. The regeneration also takes Config's PutServiceLinkedConfigurationRecorder, which the reference has listed with config:TagResource since the last sync; Floci does not serve it. IamRestRouteEnforcementIntegrationTest creates an analyzer and checks GetAnalyzer, CreateAnalyzer and DeleteAnalyzer on the ARN Access Analyzer gives it, a grant scoped to it, another analyzer refused and a deny holding; the vendored-route test's unchecked example is gone. IamActionRegistryTest checks the analyzer routes and keeps an unread example on a fixture (Backup's GetBackupPlan); RequestResourcesTest reads an analyzer from a path label and a body and an archive rule from both; IamRestRouteCoverageTest pins the five operations Floci serves; IamTagOnCreateEnforcementIntegrationTest checks a tagged CreateAnalyzer needs TagResource on its analyzer and meets a request-tag condition, and an untagged one CreateAnalyzer alone. iam.md and access-analyzer.md say so. |
||
|
|
4abccec0c8 |
fix(iam): read every Query list and map off the indices the request numbers (#7547)
The Query protocol numbers a list's members rather than ordering them, and the constraint walk reads every index a request names. The handler read a run from 1 that stopped at the first gap, so the two halves disagreed about what a request carried: a request numbering tags 1 and 3 was held to both tags and then stored the first alone, and a simulator whose first action is numbered 2 answered `At least one ActionNames member is required.` for a list that had a member in it. Every list and map `IamQueryHandler` reads now goes through `AwsQueryLists.members`, the same call with the same arguments the constraints read them with: tags and tag keys with the count each is held to, the two generic value readers, which had the same body once both read indices and are one reader now, the context entries at both of their levels, and the `Properties` map of `PutAccountProperties`. The last site was the reader a delegation request's policy parameters had to themselves, which read its indices but only in the generic spelling: those parameters take the bare form with it, and the handler reads a list in one place rather than three. A member numbered only under a deeper key carries no value of its own and is no member of a list of values, and a tag or a property numbered with a value and no key is nothing a map could hold, so neither is counted nor stored. The tags a create is authorized with are read the same way. `TagOnCreate` says how each Query handler numbers a create's tag list, so the policy is checked with the tags the resource will get, and it had IAM reading `Tags.member` to the first gap, as this handler did. On its own this change would have left the authorizer reading a different list than the one stored: a tag numbered only at 2 met no policy requiring it, the model saying the handler applies none, and tags split across the two spellings were a set each, where a deny naming both keys matched neither. IAM reads there by the rule the handler reads by, rather than by a copy of it: the member comes from the generated tag-on-create table and the spellings from `AwsQueryLists.memberKeys`, so no spelling is written twice and a later change to that rule moves both sides at once. The handlers that number a list their own way keep their own readings, untouched. Seventeen wire tests over four classes, one for each reader, one for each spelling it missed, and three holding the authorization. The provider one deletes what it creates: the emulator is shared between test classes, so the next class to list providers unscoped would read it. Fifteen of them fail against the readings this replaces. The reading is recorded in `docs/services/iam.md`, in the list section and beside the account properties map. |
||
|
|
26cd74e6f8 |
fix(iam): read a REST request's path and query members under a form too (#7527)
A member the table locates in a REST request's path or query was laid over a JSON body alone: a request sending a form skipped the overlay, so a form's DomainName was read in place of the path's. OpenSearch answers a form with 415, so no such request reaches its handlers today, but the next REST namespace the table reads whose handler does not refuse a form would be checked on the form's name while it acts on the path's. RequestResources now lays the located members over a form as it lays them over a JSON body, for the resources a request names and for those it creates: each is dropped from the form and read from the path or the query alone. RequestResourceMembersTest checks every resource of the table from a form as from a JSON body, each located member given in the path or the query and another value in the body and in the form; RequestResourcesTest sends OpenSearch requests as forms naming another domain than the path or the query does. iam.md says so. |
||
|
|
9062572948 |
feat(iam): read a REST request's resources from its path and query (#7499)
The table of request resources read only a request's body or Query
form, so no REST namespace was read: a REST request names its
resources in its path and its query. An OpenSearch Service request
naming its domain, DescribeDomain on
/2021-01-01/opensearch/domain/{DomainName}, was left unchecked by the
routes the previous change reads, as Floci could not check it on the
domain AWS checks it on.
- The generator reads a rest-json request's members in its path and
its query as members, under their botocore names, and records where
each one a resource reads is (`located`): a path label, `{Label}`, or
a query parameter, `?name`. RequestResources lays them over the body,
a label's value from the route the request matched in the vendored
routes (IamActionRegistry.pathLabels, IamRestRoutes now capturing
each label), a query parameter's from the query, so every kind of
resource reads them as it reads the body's. A located member is read
from where it is alone, as its handler reads it: one the body also
gives is dropped.
- A namespace read this way also takes the operations of each botocore
model Floci reads routes for under it (regen_rest_routes.MODELS) that
the reference lists for none of its clients, each the action of its
own name with that action's resource types, when the reference has
that action: the reference lists OpenSearch Service's `es` client
alone, while the `opensearch` client's operations are named after
`es` actions. --verify checks such an operation's action and types
against the reference's Actions, and reports one whose action AWS no
longer has.
- `es` moves from NOT_COVERED to NAMESPACES: 120 operations, both API
versions', 1505 over 34 namespaces. Every domain route Floci serves
reads its domain, from the path, the body or `?arn`, on
`domain/<DomainName>`, the ARN Floci mints. Those whose resource the
table does not find (outbound connections, applications, insights)
are routes Floci does not serve.
- Reading rest-json would also have read the Payment Cryptography data
plane's key from its path; Floci serves only the control plane, so
`payment-cryptography-data` joins CLIENTS_NOT_READ with its reason
and its operations stay as they were. No other entry changes.
With the domain operations in the table, the routes check them by the
resources-read half of the join rule. IamActionRegistryTest checks the
domain routes and the labels a request's path gives;
RequestResourcesTest reads a path label, a query parameter and a body
together; IamRestRouteEnforcementIntegrationTest checks DescribeDomain,
DescribeElasticsearchDomain and ListTags on the domain they name; the
generator tests cover the located members, a member two clients locate
apart, the REST models' operations and a round trip through --check and
--verify. iam.md says so.
|
||
|
|
27057e2c00 |
fix(ssoadmin): provision to all accounts only those the check covered (#7463)
Under IAM enforcement, a ProvisionPermissionSet for ALL_PROVISIONED_ACCOUNTS is checked on each account the permission set is provisioned to, which the permission check finds through SsoAdminService.through. The handler then found those accounts again and provisioned to each. Another request could provision the permission set to one more account in between, with an account assignment of its own, and a permission set change could leave that account LATEST_PERMISSION_SET_NOT_PROVISIONED: this request then provisioned it again, changing the account's state with no policy checked against it. The accounts are now found once for the request and kept, in a request-scoped SsoAdminRequestContext, as PaymentCryptographyRequestContext keeps the key an alias named: the check and the provisioning use the same accounts, and an account provisioned to since is left as the other request left it. Each request finds them afresh, so the next one is checked on it. SsoAdminServiceTest replays the race: the check finds one account, another account is assigned and a policy attached, and the provisioning leaves the second account not provisioned. The IAM integration test assigns a third account after a request was let through on two, and the same grant no longer covers the next request. iam.md says so. |
||
|
|
251bb39375 |
feat(iam): check REST routes no rule maps by botocore's models (#7461)
A REST request gets its IAM action from IamActionRegistry's hand-written rules, and a route no rule maps gets none, which the caller allows: under enforcement such a request runs unchecked. IamRestRoutes (#7085) reads botocore's routes at runtime, but only for the operations a hand-written list enrolls, ValidatePolicy alone, and only by literal paths. A request no rule maps is now the operation whose route in botocore's model it matches, and it is checked as that operation's action (IamAuthorizedActions), as a Query or JSON request naming its operation is, when Floci checks it on the resources AWS does: those its request names, which ResourceArnBuilder builds for its namespace or the vendored request resources read for the operation, or none, when the Service Reference gives the action no resource type, as AWS authorizes such an action on `*`. An action AWS checks on a resource Floci neither builds nor reads stays unchecked, as before: checked on `*`, a grant scoped to its resource would be refused. That is the reason #7085 gave for enrolling ValidatePolicy alone, now read from generated data instead of a list. - The actions of no resource type come from the Service Reference's Actions, through regen_iam_authorized_actions.py, into iam-authorized-actions.json, for each credential scope whose routes rest-routes.json reads: 88 over 7 scopes. They are read from Actions, not Operations, because the reference lists one SDK client's operations per namespace, OpenSearch's `es` client alone. --check fails until a scope rest-routes.json adds is listed, and --verify fails when AWS gives a listed action a resource type. - IamRestRoutes now matches every route of a model: literal segments, a label taking one segment, a greedy label the rest of the path, and the query a route names, which must be on the request. Of the routes a request matches, the most specific wins, segment by segment from the left a literal, then a segment mixing a literal and a label, then a label, then a greedy label; then the route naming more of the query. The path is the one the rules match, still percent-encoded and without a trailing slash, and a segment may still end in a matrix parameter, which the router ignores. - The rules come first, so nothing they map changes. S3 and API Gateway are listed as handRouted, with their reasons, and routed by their rules alone: S3 tells apart the operations of one route by their query and headers, and API Gateway is checked by HTTP method. The route generator fails when one route names two operations of any other scope. - OpenSearch Service's models, both API versions, are read under `es`: 59 of their 147 operations are checked by their routes (29 of the `es` model's 51, 30 of the `opensearch` model's 96), 53 of which ran unchecked, ListDomainNames and ListVersions among them. The other six are the VPC endpoint operations #7351 mapped by hand: their rules are removed, as their routes give the same actions. - Access Analyzer's 9 operations of no resource type are checked by their routes, ListAnalyzers among those Floci serves, where ValidatePolicy alone was; its analyzer operations are not. Lambda's, EKS's, Scheduler's, Pipes' and DSQL's resources are built by hand and their routes all mapped by their rules, so none is checked differently. IamRestRouteCoverageTest checks every route of a scope not hand-routed: by the vendored routes alone it is its own operation, and through the registry it is its action when its resources are built by hand or read, or its action has no resource type, and unmapped otherwise. iam.md and access-analyzer.md say which routes are checked. |
||
|
|
a90b812cc6 |
fix(iam): name a map entry's field under .member, as AWS does (#7457)
A violation inside a map entry's structure named the entry and then the field, replacementValues.Department.values. An AWS-validated recording of the same protocol writes a segment between the two: SNS answers a missing DataType inside its MessageAttributes map as 1 validation error detected: Value null at 'messageAttributes.attr1.member.dataType' failed to satisfy constraint: Member must not be null and, inside a list's member, publishBatchRequestEntries.1.member.messageAttributes.attr1.member.dataType. So a map of structures is named the way a list of structures already is here, the entry's key standing where a list's index stands, and the walk now writes replacementValues.Department.member.values. AcquireRole is the one operation that reaches it, its ReplacementValues being the only structure-valued map these two services vendor. What stays is the scalar-valued map. Nothing recorded covers one on this protocol, and the only recording anywhere, Lambda's routingConfig.additionalVersionWeights on REST-JSON, answers the map rather than the entry with "Map value must satisfy constraint: [...]". A different protocol and a different service is not evidence against the answer this service already gave, so properties.Team/Owner stays as it is, with what would move it written down beside it. The core walk had no test for a structure under a map's key at all, every case in that file holding a scalar, so one is added there rather than left to the two IAM wire tests that quote the path. docs/services/iam.md carries both halves, the recorded one and the open one. The message's other half, the word null in the value slot, is IAM's own and does not move: that service leaves it out and this is only the path. |
||
|
|
5c303afac6 |
fix(iam): check four more services on the resources their requests name (#7365)
Under IAM enforcement, DataSync, EMR, Rekognition and IAM Identity
Center requests were checked on `*`, so a grant scoped to a DataSync
agent, an EMR cluster, an Identity Center permission set or a
Rekognition custom model was refused, and a deny scoped to one never
applied.
The generated table of the resources requests name now reads them, 276
operations, from AWS's Service Reference and botocore as it reads the
earlier batches: their namespaces move from the generator's
NOT_COVERED to NAMESPACES and the table is regenerated, nothing in it
edited by hand; 1385 operations over 33 namespaces. Each resource
type Floci serves has the ARN format it mints: DataSync's
`agent/agent-<id>`, `location/loc-<id>` and `task/task-<id>`, EMR's
`cluster/<id>`, and IAM Identity Center's instances and permission
sets, with no Region or account. Of Rekognition, Floci serves the image
analyses alone, which act on no resource but a custom model.
Corrections, each with its reason:
- EMR requests naming a cluster by its job flow id, JobFlowId or
JobFlowIds (AddInstanceGroups, AddJobFlowSteps, DescribeJobFlows,
TerminateJobFlows and the four Set operations), are checked on that
cluster: a job flow's id is the cluster's.
- EMR's AddTags and RemoveTags are checked on the cluster their
ResourceId names, the one Floci tags, not on the one their ClusterId
gives, which only scopes a session-scoped resource's tags. Read as
generated, a ClusterId the grant covers would have let a request tag
another cluster.
- EMR's ModifyInstanceGroups may leave out its ClusterId ("Required:
No") and name each instance group by its id alone, which EMR then
finds the cluster of. Such a request is checked on the cluster each
group is in, where it was checked on `*`; a null ClusterId is read as
none, as the handler reads it. An InstanceGroups that is not a list
names no group to the check, and the handler now refuses it as naming
none, where it modified the groups an object's values named.
- Rekognition's stream processor operations are checked on
`streamprocessor/<Name>`: the Developer Guide's example gives a
processor named streamProcessorForCam the ARN
`...:streamprocessor/streamProcessorForCam`.
- IAM Identity Center's CreateAccountAssignment,
DeleteAccountAssignment and ProvisionPermissionSet are also checked on
the account their TargetId names, `account/<id>`, which the action
acts on beside the instance and the permission set. A
ProvisionPermissionSet for ALL_PROVISIONED_ACCOUNTS names no TargetId
and provisions the permission set to every account it is provisioned
to (the User Guide: up to 3,500 accounts that way, one with
AWS_ACCOUNT), so it is checked on each of them, where a grant on the
instance and the permission set alone let it through. Its TargetId
names the account only for AWS_ACCOUNT, so a null one with
ALL_PROVISIONED_ACCOUNTS names none.
The two lookups are the existing `through` entries, which named the
cluster or workgroup a Redshift Data session runs on: one may now read
each value of a list's field, and apply only `when` the request names
its resource no other way. StoredResourceArns.through gives a list of
ARNs, which EmrService and SsoAdminService now answer from what they
store, EmrService under the lock its handlers change clusters under.
Fixes the new formats needed:
- DataSync's ARN formats, and IAM Identity Center's applications' and
trusted token issuers', name their account `${AccountId}` where every
other format has `${Account}`. The generator now reads that slot as
`${Account}`, so the caller's account fills it; a new Identity Center
application was otherwise checked on `arn:aws:sso::*:application/*/*`,
which no account-scoped grant matches.
- Identity Center's application providers are AWS's own,
`arn:aws:sso::aws:applicationProvider/<id>`. An ARN of a type whose
format fixes the account as `aws` is now checked in that account
alone, not also as the caller's own copy, which does not exist and
which a grant on the provider did not cover. An ARN of any other type
giving the account `aws` is still checked as the caller's too.
- A permission set, an application or a trusted token issuer an
Identity Center create makes is in the instance its InstanceArn
names, whose id its ARN carries, `permissionSet/<instance id>/<id>`.
It was checked with both ids open, which no grant scoped to an
instance's permission sets matched. The generator now fills a variable
no member fills from the ARN of another type the action acts on whose
format is that variable alone, given by the ARN member named after it.
Left as generated, on `*`: Rekognition's CreateStreamProcessor and
StartMediaAnalysisJob, which name their collection or model two
structures deep, where the table reads none, and which Floci does not
serve.
Elastic Beanstalk and Redshift Serverless, which have as few resource
types, stay unread, each with its reason: an environment's ARN carries
an application name its requests do not give, and Redshift Serverless'
ARNs end in ids its requests name by name, so both need the stored
ARNs found first.
iam.md lists the four services, and AWS Payment Cryptography, which
the table already read, and gives the corrections, the rule for an
AWS-owned resource's ARN, and the cluster, accounts and instance the
lookups and the creates are checked on.
|
||
|
|
96fafbd4dc |
fix(iam): answer three refusals with their captured codes (#7364)
Captures from a real account on issue 6042 answer three refusals this emulator had written for itself, each wrong in its code or its status rather than only in its wording. ChangePassword answered InvalidParameterValue 400 naming the user for a wrong old password. AWS answers AccessDenied 403 and "Either the new password does not conform to the account password policy or the old password was incorrect.", which is now what it sends, as captured. The sentence names both of the operation's causes without saying which one refused the call, so a caller who cannot prove the current password learns nothing about the policy either. That it names the policy half does not settle the policy half. The capture covers a wrong old password with a conforming new one, nothing records AWS answering it for a password the policy refuses, and the model declares PasswordPolicyViolation on this operation for exactly that case, so a new password the account policy refuses keeps that error and the rule it names, as it does on CreateLoginProfile and UpdateLoginProfile. The old password is still read first, so a request with both halves wrong answers the capture. PolicySourceArn on SimulatePrincipalPolicy and GetContextKeysForPrincipalPolicy resolved an entity out of whatever followed the last slash, so arn:aws:iam:user/bob simulated as the user bob. It is now held to AwsArnUtils.isArn before either simulator resolves it, answering InvalidInput "Invalid ARN provided in the request: <value>". A valid ARN that names neither a user nor a role still answers the entity-type refusal it answered before. GetAccessKeyInfo answered InvalidParameterValue quoting an id the account never issued. AWS answers ValidationError "Access key ID is not valid.", for an AKIA and an ASIA id alike, which also settles that it refuses such an id rather than decoding the account out of it. The wire and unit tests pin the two halves of the password refusal answering differently and the order they are read in, both simulators against three unparseable values and a well-formed one, and the key refusal over both id formats. One enforcement test had pinned the unparseable ARN resolving, which the capture overturns. docs/services/iam.md and docs/services/sts.md carry the three answers, what each capture covers, and what it leaves open. Three comments that described these answers before the captures are corrected with them: handleGetAccessKeyInfo's Javadoc, which still called its old refusal a documented deviation, StsAccessKeyInfoIntegrationTest's class comment, which said the same, and validatedPolicySourceArn's, which said a value clearing 20 characters and parsing as no ARN is left alone and that what AWS answers for one is not recorded. |
||
|
|
0e9f3402f2 |
docs(iam): name the one omitted member the capture covers (#7331)
docs/services/iam.md and IamValidationErrors read as if the capture that moved IAM's required-member message settled it for every member. It settled one: an omitted Status, answered from a real account on 2026-10-31 as "Value at 'status' failed to satisfy constraint: Member must not be null" against the shape the four credential operations share. Every other omitted member this service answers, the sites checked by hand and each required member the model walk reads, carries that form on this service's reading rather than on a recording: the word null was never a value AWS sent, an absent member having none to carry. The doc separates the two and keeps that reasoning, IamValidationErrors says the capture covers Status alone where the form is decided, and the account-properties test, which quoted the Status capture beside an assertion on an omitted properties map, says the reading is what carries over there. Prose and comments only, no behavior change. Follow-up to #7265. |
||
|
|
e1392c8ce9 |
docs(redshift-data): say a session statement's IAM target is inferred (#7330)
Follow-up to #7300. redshift-data.md and iam.md said a Redshift Data ExecuteStatement or BatchExecuteStatement naming its SessionId is checked on the cluster or workgroup the caller's session runs on, as if AWS stated it. No AWS page says which resource such a request is authorized on, so both now say the session's target is Floci's inference: a session runs on the cluster or workgroup named by the statement that opened it. |
||
|
|
fccc81b61d |
fix(s3): place the encryption condition keys on a put, and on a part from its upload (#7050)
* fix(s3): place the encryption condition keys on a put, and on a part from its upload A policy on s3:x-amz-server-side-encryption or s3:x-amz-server-side-encryption-aws-kms-key-id read neither key, so a Deny under a negated operator refused every put, encrypted or not. A PutObject, CopyObject or CreateMultipartUpload now carries both from its headers, each value as sent, in the enforcement filter and in S3's own bucket policy check. A part or a completion sends neither header and carries what its upload recorded when it was created. A part naming an upload not held answers NoSuchUpload, as S3 does under such a policy. * fix(s3): check as an object write a PUT or POST naming an upload but not routed as a part The enforcement filter let through a request naming an upload not held, and judged one naming a held upload by that upload's encryption, on uploadId alone. A PUT with no partNumber, or a POST asking for a new upload, creates an object or an upload whatever that parameter says, so it skipped IAM or read the wrong encryption. Both now match the routes S3Controller takes as a part or a completion. A part copy naming an upload not held stays checked, since it names a source. * test(s3): put the multipart encryption cases beside kmsOnlyBucket The multipart cases copied S3BucketPolicyEnforcementIntegrationTest's two-statement KMS-only policy and BUCKET_KEY. They now sit beside kmsOnlyBucket and reuse it, with the policy written once (putKmsOnlyPolicy). The two cases whose upload is opened before the policy stands use a bucket with no default encryption, as before: S3 records the bucket's default on an upload that asks for none, where Floci records only what the request asks for. |
||
|
|
c84e9249c9 |
fix(iam): check a Redshift Data statement in a session on the target the session runs on (#7300)
Under IAM enforcement, an ExecuteStatement or BatchExecuteStatement
naming only its SessionId was checked on `*`. A policy allowing one
cluster's or workgroup's ARN let a statement open a session there and
refused the next statement in it, and a deny on that ARN under an
allow on `*` let every statement after the first through.
A session runs on the cluster or serverless workgroup it was opened
on: ListSessions filters sessions "by session status, compute target
(cluster or serverless workgroup), or database", and the SessionId
"can then be used in subsequent ExecuteStatement and
BatchExecuteStatement operations". The Service Reference gives a
session no resource type, so the generator's new THROUGH names the
members a request names a resource through, with the types that
resource may be of: redshift-data:SessionId, on a cluster or a
workgroup. Each operation whose request has the member, and whose
action acts on one of those types, gets a generated
`{"types": [...], "through": "SessionId"}` entry, so there are no hand
corrections. The generator's validation and the Java loader reject a
`through` that is not one top-level member, or that sits beside any
other reading key.
For such an entry the reader asks the namespace's StoredResourceArns
through(member, value, region) for the ARN of the caller's resource
at the other end, and keeps it when it matches one of the types. When
there is none, as for a session that is closed, expired or another
caller's, it names nothing and the request stays on `*`; the Data API
then refuses it. RedshiftDataService now implements StoredResourceArns
for redshift-data, since it owns the sessions and builds their owner
scope: through gives the target ARN of the caller's open session,
through RedshiftDataSessions.targetArn, which find now shares; find
still gives the workgroup a name or an ARN finds, through the
resolver.
ExecuteStatement and BatchExecuteStatement gain the entry (1095
operations over 27 namespaces, unchanged). ListSessions takes a
SessionId too, but the Service Reference gives it no resource type,
so it stays on `*`. iam.md's sentence on EventBridge V2, which said
Floci does not serve it, now says how its requests are read.
|
||
|
|
b4c539d009 |
fix(iam): read a status and a service principal from the model (#7265)
Two members were held back from the vendored shapes because this service was read as answering them in a wording of its own. Captures from a real account, posted on issue #6042, answer both, and neither reading holds. `statusType` is shared by `UpdateAccessKey`, `UpdateSigningCertificate`, `UpdateSSHPublicKey` and `UpdateServiceSpecificCredential`. One hand-written check answered all four, naming neither the offending value nor the permitted set, which is what a 2025 recording of one of them carries. AWS names the set, `Member must satisfy enum value set: [Expired, Active, Inactive]`, and answers an omitted status as the required member it is rather than as a value outside the set, which one check reading a null as a bad value could not tell apart. Both are the model's own wording, so all four read it through the Query front door and the check comes out. The set is listed in the order AWS lists it, which is not the order botocore declares. The values are the model's and the generator holds them to it: only their order is read from the capture. `AWSServiceName` on `CreateServiceLinkedRole` answered `InvalidInput` with a sentence about its own bounds, where AWS answers a constraint violation naming the declared pattern. A principal that satisfies the pattern and names no service AWS has is still `InvalidInput`, so the layering the capture leaves in place is the shape first and then whether the service exists. The required-member message loses the word that stood where the value would go. IAM names a member and leaves its value out everywhere, and the one message carrying `Value null at` did so for want of a capture either way; the capture answers `Value at 'status'`. The form moves in the one object that decides it, so the eight refusals this package writes by hand move with the walk, and the services that do quote their values keep the word. The message quotes the pattern AWS quotes, which is not the one the shape declares. botocore aliases that member to the shape it gives a group name, `[\w+=,.@-]+` at 1 to 128 characters, where AWS's message gives `[\w+=.@-]*`: the comma is gone and a `*` stands where the minimum is 1. Only the message is in hand rather than the shape, so the generator records AWS's text beside the model's and one object decides which text any violation quotes, the way the enum order is read from the capture while the values stay the model's. A comma is still admitted and an empty principal still refused, and an empty one now breaks the minimum and the pattern at once, as every other string member here does. The comma is what a second capture would settle, and the difference is recorded in `docs/services/iam.md`. |
||
|
|
9bd90d6580 |
fix(iam): check Redshift Data API requests on the cluster or workgroup they name (#7234)
Under IAM enforcement, Redshift Data API requests were checked on `*`,
so a grant scoped to a cluster or a serverless workgroup was refused
and a deny scoped to one never applied.
The Service Reference gives ExecuteStatement, BatchExecuteStatement,
DescribeTable, ListDatabases, ListSchemas and ListTables two resource
types: Redshift's `cluster:${ClusterName}`, which ClusterIdentifier
fills, and Redshift Serverless's `workgroup/${WorkgroupId}`. A
workgroup's ARN ends in the id Redshift Serverless gives it (its
workgroupId, "The unique identifier of the workgroup"; botocore's
WorkgroupNameString takes an ARN ending in workgroup/<uuid>), while a
request names it by WorkgroupName, "The serverless workgroup name or
Amazon Resource Name (ARN)". So the workgroup is a FOUND_BY type,
found by WorkgroupName.
FOUND_BY named a type by its members only where the rule had derived
a fill for the type to replace, as ResourceId fills a scalable target's
${ResourceId}. No member fills ${WorkgroupId}, so FOUND_BY now names
every FOUND_BY type the action acts on whose members the request has,
as its docstring already said. The Application Auto Scaling entries
are unchanged.
RedshiftDataResourceResolver, which resolves the target a request
runs on, now implements StoredResourceArns for redshift-data: it
gives the ARN of the workgroup a name or an ARN finds, through
RedshiftServerlessService.findWorkgroupByNameOrArn, which the
service's own name-or-ARN lookup now uses as well.
Redshift Data joins the table (12 operations, 1048 over 26
namespaces). The six operations above are checked on the cluster's
ARN or on the stored workgroup's, and on `workgroup/*` for a workgroup
there is none of; their SecretArn names neither. A request naming only
its SessionId stays on `*`, and so do CancelStatement,
DescribeStatement, GetStatementResult, GetStatementResultV2,
ListSessions and ListStatements, which the Service Reference gives no
resource type.
|
||
|
|
1cbf58a8ae |
fix(iam): match service-linked role name validation (#7235)
* fix(iam): match service-linked role name validation Match the recorded AWS ValidationError for malformed AWSServiceName while preserving the documented length and character constraints. Refs #6042 (item 1) * fix(iam): align service-linked role validation |
||
|
|
beef71e8eb |
fix(iam): check Application Auto Scaling requests on the scalable target they name (#7193)
Under IAM enforcement, Application Auto Scaling requests were checked on
`*`, so a grant scoped to a scalable target was refused and a deny
scoped to one never applied.
A scalable target's ARN ends in a unique id the service assigns,
`scalable-target/<id>` ("The unique ID ... is a value assigned by
Application Auto Scaling to the scalable target"), which the Service
Reference names ${ResourceId}, while requests name the target by
ServiceNamespace, ResourceId and ScalableDimension. Read as the table
reads other services, ResourceId (`service/<cluster>/<service>`) would
have filled that id, so the namespace was left out until the table could
look the ARN up.
The generator's new FOUND_BY gives a type whose ARN is all an id its
service mints, with the members a request names it by. An operation
whose request has them all names the type by them (`find`), generated
rather than corrected, and the reader asks the service for the ARN they
find through StoredResourceArns, the lookup EventBridge's connections
already use, or else checks the ARN with its id open, as for a create.
StoredResourceArns.find now takes the values a request names the
resource by, in the table's order: one name for EventBridge, the three
members for Application Auto Scaling, whose service now implements it
from the store its handlers read. A member left out or given a JSON
null names none, as the handler reads it.
Application Auto Scaling joins the table (14 operations, 1036 over 25
namespaces): RegisterScalableTarget, DeregisterScalableTarget,
PutScalingPolicy, DeleteScalingPolicy, PutScheduledAction and
DeleteScheduledAction are checked on the target's stored ARN, and a
RegisterScalableTarget registering a new one, its tags included, on
`scalable-target/*`; TagResource, UntagResource and
ListTagsForResource on the ARN their ResourceARN gives; the Describe
operations and GetPredictiveScalingForecast on `*`, as AWS checks them.
|
||
|
|
a54ca5e0c9 | fix(iam): match status validation errors for credential updates (#7174) |