mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 08:09:43 -05:00
985a2ea949700bb08267cd8d7b45cdccf6567bae
125
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
68e7b313a8 |
fix(iam): validate the values each ReplacementValues entry carries (#6478)
ReplacementValueEntry declares Values required and replacementValueListType bounds it at 1 to 20 values, which the API Reference spells out as "Array Members: Minimum number of 1 item. Maximum number of 20 items" with "Required: Yes", and AcquireRole read only the map's own 30-entry cap. An entry carrying no values and an entry carrying 21 of them both reached the template lookup and answered NoSuchEntity, where the validation ahead of the operation answers ValidationError. A Query list of no members is how an absent member arrives, so the lower bound of 1 is never reached on its own: an entry carrying nothing is the required member reading as null. The values are counted by the member being present rather than by what it holds, the list's members publishing no constraint of their own, so a value sent empty is a value; they are read through the helper the other Query services read a list with. The violation names the entry by its key, the way the account properties map names one, rather than by the index the request numbered it with, and an entry is read back under the index the request spelled rather than under the number that index reads as, the parameters that carry it being named after the spelling. The map's own length is now reported beside its entries rather than ahead of them, the shape being walked from the outside in, so a request broken in several places is told all of it at once. No recorded AWS violation on a map member is on hand to confirm that path spelling against the nested "Map value must satisfy constraint" form, so the role template docs say it is Floci's reading and what would change it. Five tests: an entry with no values at all, a 21st value in one entry with 20 of them carried through to the 404, an entry whose only value is empty, an entry numbered 01 read under that spelling, and 31 entries with two of them left empty answered in one message. The role template docs say what is read before the lookup, so they name the entries too. |
||
|
|
cd2dac708d | feat(lambdaweb): check the code bucket versioning and policy as AWS does (#6479) | ||
|
|
64f4f9e489 |
fix(iam): check a create's tags on its own and its tagging action (#6452)
Under IAM enforcement a request that tags the resource it creates was checked only for the operation's own action. AWS also checks the service's tagging action, as the SNS API reference says: "To be able to tag a topic on creation, you must have the sns:CreateTopic and sns:TagResource permissions." A caller allowed to create but not to tag could set at creation the tags that a tag-based policy trusts. The operation's own action did not see the tags either: aws:RequestTag and aws:TagKeys were set only for Logs, S3 and EC2 RunInstances, so a policy allowing sqs:CreateQueue only with aws:RequestTag/team never matched, and one denying it when aws:RequestTag/team is null refused a tagged create. AWS's Service Reference lists the tagging action among each operation's authorized actions and marks the actions that only tag, but does not say which request member carries the tags; botocore's models do. A new generator, tools/aws/regen_iam_tag_on_create.py, joins the two into src/main/resources/aws/iam-tag-on-create.json: 581 operations over 69 namespaces, those Floci authorizes by operation. An operation is in it when the reference lists, beside its own, an action that only tags and adds tags; its tags are read from a top-level member named Tags, TagList, TagSpecifications or the like that holds a tag list or map. 569 are read from the table (579 members), CloudWatch Logs CreateLogGroup is checked by hand as before, and 11 carry no tags this file can read, each with its reason. A correction gives SQS's Query name, Tag.N, and one drops an EC2 IPAM pool's allocation rule, which tags nothing. When a request carries tags, IamEnforcementFilter checks the tagging action for each resource's tags apart, with them as aws:RequestTag/<key> and aws:TagKeys, and, where the action takes it, the operation as its namespace's CreateAction key (ec2:CreateAction is RunInstances for an instance launched with tags). A tag specification's tags are checked on the resource of the type it names, from the ARN the reference gives the type with its name left open (arn:aws:ec2:<Region>:<account>:instance/*), which the table carries for EC2 and RDS; other tags on the resources the operation is checked on. Lambda's CreateFunction is now checked on the function its body names, which the reference gives it, rather than on *, so a grant scoped to the function covers both its action and its tags. The operation's own action is checked with the same two keys, once for each resource's tags, where the reference lists them for it or for a resource it acts on (542 of the 569), keeping any a service's own condition keys set. The table is keyed by operation, so the filter now carries the operation it resolved beside the action, which differs for an operation AWS authorizes under another name (Budgets' CreateBudget is budgets:ModifyBudget). The tags are read as the Floci handler that applies them reads them, so the check sees the tags the resource gets. A form's are read under the SDK's spelling, from 1 to the first number with no key, and under the further spellings the RDS, DocumentDB, Neptune, ElastiCache and Redshift handlers read, numbered as each numbers them; EC2's from every tag specification under either TagSpecification spelling, to the first naming no resource type. A body's member is read under its own name, and CloudWatch's PutMetricAlarm and PutCompositeAlarm also under tags, and a CodeDeploy tag as Key and Value or key and value, each as text whatever it holds, as its handler reads. The tagging action is also checked for tags under any other spelling a handler might read (a name, key or value in any case, any list spelling and number, an object's structures), so none a handler applies goes unchecked. The operation's own action is checked with every reading, its handler's, any other spelling's, and none where its handler reads none, and refused if any is denied, so a deny on a tag holds and a required tag counts only where the handler applies it. make iam-tag-on-create-check, part of aws-data-check, re-derives every member from the pinned botocore; make iam-tag-on-create-verify, part of iam-data-verify, checks every operation against AWS, and the IAM data drift workflow also runs on a change to the table or its generator. Not checked: sts:TagSession in a role's trust policy, service-specific request tag keys such as rds:req-tag, EC2 RequestSpotFleet's nested tags, and the REST services whose routes no rule maps yet. |
||
|
|
32663a24ad |
feat(iam): dispatch GetMFADevice, AcquireRole and GetRoleTemplateVersion (#6453)
The last three operations the IAM model publishes and Floci did not dispatch. All three can only ever answer NoSuchEntity here, and that is the argument for dispatching them rather than against it: a 404 both their API pages model beats the UnsupportedOperation 400 an undispatched action answers, which no SDK maps to anything for these operations. GetMFADevice reads a FIDO security key. The reference says of its serial number that "For this API, we only accept FIDO security key ARNs", and nothing in the IAM API creates such a device: CreateVirtualMFADevice is the only operation that mints one here and it mints an mfa/ device, so there is never a FIDO key to find. A virtual device's serial is refused the same way, deliberately, since answering with it would hand back a device AWS would not return for the same request. The page models NoSuchEntity and ServiceFailure and nothing else, so there is no validation answer to prefer over the 404. Role templates are AWS's own. The user guide has role manager using "AWS-managed role templates" and a role created from one with iam:AcquireRole and the template's ARN, and the model agrees from the other side: GetRoleTemplateVersion is the only operation that names a template and there is no create, list, update or delete, so nothing a client can call puts a template into an account. Both operations answer NoSuchEntity naming the ARN they were handed. RoleTemplateDisabled is the other refusal AcquireRole models and it is not this one: it reads "the specified role template is disabled", which is a statement about a template that exists. That this is a reading, and what would change it, is written into docs/services/iam.md rather than left in a commit message. The guide publishes the template ARNs but not their bodies, so a published body would turn those ARNs into answers and leave the 404 for every other, and RoleManager/Enabled, role manager's own switch, is a separate question this does not read. The declared constraints are read before the lookup, as #6402 put them elsewhere in this package: SerialNumber to serialNumberType's 9 to 256 and its pattern, UserName to userNameType whenever the request carries the member, a blank one included, the member being present whatever it holds, TemplateArn to arnType's 20 to 2048, the two minor versions to being integers, answering InvalidInput for a value that is not a number, and ReplacementValues to the 30 entries it declares. The ARN check is #6402's, read through one helper now rather than copied, and the member path validation messages spell is a helper too. role-template leaves ResourceArnBuilder.UNRESOLVED_TYPES, which is empty now. GetRoleTemplateVersion carries the template's ARN, so the type resolves like any other the request names, in the aws account rather than the caller's. AcquireRole stays on *, AWS's service reference publishing no action for it. Eleven tests. Five on GetMFADevice: the FIDO serial reported missing rather than unsupported, a virtual device refused and still listed afterwards, the serial's length and pattern as counted violations, a user the account does not hold reported instead of the device, and a blank UserName read as a value rather than as absent, which breaks both of userNameType's constraints when it is empty and its pattern when it is whitespace. Six on the templates: both operations' 404s, TemplateArn under its length and absent on each, a minor version that is not a number on each, and 31 replacement values refused where 30 reach the 404. The unresolved-types test lost a guard an empty map would fail and gained the claim that emptied it. |
||
|
|
b36fd2f0be |
fix(iam): authorize Budgets operations as ModifyBudget and ViewBudget (#6436)
Under IAM enforcement a Budgets operation other than a budget action was authorized as its own name, budgets:CreateBudget and the like, which is no IAM action. A policy granting budgets:ModifyBudget was denied CreateBudget, and one granting budgets:ViewBudget was denied DescribeBudgets, while a policy naming the operation, which grants nothing on AWS, let it through. AWS's Service Reference authorizes these operations as budgets:ModifyBudget or budgets:ViewBudget. Beside that action it lists the aws-portal Billing console permissions and, for CreateBudget, the tag-on-create budgets:TagResource, so the authorized-action generator counted two or three actions and left them out. It now counts neither: the aws-portal actions gate the Billing console, and the Billing and Cost Management user guide says programmatic requests to AWS Budgets are not affected by them; a namespace's tagging action beside exactly one other is the tag-on-create permission. That adds the 15 Budgets operations and IoT FleetWise BatchCreateVehicle, which Floci does not serve, to the vendored map. Not checked: budgets:TagResource when CreateBudget or CreateBudgetAction carries tags. |
||
|
|
62c202f073 |
fix(iam): read declared constraints before the lookup they precede (#6402)
The validation AWS runs ahead of an operation never reaches its store, so a request that breaks a declared constraint is refused whether or not the thing it names exists. Four places here had the order the other way round, and each one answered a 404 for a request AWS answers with a 400. The three Access Advisor and Organizations report readers looked the job up before reading JobId, MaxItems and Marker, so an unknown job carrying a MaxItems of 0 answered NoSuchEntity, and a JobId of the wrong length was never held to its shape at all. jobIDType is min 36 and max 36, and the fixed length reports as one constraint, "Member must have length equal to 36", which is the form lifecycleActionToken already uses for the same shape in Auto Scaling. The MaxItems check moves out of paginate so a reader can run it early, and paginate still runs it, being reached from readers that look nothing up. GenerateServiceLastAccessedDetails had the same order on its Granularity enum, reading it inside the generate that sits behind the ARN resolution, so a granularity AWS refuses answered NoSuchEntity for an ARN that named nothing. The check is its own method now and the handler runs it first. PolicySourceArn is arnType, min 20, and the simulators resolved the entity out of whatever followed the last slash, so ":user/bob" simulated against a user named bob. A value too short to be any ARN is now the length ValidationError IAM answers for a short ARN member. A value that clears 20 characters and still parses as no ARN is left alone: the member publishes no pattern, and no source records what AWS answers for one. The service-specific credential id reported both of its length bounds in one violation, so a short id was told about a 128-character ceiling it was nowhere near. Each message names the one bound the value broke, which is how every recorded IAM length violation reads: "Member must have length less than or equal to 64" for a user name over 64, and "Member must have length greater than or equal to 20" for an ARN under 20. Seven tests. Four over the wire on the readers: a JobId of the wrong length refused before any lookup on both the last-accessed reader and the entities reader, the same on the Organizations reader with no organization built at all, and an unknown job carrying a bad MaxItems, a bad Marker and then nothing wrong, which pins the 400s and the surviving 404. One on the generator, where the granularity is refused for an ARN that names nothing. One on both simulators for a PolicySourceArn under 20. And the credential id's two bounds, each asserting the other bound is absent from the message, with the credential itself still listed once the refusals are done: a validation error that deleted something on its way out would read the same from the response alone. |
||
|
|
1276a8857f |
fix(iam): check iam:PassRole from a table generated from the Service Reference (#6422)
Under IAM enforcement a request that names a role is checked for iam:PassRole only where PassedRoles has a case for its operation, so most of the operations AWS's Service Reference lists with iam:PassRole went through without it: a caller allowed to create a CodeBuild project, a Firehose stream, a Glue job or an SSM association could hand it any role in the account. Adding a case per operation took one pull request per few services. The Service Reference names, for each operation, the services its role goes to, but not the request member that names it; botocore's models give the members. tools/aws/regen_iam_passed_roles.py joins the two into src/main/resources/aws/iam-passed-roles.json: every operation listing iam:PassRole in the namespaces Floci serves over JSON, Query and Smithy RPC v2 CBOR, and in the REST services whose routes are authorized as operations, each either read from the table, read by hand in PassedRoles, or not read with a reason. Generation fails on an operation in none of the three. A member names a role when its name ends in Role, RoleArn or RoleName (a plural, or one followed by Update or Override) and it holds a string or a list or map of them, not an enum. A member whose documentation says it takes a role by name is checked on the ARN IAM holds the role under. A role the Service Reference passes to no named service, as it does Cognito's, is checked with no iam:PassedToService. The generator records its corrections with their reasons: members that pass no role (the roles a Budgets action attaches a policy to, a CodePipeline action's role, which the pipeline's role assumes, SSM target accounts' execution roles, the roles a Glue job's generated nodes assume with STS, Firehose's Snowflake role), members the rule does not see (a Cognito user pool's SMS caller roles, a Glue connection's ROLE_ARN property and a view's definer, Service Catalog's AssumeRole and LAUNCH_ROLE keys), and which service a member's role goes to where the reference names several. PassedRoles reads a table member from a JSON or CBOR body, or from Query form parameters in either list form. Its own cases now return null for an operation they do not read, and the table covers the rest. New cases read SNS's role attributes (a topic's delivery status roles, a platform application's, a Firehose subscription's and the SMS one, as the SNS handlers read the map; an attribute with no value names none), a CloudWatch Logs subscription filter policy's RoleArn, a Service Catalog launch constraint's role, by the type Service Catalog holds for the constraint on an update and in any case, since Floci keeps the type as given, and an SWF decision's Lambda role from the attributes its type names. Not read: requests that name no role, roles that are a runbook's parameter, operations whose roles go to several services without the reference saying which member goes where (EMR RunJobFlow, EKS UpdateClusterConfig, CloudWatch Logs CreateImportTask, SageMaker CreateTrainingSession), XML bodies (S3 PutBucketReplication), EC2's RequestSpotFleet, and REST services whose routes no rule maps yet. make iam-passed-roles-check, part of aws-data-check, re-derives every member from the pinned botocore; make iam-passed-roles-verify, part of iam-data-verify, checks every operation against AWS; the IAM data drift workflow now also runs on a change to the table or its generator. PassedRoleNamespacesIntegrationTest fails for a namespace Floci serves that the table neither reads nor names as not read yet. |
||
|
|
6215b6fd38 |
fix(iam): check iam:PassRole for RDS and DMS (#6389)
Under IAM enforcement an RDS or DMS request that names a role went through without iam:PassRole on
it. AWS's Service Reference lists iam:PassRole, passed to rds.amazonaws.com or dms.amazonaws.com,
for each of these operations, so a caller allowed to change a database could attach any role in
the account to it.
RDS, to rds.amazonaws.com:
- AddRoleToDBCluster, AddRoleToDBInstance, RemoveRoleFromDBCluster, RemoveRoleFromDBInstance,
CreateDBProxy and ModifyDBProxy pass RoleArn, and StartExportTask passes IamRoleArn;
- CreateDBInstance, CreateDBInstanceReadReplica, ModifyDBInstance, CreateDBCluster,
ModifyDBCluster, RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime pass the
Enhanced Monitoring role, MonitoringRoleArn ("The user that enables Enhanced Monitoring must be
granted the PassRole permission.");
- they, RestoreDBInstanceFromDBSnapshot and RestoreDBInstanceToPointInTime pass the directory role
DomainIAMRoleName names, checked on the ARN IAM holds it under, since the name carries no path;
- CreateDBCluster and the two cluster restores pass each role in AssociatedRoles, at any index and
in either list form, as the RDS handler reads them;
- ModifyOptionGroup passes the role each option it includes takes in its IAM_ROLE_ARN setting, as
SQL Server's native backup and audit options do, read as the handler reads OptionsToInclude.
DMS, to dms.amazonaws.com: CreateEndpoint and ModifyEndpoint pass ServiceAccessRoleArn and the
role members the DMS model gives each engine's settings structure (ServiceAccessRoleArn,
SecretsManagerAccessRoleArn, SecretsManagerOracleAsmAccessRoleArn), and CreateReplicationInstance
and ModifyReplicationInstance pass KerberosAuthenticationSettings.KeyCacheSecretIamArn.
docs/services/iam.md lists the operations and the roles they pass.
|
||
|
|
ec5597eb5c |
fix(iam): check EKS's REST routes and roles, and routes with a trailing slash (#6323)
Under IAM enforcement a REST request whose route no rule maps is let through unchecked. No EKS
route had a rule, so any signed caller could create, read, change or delete clusters, node groups,
Fargate profiles, add-ons, access entries and Pod Identity associations with no EKS permission, and
without iam:PassRole on the roles they named. A Pod Identity association hands its service
account's pods the credentials of its role, so a caller could have pods run as any role in the
account.
Every operation of the eks model now has a rule and is checked as the action of its own name, as
the Service Authorization Reference gives it, including the routes Floci does not serve yet, and
IamRestRouteCoverageTest checks the whole model. Floci takes an access entry's principal as the
rest of the path, so a GET or DELETE under an entry reads or deletes an entry: the entry's access
policy routes, which Floci does not serve, run as DescribeAccessEntry and DeleteAccessEntry and are
checked as those.
Each is checked against the resource the reference gives it, in the caller's account, where EKS
looks everything up:
- a cluster against the ARN EKS holds it under, or cluster/<name> in the request's Region for one
it holds none of, and CreateCluster against the cluster its body names, as the EKS user guide's
example policy for creating a cluster grants it;
- a node group, Fargate profile, add-on, access entry or Pod Identity association against the ARN
EKS holds it under, which ends in an id the request does not carry, read through
EksService.findResourceArn with the lookups its handlers make; listing and creating them, and the
other routes under a cluster, against the cluster;
- DescribeUpdate against the add-on the update was made to, since the updates Floci keeps are its
add-ons' and EKS returns one whether or not the request names its add-on, and otherwise the
cluster;
- a tagging request against the caller's cluster named after the ARN's last /, as EKS tags it.
The roles each operation passes need iam:PassRole, with iam:PassedToService the value the Service
Reference gives: the cluster role, node role, Fargate pod execution role and an add-on's service
account and Pod Identity roles go to eks.amazonaws.com, a Pod Identity association's roleArn to
pods.eks.amazonaws.com ("The IAM principal that is creating the association must have
iam:PassRole."), and an EC2_LINUX or EC2_WINDOWS access entry's principal to ec2.amazonaws.com.
The router also matches a path with a trailing slash as the path without it, while the rules
matched the slash: POST /clusters/, GET /schedules/ and GET /2015-03-31/functions/<name>/ reached
their operation unchecked. A route is now matched without its trailing slash, as the router
matches it. An S3 path is matched as sent, as before: an S3 key may end in a slash, as a folder
marker's does, and S3's rules already take a bucket's one trailing slash.
docs/services/iam.md says which EKS routes are mapped, what each is checked against and the roles
they pass.
|
||
|
|
a8b5e8b8ec |
fix(iam): hold a root approval of a delegation request to four hours (#6321)
Delegated access has two ceilings and only one of them belongs to the request. The twelve hours sessionDurationType declares are held at the filing, where SessionDuration arrives. The other is the approver's, and the user guide's own note states it: "The maximum duration for delegated access is 12 hours. However, root users can only approve delegation requests with a duration of 4 hours or less. If a request specifies more than 4 hours, you must use a non-root identity to approve the request." Nothing read it, so the account root could approve a twelve-hour delegation and the credentials it bought ran that long. It is read at the approval rather than at the filing, because that is where the approver is known: a request longer than four hours is refused for root and the same request is approvable by an IAM user or role of that account, which is the remedy the note itself names. Root is the caller whose ARN ends in :root, what this family already names an approver by, and what a key naming no IAM user resolves to, so approving a long request locally means signing as a user rather than with a bare account id. AcceptDelegationRequest models NoSuchEntity, ServiceFailure and ConcurrentModification and nothing for this, and no source gives the code AWS answers, so AccessDenied is chosen and recorded in docs/services/iam.md: the guide states the rule as which identity may approve, which is what the release's own OnlySendByOwner rule already answers that way. Five tests. Three on the service: the refusal at five hours with the privileged user then approving the same request, the cap itself approved at four hours exactly, and twelve hours approved by a user to show the cap is the approver's. Two over the wire: the same refusal where the account id is the signing key, and the release's id check answered for an id that breaks its pattern rather than one that is absent, which the absent half's test left uncovered. |
||
|
|
3944d6edc2 |
fix(dsql): enforce IAM and the cluster's policy on the control plane (#6328)
* fix(dsql): enforce IAM and the cluster's policy on the control plane
A cluster's resource-based policy governs DSQL's control plane as well as
its connections (measured, eu-west-1): a Deny of dsql:GetCluster,
UpdateCluster, TagResource or GetVpcEndpointServiceName refuses that call,
and a call it does not name still answers. With IAM enforcement on, Floci
left every DSQL control plane route unchecked: no rule in
IamActionRegistry mapped one, so the policies, identity or resource, were
never read there.
IamActionRegistry maps every operation of DSQL's model to its action, the
stream operations Floci does not serve included, and
IamRestRouteCoverageTest now checks all of them against botocore's routes,
vendored for DSQL by regen_rest_routes.py. ResourceArnBuilder names the
resource each call is checked against, as the Service Authorization
Reference gives it: the cluster, the stream, or the ARN a tagging route
names, minted in the request's partition. CreateCluster and ListClusters
are checked against cluster/*, as DSQL checks them (measured; the
reference lists ListClusters with no resource). The enforcement filter
then reads the cluster's policy through DsqlResourcePolicyProvider, as it
reads a topic's or a function's.
* fix(dsql): check tagging at /tags too, where the ARN is in the query or body
Asked in review: Floci serves DSQL's tagging at /tags as well as at
/tags/{arn}, naming the ARN in the resourceArn query parameter or body field,
and the rules matched only the path form, so a bare /tags call reached DSQL's
tag handler unchecked. The rules now match both, as Scheduler's do, and the
control plane test tags, lists and untags through each form.
|
||
|
|
27338a62b7 |
feat(iam): answer GetHumanReadableSummary for a delegation request (#6298)
The ninth and last operation of IAM temporary delegation, and the last one the model publishes that is not an M3 404: a delegation request now comes back as a Markdown summary instead of UnsupportedOperation, which takes IAM to 177 of the 180 operations botocore 1.43.113 publishes. AWS generates that text with a large language model, so this is the one piece of the family that cannot be its answer. What is sourced is the format, the reference's own example answering "Human readable summary in Markdown format", and the shape: EntityArn 20 to 2048, Locale 2 to 12, SummaryContent up to 10000 characters and the four SummaryState values. Every line is read off the record, so one request summarizes the same way twice: what is being asked for, by whom, for how long, and where it has got to. The services and actions the console credits its AI summary with are the one half missing, for the same reason nothing renders a PermissionPolicy here, that no API registers the template AWS resolves one from, so the template and its parameters are named instead. Who may read a summary is who may read the request, which the reference states outright, so the lookup is GetDelegationRequest's and so is the NoSuchEntity it answers. The request is authorized against the ARN Floci mints around the id EntityArn names, which is the one its five by-id siblings already resolve: a policy naming one request authorizes that request alone, and a deny on it holds however the caller respells the ARN. An ARN of another service names no request of IAM's to summarize. Four answers are chosen rather than read, each recorded in docs/services/iam.md: an ARN of another entity type is NOT_SUPPORTED, a locale Floci does not write is NOT_AVAILABLE with no content, a value that is no ARN at all is the modeled InvalidInput, and an id inside a well formed ARN that no id could match is NoSuchEntity rather than a constraint failure. The text is the requester's, and the summary is Markdown, so it is escaped rather than passed through: the model lets a description, a message and a parameter value carry newlines and backticks, which would otherwise forge a heading, a bullet or a code span inside a document read as Floci's own account of the request. A parameter value the record does not hold is left out, and an indexed value arriving as a key with nothing under it is no longer stored as one. |
||
|
|
c094ce3973 |
feat(sts): dispatch AssumeRoot and authorize centralized root access (#6251)
Floci dispatched the five operations that turn centralized root access on and off and nothing that uses it, so the feature was half emulated: AssumeRoot, the operation they exist for, answered UnsupportedOperation. The five took no caller check of their own either, so any account could enable or disable organization wide root features, and the record they wrote was scoped to the calling account, which left the management account's toggle invisible to a delegated administrator. All five answer for one organization now, so all five check the caller, and each refusal is a shape the reference models on them and on nothing else: no organization is OrganizationNotFound, one without All features is OrganizationNotInAllFeaturesMode, one without trusted access for IAM is ServiceAccessNotEnabled, and a caller that is neither the management account nor a delegated administrator is AccountNotManagementOrDelegatedAdministrator. The two enable operations add CallerIsNotManagementAccount, modeled on them alone, so a delegated administrator may read the features and turn them off but not on. The feature set belongs to the organization, so it is read and written in the management account's scope whoever asks, and the OrganizationId the model declares beside EnabledFeatures is answered now that the organization is known. Organizations answers all of this through a provider interface in the iam package, the way ScpProvider already does, so IAM still does not depend on it. AssumeRoot opens the session those features allow. It acts as the member account's root user, which no identity policy grants or denies, scoped by the TaskPolicyArn the request names: the five AWS managed policies the model names, under the root-task path, each denying everything it does not name, so the policy is the whole of the bound and is read beside the root's own allow-all rather than as a session policy with nothing to allow. A customer- managed policy can carry that path too and is refused, being the caller's own document rather than one of AWS's. The caller must be able to manage root access and have RootSessions enabled, the target must be a member account other than the management account, and the audit reads those policies allow name the member account's root user when they carry no UserName, which is what their own arn:aws:iam::*:root asks for. What is chosen rather than read is documented in docs/services/sts.md: the operation models only RegionDisabled and ExpiredToken, so every caller, target and feature refusal is AccessDenied 403 and a task policy outside the root-task path is a ValidationError, the shape MinimumSessionTokenSize also answers outside the 0 to 4096 the model declares for it, the size asked for being the size issued. The guide's refusal of root user credentials covers both credentials this emulator reads as the account root, one that resolves to a root ARN and the bare account-id key the enforcement filter calls floci's account-root principal, so a privileged session is opened by an IAM user or role of the management account as it is on AWS. The global endpoint is refused when the request arrives on that host, which is the only way a request says so. |
||
|
|
812c95499d |
fix(iam): check iam:PassRole for Redshift, Redshift Serverless and AddRoleToInstanceProfile (#6250)
Under IAM enforcement a request that passes a role to a service needs iam:PassRole on that role, but no Redshift or Redshift Serverless operation was checked for it. A caller allowed to create a cluster or change its roles could attach any role to it, and Floci's COPY, UNLOAD and Spectrum statements then run as that role; statements run through the Data API on a Redshift Serverless workgroup can use its namespace's roles the same way. Now checked, with iam:PassedToService as the Service Authorization Reference gives it: - Redshift CreateCluster and RestoreFromClusterSnapshot pass the roles in IamRoles, and ModifyClusterIamRoles those in AddIamRoles, to redshift.amazonaws.com. The lists are read through the Redshift handler's own member pattern, so IamRoles.IamRoleArn.N, as the SDK sends it, IamRoles.member.N and IamRoles.N all count. RestoreFromClusterSnapshot is checked although Floci's restore attaches no role yet, as AWS checks it. - Redshift Serverless CreateNamespace and UpdateNamespace pass the roles in iamRoles and the one in defaultIamRoleArn, and CreateScheduledAction and UpdateScheduledAction pass roleArn, to redshift-serverless.amazonaws.com. The Redshift management guide: "To associate an IAM role with a cluster, a user must have iam:PassRole permission for that IAM role." A role named only as a cluster's default, DefaultIamRoleArn, is not checked on its own: the default is one of the roles the cluster holds, and Floci does not act on it. A namespace's defaultIamRoleArn is checked, since Floci keeps it whether or not iamRoles holds it. COPY, UNLOAD and Spectrum now take a role only under the ARN IAM holds it under, path included, as STS AssumeRole does. They looked the role up by its name alone, so a cluster given role/sandbox/AdminRole, which a PassRole grant on role/sandbox/* allows, ran its statements as the AdminRole IAM holds under another path. IAM's AddRoleToInstanceProfile now passes the role it adds to ec2.amazonaws.com. Every instance running with the profile gets that role's credentials from the instance metadata service, so adding a role to a profile already attached to a running instance handed it any role. The IAM API reference: "The caller of this operation must be granted the PassRole permission on the IAM role by a permissions policy." RoleName names the role without its path, so the check uses the ARN IAM holds the role under, or, for a role IAM does not hold, the ARN the name gives. docs/services/iam.md lists the new operations, and docs/services/redshift.md the path rule. |
||
|
|
6763b405dd |
fix(iam): check the rest of the Lambda function API's routes (#6226)
Under IAM enforcement a REST request whose route no rule maps is let through unchecked. 51 operations of Lambda's function API had no rule, 25 of them served by Floci, so any signed caller could read a function's configuration, environment variables included, publish versions, set its concurrency and event invoke config, and create, read or delete layer versions and code signing configs, with no Lambda permission at all. ListFunctionsByCodeSigningConfig, whose route ends in /functions, was checked as lambda:ListFunctions. Every operation of the function API now has a rule and is checked as the action of its own name, as the Service Authorization Reference gives it, including the routes Floci does not serve yet: provisioned concurrency, capacity providers, layer version permissions, the recursion, scaling and runtime management configs, PutFunctionCodeSigningConfig, InvokeAsync, ListFunctionUrlConfigs and the resource policy routes. IamRestRouteCoverageTest checks every operation of the lambda model, as it does Scheduler, Pipes, MicroVMs and network connectors. Each is checked against the resource the reference gives it: - a function's settings against the function, as the other function routes are; - an event source mapping against event-source-mapping:<uuid>, which DeleteEventSourceMapping now gets too in place of *; - a code signing config against code-signing-config:<id>, the id that ends the ARN the route takes, in the request's account and Region, as Lambda looks it up; - a layer version, its policy and its permissions against layer:<name>:<version>, the name as given, even a name given as an ARN or holding an encoded /, since Lambda looks the layer up by it as it is, and the version as the number Lambda parses, so 01 is checked as 1; PublishLayerVersion against layer:<name>, and GetLayerVersionByArn against the version its Arn names, its number read the same way; - account settings, creating a config, and listing configs, layers or a layer's versions against *, as they name no resource. AWS also checks lambda:AddPermission, lambda:GetPolicy or lambda:RemovePermission for the resource policy operations, and iam:PassRole for CreateCapacityProvider. Floci serves neither, so they are checked as their own action alone. docs/services/iam.md says which Lambda routes are mapped and what each is checked against. |
||
|
|
8427c0b71d |
feat(iam): publish delegation request notifications to the partner's topic (#6199)
IAM temporary delegation had no way out. The exchange token is answered by no operation on the family, so a partner that filed a request could not obtain what it exchanges, and NotificationChannel was stored with nothing reading it. DelegationNotifier publishes the two notifications the user guide documents to the SNS topic the request names, which is the channel AWS gives this feature. Every state the guide's notification table lists notifies: ASSIGNED, PENDING_APPROVAL, ACCEPTED, FINALIZED, REJECTED and EXPIRED, leaving only the UNASSIGNED a request starts in, which the partner filed itself. FINALIZED sends two, a StateChange and the ExchangeToken notification carrying the token and an ExpiresAt of release plus SessionDuration. The payload is the guide's own field list, a JSON string in the Message of an ordinary SNS notification, with the owner account left out until the request carries one, which a request filed at a named customer does from the start. A notice is taken wherever a state is written rather than at each call site, so an expiry found on a read announces itself the way a claim does, and a call that then fails on the expired request still sends it. What notifies is a transition: a second UpdateDelegationRequest on a request already under review writes its notes and tells the partner nothing. NotificationChannel is held to more than its declared shape, which is looser than an ARN: the member's own documentation says only SNS topic ARNs are accepted, so a value naming no topic is refused on the create with InvalidInput rather than accepted into a lifecycle nobody would hear about. IAM publishes as iam.amazonaws.com through ServiceCallAuthorizer, so the topic's own policy decides and nothing the caller holds plays any part, which is the statement the guide has partners add to their topic. The request's own ARN and the account that filed it go as aws:SourceArn and aws:SourceAccount. Both the policy and the topic are read in the account the topic ARN names: the topic is the partner's and most of these transitions are the customer's calls, so account aware storage would otherwise look in the caller's account and find no topic at all. Notifications go out once the delegation lock is released, from a snapshot taken while the transition still owns the record, a stored request being a mutable instance every caller holding it shares. A delivery that fails costs the notification and not the transition behind it. |
||
|
|
2f57441b84 |
fix(core): treat a request no protocol claims as the call its route runs (#6200)
With floci.protocols.strict-claiming off, the default, a request that no wire protocol claims is logged and served by whatever route it matches. The checks after routing read the claim, so they saw a request of no protocol: - IAM enforcement served it unsigned. The MissingAuthenticationToken refusal applies only to a JSON, CBOR or Query claim. An unsigned SQS ListQueues over JSON or Query, or a Kinesis ListStreams over CBOR, was served when it carried a Smithy-Protocol header Floci does not serve that path by: an unknown value, or rpc-v2-cbor outside the rpcv2 path. An X-Amz-Target call with no Content-Type reached the CBOR endpoint the same way. - IAM enforcement checked a signed REST request as the action its X-Amz-Target header named, not its route's. A user allowed only s3:GetObject deleted an object by sending the DELETE with X-Amz-Target: AmazonS3.GetObject and any Smithy-Protocol header. A signed JSON call it refused got the REST status, 403, rather than JSON's 400 AccessDeniedException. - A call to a disabled service was served when only its claim would have named the service, as for an unsigned JSON or rpcv2 call. - A REST JSON service request that fell through to S3's wildcard routes was not rejected, and a REST request signed for a service Floci lacks skipped the guard that refuses it before routing, so S3's routes answered it with a misleading error. The new AwsRouteClaimFilter runs after route matching and before every filter that reads the claim, AccountContextFilter's unknown-Region refusal and the signature check among them. It claims such a request by the route it reached, through ProtocolClaimer.routeClaim: - the JSON 1.0, JSON 1.1 and CBOR endpoints by X-Amz-Target; - the rpcv2 route by its path; - the Query endpoint's POST by the form; - every other route as REST. Those routes serve the request the same way whatever Smithy-Protocol header it carries, so the claim names the call that runs. A request claimed as REST also gets the unknown-service-scope check a claimed one gets before routing, which AwsProtocolClaimFilter now exposes for it. A claimed request is left as it was, and strict claiming still rejects an unclaimed one before routing. An X-Amz-Target post with a content type no protocol uses, the third kind of request the strict-claiming docs list, matches no route at all, and got a 500 rather than its 415, as any root POST in a content type no endpoint consumes did. Several resource methods share POST /, so RESTEasy Reactive routes it to a placeholder with no method of its own that picks one by content type, and answers 415 from there when none consumes it. The ResourceInfo producer then returns the placeholder's missing method, and CDI refuses the null with IllegalProductException. AwsRestJsonErrorHeaderFilter and S3CorsFilter read ResourceInfo on every response, so each failed on it. Both now read it through the new RoutedResource, which gives null when routing chose no method. docs/services/iam.md and the strict-claiming setting's docs say how such a request is handled. IamEnforcementFilter builds its rpcv2 route claim through the same ProtocolClaimer helper. |
||
|
|
29384867cf |
fix(iam): check the Lambda MicroVM and network connector routes (#6122)
Under IAM enforcement no Lambda MicroVM or network connector route was mapped to an IAM action, so every call went unchecked, and the roles they take with it. - Every MicroVM route (2025-09-09) and network connector route (2026-04-04) is mapped, and IamRestRouteCoverageTest now checks every operation of both models. An image or connector request is checked against microvm-image:<name> or network-connector:<id> in the request's account and Region, an identifier given as an ARN taken for its name, as the service looks it up. RunMicrovm is checked against the image its imageIdentifier names, an action on a running MicroVM against the image it runs, and a managed image's versions against that image, which aws owns. Creating an image or a connector and the list operations name no resource, so they are checked against *. - Lambda's own tag routes, /2017-03-31/tags/<arn>, which MicroVM images share with functions, are mapped and checked against the resource they tag: the caller's own function, image or connector of the ARN's Region and name, whatever account the ARN names, as Lambda looks it up, a target without the arn: prefix read as the MicroVM tag handler reads it, and an event source mapping's ARN as written. - iam:PassRole, to lambda.amazonaws.com as the Service Reference gives: CreateMicrovmImage and UpdateMicrovmImage (buildRoleArn), RunMicrovm (executionRoleArn), and CreateNetworkConnector and UpdateNetworkConnector (OperatorRole). This finishes the Lambda half of the follow-up on #5938. |
||
|
|
f731951c53 |
fix(iam): check iam:PassRole for EC2 Auto Scaling and Application Auto Scaling (#6186)
Under IAM enforcement, a request that handed Auto Scaling a role needed no iam:PassRole on it. A user allowed only the Auto Scaling actions could create a group from a launch template whose instance profile holds any role in the account, and Floci launches the group's instances with that profile, so they got the role's credentials. The IAM user guide requires the permission for every role passed to a service, and the EC2 Auto Scaling user guide lists where these operations pass one: - CreateLaunchConfiguration passes the roles of its IamInstanceProfile, given by name or ARN, or else of the profile of the instance it is made from, which the configuration copies, to ec2.amazonaws.com. - CreateAutoScalingGroup and UpdateAutoScalingGroup pass the roles of the instance profile in each launch template they name, at the version the group launches from, there too: the permission is "needed on the IAM identity (user or role) that creates or updates an Auto Scaling group using a launch template that specifies an instance profile". That covers the group's own template, its mixed instances policy's and each override's. StartInstanceRefresh does the same for its desired configuration, read merged with the group as Auto Scaling applies it: a version named alone moves the group's own template to it, and a template named alone keeps the group's version. - A ServiceLinkedRoleARN other than the default AWSServiceRoleForAutoScaling, and a lifecycle hook's RoleARN (PutLifecycleHook, and the hooks CreateAutoScalingGroup names), go to autoscaling.amazonaws.com. The guide asks for the permission "when a nondefault service-linked role, an IAM role for a lifecycle hook, or a launch template that specifies an instance profile ... is provided". - Application Auto Scaling's RegisterScalableTarget passes RoleARN to application-autoscaling.amazonaws.com when the request names one. A group from a launch configuration passes nothing, since the configuration's role was checked when it was created. Launching an EC2 instance straight from a launch template is unchanged: the EC2 user guide has that role checked where the template is made. The launch template version, a source instance's profile and a refresh's merged template are looked up through PassedRoleLookup, which the Auto Scaling service now implements with the code its own operations use, so the filter does not depend on Auto Scaling. |
||
|
|
94b09ff46b |
feat(iam): dispatch UpdateRoleDescription, the description half of UpdateRole (#6029)
UpdateRoleDescription answered UnsupportedOperation 400, where the reference publishes it as a role operation of its own: "Use UpdateRole instead", and "modifies only the description of a role. This operation performs the same function as the Description parameter in the UpdateRole operation". So it is that path rather than a second one. updateRole now answers the role it wrote, updateRoleDescription is that call with the session duration left alone, and the roleNameType check comes along rather than being restated. The handler renders the Role the operation answers through the same roleXml fragment GetRole and CreateRole use, detailed, there being no documented exclusion to honour: the page's Response Elements section lists one Role object and says only that it "contains details about the modified role". Both members are required here, where UpdateRole's are optional, and that is the one place this does not simply delegate. Description is read off the request rather than through requireParam, which reads a blank value as an absent member: roleDescriptionType carries a maximum of 1000 and no minimum, so an empty description is a value that clears the description and only a missing one is a refusal. It is rendered the way the handler renders every other missing required member, "Value null at 'description' failed to satisfy constraint: Member must not be null". RoleName is answered for by validateRoleName, which reads a null as "Member must not be null" and a bad shape before any lookup, as the other 21 roleNameType operations have since #5391. A service-linked role takes a description edit, through either action. The user guide says so plainly, "You can edit the description of any role from the IAM console, API, or CLI", its own procedure for editing one is update-role with --description or the UpdateRoleDescription API, and it publishes a policy granting iam:UpdateRoleDescription over arn:aws:iam::*:role/aws-service-role/* for that. Both actions model UnmodifiableEntity, and a modelled error is not a list of what triggers it: the guard now stands on MaxSessionDuration, the only other member UpdateRole takes. So a description-only UpdateRole goes through where it was refused before, a request carrying both is refused whole with neither field written, and the other ten protected role actions are untouched. Authorization needed nothing. AWS gives the action the role resource type in the vendored authorization metadata, NAME_PARAMETERS already maps role to RoleName, and ResourceArnBuilder mints the ARN from the stored role, so the action is authorized against that role rather than against the wildcard. The routing table has carried the name since routing became generated from the model, so what changed there is only that it stops falling through to the unsupported-action arm. A role Description is held to the shape AWS publishes for it, and on every action that takes one rather than only the new one: at most 1000 characters of [\u0009\u000A\u000D -~¡-ÿ], which admits tab, newline and carriage return and no other control character. CreateRole, UpdateRole, UpdateRoleDescription and CreateServiceLinkedRole share one validateRoleDescription, run before the role is looked up or created, so a refused description never reaches a stored role. That is more than strictness. XmlBuilder escapes the five XML entities and passes everything else through, so a control character stored in a description would make the Role these actions and GetRole answer unparsable, which CreateRole could already produce before this. The rendering names neither the offending value nor the set, following the one IAM constraint message a recording covers, which also keeps the refused bytes out of the error body they would otherwise break. Reverting the three call sites fails the maximum, the control character and the sibling cases and nothing else. Sixteen tests. Ten over the wire in IamRoleDescriptionIntegrationTest: the description applied and answered, an empty description clearing it, the session duration and the trust policy untouched, the maximum taken and one character past it refused with the stored description intact, a control character refused while tab and newline are taken, CreateRole and UpdateRole answering the same way with nothing stored, an absent Description refused with the role left as it was, an absent RoleName, a name outside the shape refused ahead of the lookup, and an unknown role answering NoSuchEntity. Four on the service: the role that comes back, the shape across the create and update paths, the name read before the lookup, and a service-linked role taking the edit while refusing the duration. Two in IamServiceLinkedRoleIntegrationTest: that allowance over the wire, and CreateServiceLinkedRole answering ValidationError for a description outside the shape rather than its own InvalidInput. The protected-actions test pins UpdateRole on MaxSessionDuration, which is what AWS protects there. Docs carry the table row, the three ways this differs from UpdateRole, the description constraint and why it matters for the answer, the carve-out in the service-linked section, and the matrix row at 176, which check_service_matrix reads off the handler's own switch rather than taking the number on trust. |
||
|
|
77c5d74a7d |
fix(iam): check the EventBridge Scheduler and Pipes routes (#6044)
Under IAM enforcement no Scheduler or Pipes route was mapped to an IAM action, so every call to either went unchecked, and the roles they take with it. - Every Scheduler and Pipes route is mapped, tagging at /tags as well as /tags/<arn>, and IamRestRouteCoverageTest now checks every operation of both models. Each request is checked against the resource the Service Reference gives: schedule/<group>/<name>, the group read where Scheduler reads it (the body's GroupName on a create or an update, groupName otherwise, else default), schedule-group/<name>, pipe/<name>, the ARN a tagging route names, and * where the request names none. Scheduler and Pipes ARNs are minted in the request's partition, as those services mint theirs. - SchedulerController joins the Scheduler descriptor, so a schedule request is checked as Scheduler whatever scope signs it. Otherwise one signed for another service was checked by that service's rules. - The shared tagging routes, /tags and /v1/tags, hand a request to the service its ARN names, so it is checked as that service, against the ARN the controller acts on: the body's resourceArn on POST /tags, the query's on the other bare routes. Otherwise a Pipes grant could tag a schedule group, a scope with no tagging rule went unchecked, and a query ARN could stand in for the body's. - iam:PassRole: CreateSchedule and UpdateSchedule pass the target's RoleArn to scheduler.amazonaws.com, and CreatePipe and UpdatePipe their RoleArn to pipes.amazonaws.com, as the Scheduler user guide's example policies and the EventBridge user guide say. |
||
|
|
73e890dbc7 | fix(logs): require the policy type's read permission for DescribeAccountPolicies (#6097) | ||
|
|
d0dac9814f | fix(redshift): check the extra IAM actions GetClusterCredentials needs (#6067) | ||
|
|
24a960a599 |
fix(iam): check the API Gateway and Lambda routes the action map names, and test them (#6036)
Under IAM enforcement a REST request is checked as the action its route maps to, and a route no rule maps is let through unchecked. On #5604 the S3 and API Gateway entries of iam-authorized-actions.json were noted as never read, since those requests are authorized by route, with a test comparing them with the route table asked for. This adds that test, against each operation's real route, and fixes what it found. - IamRestRouteCoverageTest builds a request on each operation's route, as botocore's model gives it, and checks that the registry resolves every S3, API Gateway and Lambda entry of iam-authorized-actions.json to the action the entry names. The routes are vendored, one operation to a line, in src/test/resources/aws/rest-routes.json by the new tools/aws/regen_rest_routes.py, which make aws-data-sync and aws-data-check now run. - API Gateway: only /account and /restapis were mapped, so API keys, usage plans, client certificates, base path mappings, domain names and all of the v2 API went unchecked. The management API is now checked as apigateway:<method> on any route, as AWS authorizes it, and RejectDomainNameAccessAssociation and PutRoutingRule as their own actions. The v2 operations AWS checks only as actions of their own names, routing rules and portals, are not served by Floci. - Lambda: InvokeWithResponseStream went unchecked; it is now checked as lambda:InvokeFunction, against the qualified function as an invoke is. GetLayerVersionByArn is checked as lambda:GetLayerVersion. It shares its path with ListLayers, so a rule can now require a query parameter. - S3: the two bucket metadata configuration entries are not applied. Floci serves no metadata configuration, and such a request falls through to ListObjects or DeleteBucket, so it stays checked as the operation that runs. |
||
|
|
eba0f72255 |
fix(iam): check iam:PassRole for ECS, Step Functions, EventBridge and CloudFormation (#5971)
Under IAM enforcement, a request that handed one of these services a role needed no iam:PassRole on it. A user allowed only ecs:RegisterTaskDefinition and ecs:RunTask could start a task with any role in the account, and with ECS task-role credentials on, the task got that role's credentials. The IAM user guide requires the permission for every role passed to a service. AWS's Service Reference names the service each operation passes its role to, and the check now covers these operations as it already covers Lambda and EC2: - ECS: RegisterTaskDefinition passes its task and execution roles to ecs-tasks.amazonaws.com. RunTask and StartTask pass the task definition's roles and any role override, and CreateService, UpdateService and CreateTaskSet pass the roles of the task definition they name. The infrastructure roles go to ecs.amazonaws.com: a managed EBS volume's role, the service role, the load balancer, lifecycle hook, Service Connect TLS and VPC Lattice roles, and a Managed Instances provider's infrastructure role. A role given by name is the role of that name in the caller's account. - Step Functions: CreateStateMachine and UpdateStateMachine pass roleArn to states.amazonaws.com, in a JSON or a CBOR body, gzip-encoded or not, since the CBOR endpoint decompresses a body before running it. - EventBridge: PutRule passes RoleArn, and PutTargets each target's RoleArn, to events.amazonaws.com. - CloudFormation: CreateStack, UpdateStack, DeleteStack, CreateChangeSet and ContinueUpdateRollback pass RoleARN when the request names one. A later operation that names none reuses the stack's role without the check, as CloudFormation does. CreateStackSet and UpdateStackSet pass AdministrationRoleARN, or the default AWSCloudFormationStackSetAdministrationRole for a self-managed StackSet, as the CloudFormation user guide says. An update goes by the StackSet's own permission model, which Floci keeps whatever PermissionModel the request names. A role override on RunTask is checked as well as the task definition's roles, not instead of them, because Floci runs a task with the definition's task role. The task definition and the StackSet's permission model are looked up through a new PassedRoleLookup interface, which ECS and the StackSet service implement, so the filter does not depend on either service. Three services are left out. Floci authorizes Cloud Control as cloudcontrolapi:*, where AWS uses cloudformation:*, so its RoleArn waits until that namespace is fixed. EventBridge Scheduler and Pipes are REST services that no IAM route rule maps to an action yet, so enforcement does not check their requests at all, iam:PassRole included. |
||
|
|
09b14e9d10 |
fix(s3): check the extra IAM actions a CreateBucket needs (#5961)
* fix(s3): check the extra IAM actions a CreateBucket needs A CreateBucket whose headers configure the new bucket needs more than s3:CreateBucket, as the CreateBucket API reference lists: - s3:PutBucketAcl for a canned ACL other than private, or a grant header - s3:PutBucketObjectLockConfiguration and s3:PutBucketVersioning for x-amz-bucket-object-lock-enabled: true - s3:PutBucketOwnershipControls for x-amz-object-ownership S3Controller now checks these actions before the bucket is created, so a denied request creates nothing. * chore(s3): move the CreateBucket header actions next to the object ones S3ObjectActions.bucketCreationActions now gives the actions a CreateBucket needs from its headers, and reuses GRANT_HEADERS. EnforcementFixtures.putUserPolicy replaces the test's own PutUserPolicy helper. |
||
|
|
b14537baa7 |
fix(iam): take every access key status the model publishes (#5968)
UpdateAccessKey refused the Expired that statusType permits, answered a message of its own making, and read the status only after it had looked the key up, so a bad key carrying a bad status answered NoSuchEntity 404 where the shape is what AWS answers for. The reference's Valid Values line on the operation reads "Active | Inactive | Expired" and the pinned model's statusType holds those same three. The fix is one call rather than a new rule. requireStatusFromEnum already serves UpdateSigningCertificate, UpdateSSHPublicKey and UpdateServiceSpecificCredential: it validates before each of those lookups and answers the rendering a recording of the third shows, naming neither the offending value nor the permitted set. UpdateAccessKey was the one operation of the four not calling it, so it calls it, and the helper's javadoc and the set behind it say four instead of three. UserName was the other half. The page carries the sentence DeleteAccessKey carries, "if the UserName is not specified, the user name is determined implicitly based on the AWS access key ID used to sign the request", and the handler passed the raw parameter straight through, so a call that omitted it compared the key's owner against null and answered NoSuchEntity. It resolves through resolveUserName now, as GetUser, ListAccessKeys and DeleteAccessKey do, and AccessKeyId is read through requireParam, as the sibling handlers read the ids they require. AWS::IAM::AccessKey refused Expired as well, and its own Allowed values line in the CloudFormation template reference reads "Active | Inactive | Expired". Leaving it would have been the same drift on a second surface, and taking Expired on the API while refusing it in a template is worse than either alone. The provisioner keeps its own guard, which runs before a key is created so that a refusal cannot orphan one, and its own message, which names the resource it refuses. One more drift came out of reading the method back, and it is the one that mattered. updateAccessKey is a read-modify-write that took no lock, where each of the three sibling status operations holds its family's. There was no access key lock at all: createAccessKey counted a user's keys and only then stored another, and the user rename rewrote each key's owner outside one, the single credential family that rename did not guard. Measured before the fix, racing the calls against each other: an update racing a delete wrote the deleted key back on 80 of 2000 trials, and four callers racing the two-key quota left more than two on 226 of 500. One accessKeyLock now covers the count and the store, the lookup and the delete, the read-modify-write, and the rename's loop, and the owner check that the delete and the update each carried is one helper. Substituting a fresh monitor for that lock at all four sites fails the quota case on its first trial and the resurrection case by its eighty-third. Three more places the lock has to reach, each measured the same way. The rename read the key list before taking the lock and rewrote it inside, so a delete that landed in between was undone and the key came back under the new name, where it authenticates again; the read moves inside the lock, where every other credential family already reads its own, and putting it back outside fails by the third trial. createAccessKey confirmed the user before taking the lock and deleteUser checked for keys without holding it, so a create could store a key for a user the delete had just removed; the confirmation moves inside the lock, the way UploadSigningCertificate's already is, and deleteUser holds the lock across its key check and the delete, outermost of the five it nests, which is the order UpdateUser leaves intact by taking that lock on its own. Reverting either half alone puts the orphan back, by the seventeenth trial and by the second. Fifteen tests. Seven over the wire: Expired stored and read back, a status outside the set, an absent status, an absent key id, the order against a key that is not there, a call that names no user, and another user's key still answering NoSuchEntity. Three on the service for the three statuses, the order, and the absent status. One on the provisioner for a template declaring Expired. And four in IamConcurrencyTest, which raced six collections and no credential family before this: an update against a delete, four creates against the quota, a rename against a delete, and a create against DeleteUser. The two refusals also read the key back, over the wire and on the service, so a validation that wrote before it refused would not pass them. What is left is the count: AWS reports "2 validation errors detected" when the id and the status are both wrong, where every message here leads with one, which is the follow-up #5280 already carries. |
||
|
|
f0975a9f47 |
fix(iam): check iam:PassRole when Lambda or EC2 is passed a role (#5938)
Under IAM enforcement no request was checked for iam:PassRole. A user allowed only lambda:CreateFunction, or ec2:RunInstances, could give the function or the instance any role in the account, and Floci runs the function with that role and serves the instance its credentials, so the user could act with the role's permissions. A request that passes a role to Lambda or EC2 now also needs iam:PassRole on that role, as the IAM user guide requires: "To pass a role (and its permissions) to an AWS service, a user must have permissions to pass the role to the service." The check offers iam:PassedToService, the service AWS's Service Reference names for the operation, so a grant to pass a role to one service does not cover another. It covers Lambda's CreateFunction, UpdateFunctionConfiguration when it sets the role, CreateWebFunction and CreateWebFunctionRevision, and EC2's RunInstances, RequestSpotInstances, AssociateIamInstanceProfile, ReplaceIamInstanceProfileAssociation, CreateLaunchTemplate and CreateLaunchTemplateVersion, which pass the roles of the instance profile they name, and CreateFlowLogs. A Spot Instance request now takes its instance profile by name as well as by ARN, as RunInstances does, so the role checked is the one the instance gets. Launching from a launch template checks nothing, as on AWS: the EC2 user guide warns that whoever can create a template version can pass its role without iam:PassRole. The role parameters of other services are left for later changes. |
||
|
|
494a6725a1 |
feat(iam): release and exchange the delegation token (#5914)
M4a dispatched the delegation request lifecycle as far as ACCEPTED and stopped there, so no request reached FINALIZED and the credentials the whole feature exists to hand over could not be obtained at all. This is the token half: IAM SendDelegationToken and STS GetDelegatedAccessToken, the last two of the ten operations the family spans. SendDelegationToken takes a request id, answers no output shape, and moves an ACCEPTED request to FINALIZED. The reference says that "cannot be rolled back", which makes it the one transition that refuses to repeat itself: releasing twice answers ConcurrentModification, the wrong-state shape the other four writers already use. Releasing mints the token and records the instant it happened, both on the request, because the shape publishes neither and nothing else is going to hold them. Releasing is also where OnlySendByOwner is finally read. M4a stored the flag with nothing looking at it, which was right while nothing could release; SendDelegationToken is the one operation it speaks to. It "prevents any party other than the owner from calling SendDelegationToken API for this delegation request", for the case the reference spells out: the owner lacked the permission to approve, forwarded the request to a more privileged user, and still has to be the one who hands the token over. So the release is the one call on this family decided per identity rather than per account, the handler passing the caller ARN as associate and accept already do, and an approver who is not the owner answers AccessDenied 403, which the API reference publishes as a common error for every IAM operation. GetDelegatedAccessToken exchanges that token for credentials in the customer's account. The delegation period "starts when customer releases the exchange token, not when the product provider redeems it", and "all credentials obtained from the same exchange token expire at the same time", so the expiry is release plus SessionDuration whenever it is redeemed and a token can be exchanged repeatedly, each exchange buying less time than the one before. AssumedPrincipal is the identity that approved the request rather than the one that claimed it: accepting a request "records the details and the state of the identity that called this API", and "this is the identity that gets mapped to the delegated credential", which the user guide says the same way, the provider obtaining the "approver's temporary credentials". The two are the same identity until a request is forwarded for approval, which is the case OnlySendByOwner serves. PackedPolicySize is left out: the model deprecates it and states it is not populated for this operation. Two answers had to be chosen rather than read off, both forced by the error set. GetDelegatedAccessToken models exactly three errors, and none of them says "no such token", so a token nothing matches is answered as an expired one: from the caller's side the two are the same situation, and the reference's own remedy, "Request a new token and retry the operation", fits both. A token offered by an account that did not file the request answers AccessDenied 403 instead, the shape this handler already uses for a caller who may not perform the operation, because "the exchange token can only be redeemed by the product provider account that created the delegation request" is a refusal rather than an expiry. The account is checked before the window so that neither guard can hide the other, and both are tested with the other one passing. The code is ExpiredTradeInTokenException, not ExpiredTradeInToken. The model writes the Exception suffix into error.code for that shape and for RegionDisabledException while PackedPolicyTooLarge drops it, so each code is read off its own shape rather than derived from the shape's name. What the credentials carry is the request's PermissionPolicy, the policy AWS renders from the partner's registered template. No API registers a template, so nothing sets it and the session carries none, which is where M4a left PolicyTemplateArn for the same reason. The session is filed in the customer's account with no issuing key, and as a delegated session rather than an issued one. The delegation is the customer's grant, so a partner key that happened to name an IAM user must not become the session's issuer: issuingUser bounds a session by the issuer's own permissions, which would be the partner's rather than what the customer gave away. The approver is carried in a field of its own for the same reason the issuer is left empty. An issued session holds its identity in the role ARN slot, which is resolved by name, so an approver named like a role would act with that role's permissions, one named like no role would act with none, and GetCallerIdentity would answer for a role that does not exist. A delegated session instead resolves its approver from what the ARN says it is: a user's own policies and boundary, the account's access where the root approved the request, the role behind a session assumed from one, and nothing where that identity is gone. The account is the owner's either way, a request being visible only from the account that claimed it. The request's PermissionPolicy still bounds it on top wherever one exists, which is where the registered template would land. One gap this step cannot close on its own. AWS publishes the exchange token only in the ExchangeToken notification on the partner's SNS topic, and no operation on the family answers it. Floci sends no notification yet, so the token is minted onto the record and nothing hands it back over the wire. The integration test reads it from the service for that one step and drives everything either side of it over the wire. Twenty-one tests: eight on the service covering the release, the owner-only flag either way, the repeated exchange, both refusals and the window, with a clock the test owns, eight over the wire across the two accounts, one on the handler holding the session to the customer's account and to its approver, and four under IAM enforcement on what the credentials may then do: an approver allowed to read and not write, whose delegated credentials do exactly that, a request forwarded to an administrator who approved it, whose credentials write where its owner can only read, a role carrying the approver's name that lends them nothing, and a request approved by the account root. Four probes, each reverting one thing: mapping the credentials to the owner fails the forwarded case and the handler test and nothing else, anchoring the expiry at the redemption instant fails the two tests that describe it, filing the session against the partner fails the one that holds it, and dropping the owner-only guard fails the one that asks for it. SendDelegationToken joins the delegation family in ResourceArnBuilder, AWS giving it the delegation-request type, so it is authorized against the request rather than the wildcard. Routing needs nothing added since #5879 reads each service's actions from its botocore model, which names both of these, so the matrix rows in docs/services/index.md are the only counts this moves: IAM 174 to 175 and STS 7 to 8. |
||
|
|
e9154fb928 | fix(logs): require the policy type's own permission for PutAccountPolicy (#5956) | ||
|
|
c17bd49096 |
fix(s3): check bucket policies for the actions IAM checks (#5913)
S3's own access check under floci.services.s3.enforce-auth, which evaluates bucket policies and ACLs, lagged behind IAM enforcement. It checked a version's tagging, ACL and annotation requests as the base actions, an object created with tags, an ACL or Object Lock settings as s3:PutObject alone, GetObjectAttributes without the read, and a write carrying If-Match without the read IAM checks for it. It offered a bucket policy none of the request's condition keys, and asked for s3:BypassGovernanceRetention on an annotation delete, which the user guide says the permission "does not apply to". The bucket-policy check now checks the actions IAM does: the version counterpart when a request names a versionId, the tagging, ACL, retention and legal-hold actions an object creation's settings need, a copy of a tagged source included, s3:GetObject beside s3:GetObjectAttributes and beside an If-Match write, and no bypass permission on an annotation delete. A signed request's bucket policy is offered the tag and Object Lock keys the request sets: an object creation's headers and the tagging, retention and legal-hold bodies, read by the same S3ObjectActions helpers IAM's condition resolver now uses. s3:BypassGovernanceRetention is asked for only by a request that overrides a governance lock, by IAM and by the bucket policy. The user guide's permissions table requires it "if you want to delete an object that's protected by governance mode" and to "bypass the governance mode of an Object Lock retention configuration", and DeleteObjects already asked for it only then. DeleteObject and PutObjectRetention asked for it whenever the header was sent; they now ask only for a delete that removes a version under a governance lock, not one that only adds a delete marker, and for a retention change that shortens or removes one. The IAM condition resolver now reads the object key from the path as it arrived, as S3Controller does, through the new S3ObjectKeys: the normalized path drops a key's leading slash, so the lock and the s3:ExistingObjectTag tags of "/doc" were looked up on "doc". A CopyObject replacing its source's tags reads x-amz-tagging from the query as well, as PutObject does, so it applies the tags both checks saw. An anonymous creation that a public bucket ACL's WRITE grant admits may still apply its ACL, tags and Object Lock settings, unless a public bucket policy decides their actions, since an ACL grant names no actions. The creation checks are told whether a request is a CopyObject rather than guessing it from x-amz-copy-source, which a CreateMultipartUpload ignores while it applies its own tags, so those tags are always checked, by IAM and by the bucket policy. With an access check on, a DeleteObject, a DeleteObjects entry and a PutObjectRetention hand S3Service the bypass only when they override a lock whose bypass permission the checks approved, IAM's decision travelling in RequestContext, so a lock set after the checks is refused rather than bypassed unchecked. Refs #5716 |
||
|
|
377c09733a |
fix(s3): check a presigned copy's source read against its credential (#5891)
Under IAM enforcement, CopyObject and UploadPartCopy also need s3:GetObject on the copy source, or s3:GetObjectVersion for a version, and S3Controller checks it itself, since the source appears only in the x-amz-copy-source header. It passed IAM the Authorization header, which a presigned request does not have, so IAM skipped the check. A user allowed to write one place could presign a copy of any object they cannot read into it. The check now uses the request's credential, the header's or a presigned URL's query credential, as the copied-tags check next to it already does. The S3 user guide says "The capabilities of a presigned URL are limited by the permissions of the user who created it." The test signer's presignedQuery also signs the parameters already in its URI's query, such as an UploadPartCopy's upload id, so a presigned part copy verifies, and refuses a URI that is already presigned. docs/services/iam.md lists the copy source check. |
||
|
|
66fce77bdc |
feat(iam): generate, claim and answer delegation requests (#5797)
IAM temporary delegation lets an AWS Partner ask a customer for scoped, time-limited access to the customer's account: the partner files a request, the customer claims and answers it, and an accepted request releases an exchange token the partner trades for credentials. Floci dispatched none of it, so all seven lifecycle operations answered UnsupportedOperation 400. The family was filed as a non-goal on the strength of CreateDelegationRequest stating "This API is not available for general use. In order to use this API, a caller first need to go through an onboarding process described in the partner onboarding documentation". That sentence appears exactly once in the whole API reference, and the partner user guide describes a generally available feature with a published lifecycle. The gate is an AWS-side account allowlist for ISV Accelerate partners, "Enable API access for your specified accounts", not a protocol behaviour, and an emulator has no allowlist. Answering NoSuchEntity because nothing can exist would emulate the feature's absence rather than the feature. This is the lifecycle half: Create, Associate, Accept, Reject, Update, Get and List. SendDelegationToken and STS GetDelegatedAccessToken are the token exchange and come next, so no request reaches FINALIZED yet, and GetHumanReadableSummary stays undispatched because its summary is LLM- generated on AWS. A delegation request is the one IAM record two accounts share, which decides how it is stored: keyed by id under the creating account and resolved across accounts on read, because the reference makes the id globally resolvable and decides access from the request's own owner fields. A request nobody owns "can be called by any account"; one naming a target account is readable only from there, which is why a partner loses sight of its own filing once it is aimed. Floci decides that at account granularity, there being no per- identity permission on a request to consult. ListDelegationRequests leaves out a request with no owner even when it names the listing account, as the reference states, so a partner does not list its own filings at all, which matches the guide telling partners to track state from the notifications. Expiry is applied when a request is next read rather than swept by a worker. Each state carries the window AWS publishes, a day for UNASSIGNED and a week for every other state including the terminal ones, and a request past its window reads back as EXPIRED. That needs no scheduler to be correct and no clock to be mocked globally, so the service takes its own Clock and the unit test advances that rather than the shared test clock. Two answers had to be chosen rather than read off. An operation asked to move a request out of a state it no longer holds answers ConcurrentModification: no modeled error says "wrong state", and AcceptDelegationRequest models only NoSuchEntity, ServiceFailure and ConcurrentModification, so the conflict is the closest of the three and is used on all four writers rather than a different code each. PermissionCheckResult answers UNSURE when the check is asked for, which the enum models, because a delegation request carries no permission to evaluate. A member that breaks the format or constraints it declares answers ValidationError. The reference publishes that as a common error, "the input doesn't meet the required format or constraints", for every IAM operation while listing it on no operation at all, which is why it appears in no error table and in none of these; the rest of IAM answers it in the same shape and wording, so these operations do too. The InvalidInput they do model is kept for a value that cannot be read as the member's type, which is where the shared pagination already puts a MaxItems that is not a number. A lifecycle call reads a request, checks its state and writes it back, so all of them take one lock, as the sibling IAM services do with theirs. Without it two callers could both claim the same unassigned request and the later write would decide the owner, and two creates could both pass the workflow-id uniqueness check. Each call also takes a single clock reading, threaded from the lookup into the transition, so a request cannot be expired on the way in and moved on anyway. Two shape details come from the pinned botocore model rather than the reference PDF, which omits both: GetDelegationRequest also takes DelegationPermissionCheck and answers PermissionCheckStatus and PermissionCheckResult, and ListDelegationRequests spells its flag isTruncated in lower case where every other IAM list spells it IsTruncated. The model names the member, so the wire follows the model. SessionDuration's 300 to 43200 range, PolicyParameter's shape and the 100-default, 1000-maximum page size come from there too. The CLI reference supplies the constraints the PDF leaves hard to read: the redirect URL's whole pattern, which the PDF breaks across a line, the character class the free-text members carry, and the printable-ASCII class on a policy parameter's name and values. Each is enforced. It also settles that the Permissions structure is required while both of its members are optional, marking neither. Reading it is what caught an empty required member being treated as an omission: Description is required and its pattern permits an empty string, so Description= is a value and only an absent member is missing, which is a distinction that exists on the wire and is tested there. Notes and RejectionReason both exist on the shape and each gets exactly one writer: an update carries notes for an administrator and a rejection carries the explanation the reference describes for it. An indexed member is read from the keys the request carries rather than counted up from one, so Parameters.member.2 without a member.1 keeps its entry instead of being dropped at the gap, and a boolean member has to carry true or false rather than being read as false for anything else. delegation-request leaves ResourceArnBuilder.UNRESOLVED_TYPES, since that entry claimed the type belongs only to actions nothing dispatches. The four by-id actions mint arn:<partition>:iam::<account>:delegation-request/<id> from the request, the same way the ARN-carrying actions pass an ARN through, one step earlier. CreateDelegationRequest stays at the wildcard because IAM assigns the id, and UpdateDelegationRequest stays there because AWS publishes no authorizable action for it at all. UnresolvedResourceTypesIntegrationTest would have failed until this was done, which is that test working as intended. The console deep link follows the partition too. CreateDelegationRequest answers the URL the partner redirects the customer to, and a caller in China or GovCloud was handed a console their account cannot reach. The host now comes from the region's partition, the way the CodePipeline approval links already resolve theirs, keeping the commercial console's path because that is the only path any partition publishes. The account-root stand-in behind an owner ARN is minted through RegionResolver for the same reason rather than concatenated, which is also the shape IamEnforcementFilter synthesizes. Nothing is enforced that AWS does not publish. LimitExceeded is modeled with no quota behind it, so none is invented. NotificationChannel is validated and stored and nothing reads it, there being no notification to send yet. PolicyTemplateArn is kept as given and resolved against nothing, templates being registered by email with no API. All four new model types are registered for reflection, the state enum included: it is reachable from a stored request, and a native image that cannot read it back loses every delegation request on restart, which is what the persistence guard checks. Twenty-seven unit tests drive the state machine, both expiry windows, the two races and the deep link in each partition, with a clock the test owns, and fifteen integration tests drive the lifecycle over the wire across two accounts, the access key id being the account id as the rest of the suite does it. Routing needs nothing added: #5879 has the Query router read each service's actions from its botocore model, which names all seven already, so the matrix row in docs/services/index.md moving 167 to 174 is the only count this changes. |
||
|
|
b0777a4020 |
fix(iam): check the actions an S3 operation needs besides its own (#5846)
Under IAM enforcement an S3 object operation was checked only as its own action. A PutObject, CopyObject or CreateMultipartUpload that set tags, an ACL, a retention period or a legal hold needed only s3:PutObject, GetObjectAttributes needed only the read, and a retention change or a delete asking to bypass governance retention needed no s3:BypassGovernanceRetention. No Object Lock condition key was offered. Each now also needs the actions the S3 user guide's permissions table and the API references require besides its own. An object creation needs the action of each setting it applies: s3:PutObjectTagging, s3:PutObjectAcl, s3:PutObjectRetention or s3:PutObjectLegalHold. A copy under the default COPY tagging directive keeps a tagged source's tags, so it needs s3:PutObjectTagging too, checked where the source is read against the request's credential, a presigned URL's included, and it offers no request tag keys from the x-amz-tagging header it ignores. GetObjectAttributes needs s3:GetObjectAttributes, or s3:GetObjectVersionAttributes for a version. A PutObjectRetention or DeleteObject that sends x-amz-bypass-governance-retention needs s3:BypassGovernanceRetention; an annotation delete does not, as the user guide says the permission does not apply to annotation operations. s3:PutObject, s3:PutObjectRetention and s3:PutObjectLegalHold are offered the Object Lock keys from the request's headers or body, and an object creation offers its tag and Object Lock keys to each extra action. A denial names the missing permission, and CloudTrail records the operation that was refused, PutObjectRetention and GetObjectAttributes included. Generated presigned URLs refuse all four creation settings, as they refused tags. Refs #5716 |
||
|
|
a611e9ea6f |
fix(iam): authorize Secrets Manager requests against the secret's ARN (#5781)
* fix(iam): authorize Secrets Manager requests against the secret's ARN IAM enforcement evaluated CreateSecret against secret:* because the builder read only SecretId, and a secret named by its name was evaluated as secret:<name>, without the random suffix every secret ARN carries. A secret:<name>-?????? policy, the pattern AWS documents for granting access to a secret that may not exist yet, matched neither. CreateSecret is now evaluated against secret:<Name>-??????, standing in for the suffix that is assigned at creation, and a name-based SecretId resolves to the stored secret's full ARN in the target account. Closes #5364 * fix(iam): pick the Secrets Manager target by the serving operation CreateSecret now reads only Name and other actions only SecretId, so a field the handler ignores cannot choose the resource. Minted ARNs take the request's partition, and a name lookup also reads a legacy unprefixed secret for the default account. Adds an SDK compatibility test. * fix(iam): resolve a partial-ARN SecretId to the stored secret's ARN A SecretId given as an ARN without the random suffix is now authorized against the stored secret's full ARN, resolved in the caller's account in the order the operations use: an exact ARN first, then the ARN read as a partial one. The enforcement tests share EnforcementFixtures' auth, a new assumeRole helper, and a new createRole helper that removes the role after the test. The Secrets Manager enforcement test also deletes the secrets it creates. |
||
|
|
92be67d2df |
fix(logs): enforce group permissions for lifecycle changes (#5840)
* fix(logs): enforce group permissions for lifecycle changes * fix(logs): accept bare group ARNs in lifecycle policies |
||
|
|
2f56c225dc |
docs(iam): note which resource policies are not evaluated (#4899)
The IAM page says S3 bucket, Lambda function and SNS topic policies take part in request authorization, but not that SQS queue and API Gateway REST API policies are stored without being evaluated. Add that next to the S3, Lambda and SNS bullets. No behaviour changes. |
||
|
|
49a3ff9a10 |
fix(logs): bind ARN tag operations to their owning group (#5810)
* fix(logs): bind ARN tag operations to their owning group * fix(logs): preserve literal names in tag requests * test(logs): share authorization fixtures |
||
|
|
7e98592761 |
fix(s3): act on the object version a tagging request names (#5775)
PutObjectTagging and DeleteObjectTagging ignored versionId and changed the current version. GetObjectTagging dropped it in the controller, so it read the current version too, and the service took versionId=null as the current version even on a key that has no null version. All three now act on the version named. "null" names only the null version, the object stored without a version id; on a key that has none the request answers NoSuchVersion. Each returns the version it acted on in x-amz-version-id. A request on a delete marker, named or current, answers 405 MethodNotAllowed with Method and ResourceType, and with x-amz-delete-marker: true, as S3 does. A put or delete runs under the bucket monitor that writes, deletes and the lifecycle sweep hold, so a version deleted between the lookup and the write is not written back. Since they act on the version named, a request naming one is now checked as s3:GetObjectVersionTagging, s3:PutObjectVersionTagging or s3:DeleteObjectVersionTagging, carrying s3:versionid, in place of the base tagging action. Part 1 kept these requests on the base actions because the operations changed the current version. The s3:ExistingObjectTag lookup already read the version named, so the tags a condition sees are now those of the version the request changes. The IAM condition context still reads s3:ExistingObjectTag for versionId=null from the current version, which GetObject still serves for it, so a deny on those tags keeps applying. Refs #5716 |
||
|
|
608a38bff3 |
fix(iam): read a role trust policy with the caller's principal keys (#5770)
A role's trust policy was the one context a request is evaluated against that did not say who was calling. AssumeRolePolicyEvaluator assembled its own map and put aws:PrincipalArn into it alone, so a trust policy keyed on aws:userid, aws:PrincipalType or aws:username could not match, where every other context a request is evaluated against carries all four through CallerArns.putPrincipalKeys. The user guide puts aws:PrincipalType and aws:userid in "the request context for all requests, including anonymous requests" and aws:username in it for every IAM user, and an sts:AssumeRole request is no exception: the guide's own example of a resource-based policy tells principals apart in a Condition on aws:userid. Raised by hectorvent on the review of #5568 and left to its own PR. The evaluator now takes the caller's CallerArns in place of its two ARN strings and writes the keys through that single writer, so no second context has to be kept in step. STS passes the caller it already resolves, and a credential that resolves to no identity is the account root stand-in it already names in its denial, now with the account's own keys: the guide gives the root user the account id as its aws:userid, the type Account and no aws:username, which is what S3 and the enforcement filter already build for it. That construction had three copies and is now one factory on the record. Step Functions passes the execution role as the session it is, carrying AssumedRole as its aws:PrincipalType: it assumes that role on the state machine's behalf, so a target role's trust policy may condition on the type. It mints no session name there, and a session's aws:userid is role-id:session-name, so that key and aws:username stay absent. AssumeRolePolicyEvaluatorTest builds its callers through the record, with three cases on the keys: a condition on aws:username matching the caller and not matching the same caller carrying no keys, aws:PrincipalType and aws:userid telling a user apart from a role session, and a value the caller carries winning over the request's own copy. AssumeRoleTrustConditionsIntegrationTest signs four more AssumeRole calls end to end, over a condition on the calling user's name, on the principal type, on the root stand-in's account id, and on a session's role-id:session-name. Reverting the evaluator to aws:PrincipalArn alone fails all seven; writing the keys with putIfAbsent instead fails the precedence case alone. LambdaTaskAuthorizerTest covers the Step Functions caller from both sides, a trust condition on the principal type matching it and one on the session's own id not matching. |
||
|
|
21184df828 |
fix(iam): authorize S3 object operations as the actions S3 documents (#5756)
Under IAM enforcement, CreateMultipartUpload, CompleteMultipartUpload, RestoreObject and SelectObjectContent were never checked against the caller's identity policies. They are POST requests, the registry had no S3 POST rule, and an action no rule maps is allowed. A user with no S3 permission could start and complete multipart uploads, restore objects and read them through Select. Many other S3 requests were checked as the wrong action: - ListParts and AbortMultipartUpload as s3:GetObject and s3:DeleteObject. - Object retention and legal hold as s3:GetObject and s3:PutObject, so a user allowed only to write objects could set a retention period or a legal hold. - Object annotations as the plain object actions. - A request naming a versionId as the current-version action. A deny on s3:DeleteObjectVersion, the usual guard against permanent deletes, did not stop one, and reading a version needed s3:GetObject rather than s3:GetObjectVersion. - Analytics, inventory and Intelligent-Tiering configurations as s3:ListBucket, s3:CreateBucket or s3:DeleteBucket. - DeleteBucketTagging as s3:DeleteBucketTagging, which is not an IAM action. A policy naming it granted the call, and one granting s3:PutBucketTagging, the action AWS checks, was refused. - A request naming two sub-resources as the first one the registry looked for. The controller runs a different one: GET ?acl&tagging returns the tags while needing only s3:GetObjectAcl. The object sub-resources are now resolved per method, in the order S3Controller dispatches them. A versionId selects the version action AWS checks for a read, head, delete, ACL or annotation request, and for Select, which S3Controller runs on the version named; the bucket configurations follow the controller's bucket chains. Tagging keeps the tagging actions: the tagging operations still act on the current version whatever versionId names, so a version tagging action would authorize one version and let the request change another. The actions come from the S3 user guide's "Required permissions for S3 API operations" and multipart permissions tables, the API reference and the Service Reference: - s3:PutObject for creating and completing an upload; - s3:RestoreObject, and s3:GetObject for Select; - s3:AbortMultipartUpload and s3:ListMultipartUploadParts; - the retention, legal-hold, version and configuration actions; - s3:PutBucketTagging for DeleteBucketTagging, and each configuration's Put action for its delete. A write carrying If-Match already needed s3:GetObject as well. The conditional-writes guide lists PutObject, CopyObject and CompleteMultipartUpload as the operations that take the header, so now that completing an upload is checked as s3:PutObject it gets that check too, while CreateMultipartUpload and UploadPart, which ignore the header, no longer do. A conditional delete with an If-Match ETag already needed s3:GetObject. A delete naming a version is now s3:DeleteObjectVersion, so that check covers it too, still as s3:GetObject: the conditional-deletes guide evaluates the condition against the current version only. Condition keys, per the Service Reference: - s3:versionid is given to the version actions. - s3:ExistingObjectTag is given to the version actions and the annotation actions, read from the version the request names. - DeleteBucketTagging, checked as s3:PutBucketTagging, keeps the bucket's tags in its context. CloudTrail denials name the version actions' operations, and give no name to a POST operation rather than a wrong one. The actions an operation needs besides its own, S3 behaviour behind these checks and S3's own bucket-policy check follow separately (#5716). Refs #5716 |
||
|
|
b58d181a30 |
feat(iam): authorize the account password policy's self-service flag (#5717)
The account password policy accepted AllowUsersToChangePassword, echoed it
back from GetAccountPasswordPolicy, and no authorization decision read it: the
six references in src/main were the field, its accessors, the setter call and
the XML element. So under enforcement a user needed a policy naming their own
user however the flag was set, and the option AWS describes as account-level
authorized nothing.
The user guide: the option "gives users access to the iam:ChangePassword
action for only their user and to the iam:GetAccountPasswordPolicy action",
and it "does not attach a permissions policy to each user. Rather, IAM applies
the permissions at the account-level for all users."
So it is one document for the whole account rather than a grant assembled per
user: iam:ChangePassword on user/${aws:username} and on
user/*/${aws:username}, the two patterns AWS's own IAMUserChangePassword
policy writes, the second for a user under a path, plus
iam:GetAccountPasswordPolicy. The resource ARNs are minted in the request's
partition, for the account whose password policy sets the flag.
Writing it with the variable rather than the caller's resolved ARN is what
makes it the grant the guide describes, and it carries two properties for
free. The scope to "only their user" is the variable's, so one stored document
serves every user in the account. And the grant belongs to IAM users without a
principal check of its own: a role session and the account root have no
aws:username, the variable resolves to nothing, and a resource holding a
variable with no value "will not match any resource". It therefore rests on the
substitution #5639 added, now on main; without it the statement is literal
text and matches nobody, which is what the probe below shows.
The grant reaches the caller wherever the principal is an IAM user: its own
access key, a session token it minted, and the simulate path. It is appended
to the identity policies the evaluator already reads, so nothing about
evaluation order changes: an explicit Deny still refuses the call and a
permissions boundary still caps it. collectUserPolicies stays the user's own
set, so ListUserPolicies, ListAttachedUserPolicies and
GetAccountAuthorizationDetails report nothing new, which is the "does not
attach a permissions policy" half of the guide.
That half holds for the answers AWS scopes to attached policies.
ListPoliciesGrantingServiceAccess reports policies by name and type and has
none to report here, and GetContextKeysForPrincipalPolicy returns "only
context keys referenced by the identity-based policies attached to the
specified entity, and any additional policies that you provide", so it reads
the attached set rather than the evaluated one: it had been naming the
${aws:username} of the grant's own resource, twice, once per pattern, out of
a document the user does not hold.
A last-accessed report answers the other question, "every AWS service that
the resource could access using permissions policies", and an account-level
permission is one the user can reach: GenerateServiceLastAccessedDetails
lists iam for a user carrying no policy of their own while the flag is set,
and nothing for that same user once it is cleared. The grant goes into the
documents the service list is read from rather than into the policies the
report names, since it is no policy of the user's and has no name or ARN to
report as one.
One thing the variable form exposed. SimulatePrincipalPolicy built its context
from the call's ContextEntries alone, so a policy scoped to ${aws:username}
simulated as if the key were absent and this grant answered implicitDeny for a
permission the account really gives. The guide lists what a simulation starts
with, "aws:PrincipalAccount, aws:PrincipalId, aws:PrincipalType, aws:Type,
aws:UserId, aws:UserName", adding that "because these keys are populated for
you ... You provide the values for all other condition keys". So the handler
now populates them for a user policy source, through the same CallerArns
writer the enforcement filter uses, which makes a simulation read what an
enforced request reads: aws:PrincipalArn, aws:PrincipalType, aws:username,
aws:userid and the account. The guide's aws:PrincipalId and aws:Type are in no
request context here, so a simulation does not invent them either, and iam.md
says so rather than leaving the list to imply all six. A value the call
supplied still wins, in whatever case it spelled the key, since the context is
keyed the way the evaluator compares key names: keyed by the raw spelling, a
supplied aws:principaltype and a populated aws:PrincipalType were two entries
and the later lowercasing kept whichever hashing happened to reach first. The
account comes from the identity that resolved rather than from the ARN the
call wrote, which need not be one this emulator can parse: a PolicySourceArn
is resolved by its trailing name, so arn:aws:iam:user/bob names a user while
parsing as nothing, and parsing the request's own text turned that call into a
500. A role named as the source is not a session: there is no session name for
an aws:userid and no documented aws:PrincipalType for it, so those keys stay
absent and a statement matching on one does not match.
The flag that answers for a user is their own account's. A PolicySourceArn is
the one way to name a user elsewhere, and the lookup already resolves them in
the account their ARN names, so the flag is read there as well and the grant's
resource ARNs are minted for that account. This account's grant therefore
never resolves ${aws:username} to a user its password policy does not cover,
and a user of another account is not refused a permission their own account
really gives: an allowed answer needs their account to set the flag and the
resource to be theirs.
Thirteen integration tests under enforcement: the flag letting a user with
no policies change its own password and read the policy, the grant appearing
in neither listing nor in GetAccountAuthorizationDetails, nor among the
context keys a simulation's caller is told to supply, while a policy the
user really carries appears in all three, a last-accessed report listing iam
for a user carrying nothing else while the flag is set and nothing once it
is cleared, an explicit Deny of iam:ChangePassword still refusing the call,
a permissions boundary still capping it, the grant reaching none of GetUser,
UpdateLoginProfile or CreateUser, the flag read both ways by one user whose
policies never change, the scope checked through SimulatePrincipalPolicy
against another user's ARN, a supplied context value surviving a key spelled
in another case, a PolicySourceArn that parses as nothing still simulating,
this account's flag not reaching a user of another account, and that user's
own account's flag reaching them over their own ARNs. Each of the
authorizing ones ends on something only the grant allows, which the first
round of them lacked: two asserted refusals alone and passed with the grant
withheld. Probed six ways, by withholding the grant, by disabling
substitution, by dropping the simulator's populated keys, and by reverting
each of three tests' fixes, failing all ten, all ten, the one simulation,
and one test apiece. The three added here were probed the same way, one
behaviour at a time: the other account's user went back to implicitDeny, the
context keys answered aws:username twice, and withholding the grant from the
report emptied it.
Verified on main: 6680 tests across the 342 IAM, core, enforcement and
resource-policy classes that reach the evaluator, 13 skipped and none
failing, with Checkstyle, docs-check and partition-check clean, the last
because the grant mints its resource ARNs rather than writing a partition
literal.
|
||
|
|
dbe7fdb92e |
fix(logs): enforce stream resource permissions (#5694)
* fix(logs): enforce stream resource permissions * fix(logs): retain request partitions for stream permissions |
||
|
|
425cd3167d |
feat(iam): resolve policy variables in Resource patterns and Condition values (#5639)
A ${...} in a Resource pattern or a Condition value was matched as the text it
is written as, so a statement scoped to arn:aws:iam::*:user/${aws:username}
matched no user at all. AWS's own IAMUserChangePassword policy is written that
way and floci vendors it verbatim, so under enforcement it authorized nothing,
and it is not alone: 244 of the 1586 vendored managed policy documents carry a
variable, and of the 1635 occurrences in them 1443 sit in a Condition value
and 192 in a Resource. The Condition share is where the loss bites hardest,
since a variable that cannot resolve quietly drops a Deny that AWS honours.
The keys a variable resolves against arrived with #5568, which put
aws:username, aws:userid and aws:PrincipalType into the request context. This
is the other half of that work: without substitution the keys answer nobody,
and without the keys substitution has nothing to find.
Variables now resolve wherever the evaluator matches a statement, which covers
every document it reads: identity policies, resource policies, session
policies, permissions boundaries, SCPs, and the Condition of a role trust
policy, whose own Version now reaches the condition check. A trust policy is
the narrow case, since sts:AssumeRole is authorized before there is a session
to describe: that context carries aws:PrincipalArn, the account and region
keys, sts:RoleSessionName and sts:ExternalId, so a variable naming
aws:username, aws:userid or aws:PrincipalType finds nothing there, which
iam.md now says.
Two of the rules are easy to miss. Substitution is gated on "Version":
"2012-10-17", because under the older 2008-10-17, which is also the default
when the element is absent, the user guide says variables "are instead treated
as literal strings in the policy"; the version therefore rides on each parsed
statement, since statements from many documents are evaluated as one list. And
a variable with no value is not an empty string: in Resource the pattern "will
not match any resource", in NotResource that same rule excludes nothing, and
in a Condition the positive operators do not match while the inverted ones do,
which is what makes the Deny AWS documents for an unset principal tag fire.
The rest, also from the user guide: a variable resolves only in the resource
portion of an ARN, after the fifth colon; only with the string and ARN
condition operators, never Numeric, Date, Bool, IpAddress or Null; only for a
single-valued key, a multivalued one having no one value to stand in, which a
default does not rescue, since a default answers a key with no value rather
than one with several; and case-insensitively by key name, a name that holds
no space, the guide allowing one inside a quoted default and nowhere else. A
spaced name, an empty ${}, a missing brace and an unquoted default are the
forms the guide's policy checks call errors, and each stays the text it is.
${*}, ${?} and ${$} stand for a literal character, so the glob gained an
escape marker, honoured only on a pattern that came back from substitution and
stripped from whatever arrived in the policy: a document can write the marker
as a JSON escape, and reading it as one would turn a wildcard of the
document's own into a literal character and narrow the statement it sits in. A
resolved value is not escaped, matching AWS, whose policy checks warn that
variables "can be evaluated as effective wildcards".
Verified at this commit: 7442 tests across the 439 IAM, core, enforcement and
resource-policy classes the evaluator is reached from, Checkstyle and
docs-check clean. AWS's own IAMUserChangePassword document is attached to a
user and called on the request path, both of its patterns included, the second
scoping a user under a path. Each rule was probed by reverting it alone, which
is how two weak tests were found: a valueless variable beside a wildcard and
the operator restriction both needed a case whose answer flips. The escape
marker is probed from both sides, by letting the resolver keep one that
arrived in a policy and by honouring markers on every pattern rather than only
a substituted one, and each side fails a different case of the same test.
|
||
|
|
29ead624f8 |
fix(iam): authorize a Smithy RPC v2 call as the operation its route runs (#5620)
A Smithy RPC v2 call names its operation in the path, /service/<service>/operation/<operation>, not in a Query Action or an X-Amz-Target header. Enforcement found no action for it, and an unknown action is allowed, so under enforcement any known key could run any operation of SQS, SNS, DynamoDB, Kinesis, Step Functions, CloudWatch or Marketplace over RPC v2, explicit denies included. Enforcement also took the call's shape from the protocol claim, which the claim filter reads before routing, while the CBOR endpoint dispatches whatever its route matched. The two disagree in several ways: - An unrecognised smithy-protocol value leaves the call unclaimed. With strict claiming off, the default, it is still served, so an unsigned call was not refused. - An X-Amz-Target header on the call named the operation it was checked as, while the path named the one that ran. - A path with a prefix before /service/ is claimed as RPC v2 while another route serves it. The filter now reads the service and operation from the route the call reached, the values the endpoint dispatches. It authorizes that operation as the action AWS checks for it, under the serving service's namespace, and records the call's claim, so the unsigned refusal and the CBOR error format apply whatever its smithy-protocol header says. A call on any other route is handled as before. The resources and condition keys a request names in its body were read only from JSON, and a CBOR body fell back to a wildcard resource: a deny on one queue, table or stream did not apply, a grant on one did not match, and a ForAllValues dynamodb:LeadingKeys condition granted every key. The body is now read as CBOR when its content type says so, on the RPC v2 path and on the x-amz-cbor-1.1 one, which had the same gap. |
||
|
|
46f4977b23 |
fix(ses): publish to an SNS topic only when its policy allows SES (#5650)
Under IAM enforcement, SES published event-destination events and identity notifications to
whatever SNS topic it was configured with, through an internal call nothing checked, so a caller
refused sns:Publish could still put messages on a topic by pointing a configuration set at it. On
AWS, SES publishes as ses.amazonaws.com and the topic's policy decides: it has to allow SES, under
an aws:SourceArn naming the configuration set or identity whose configuration names the topic.
- ServiceCallAuthorizer decides a call one AWS service makes to another's resource on its own
behalf from the target's resource policy alone, read through the same providers the request
filter uses and picked by the target ARN's service. A target with no policy refuses, and with
enforcement off every call is allowed. ResourcePolicyProviders collects what the providers
supply, for the filter and the authorizer alike.
- IamConditionContextResolver.serviceCallContext builds that call's request context from the IAM
User Guide's global keys: aws:PrincipalIsAWSService, aws:PrincipalServiceName and
aws:PrincipalServiceNamesList, aws:SourceArn and aws:SourceAccount, aws:ResourceAccount and
aws:RequestedRegion, and none of the keys that describe an IAM principal. A publish to an SNS
topic from SES also carries aws:SourceOwner, which the SNS Developer Guide lists SES among the
services setting, and which the default topic policy checks.
- SnsResourcePolicyProvider supplies a topic's policy and the account in its ARN, also when the
topic does not exist. A topic with no Policy attribute gets the default a new topic has, for the
topic's own account. Topic policies so also take part in a JSON-protocol request that names a
topic, as any resource policy does.
- SesEventPublisher asks before publishing to SNS: for an event destination with the configuration
set's ARN, for an identity notification with the ARN of the identity that names the topic, the
sender's own or its domain's, both with the sending account. A refused event is dropped. A
notification SES cannot publish, because the topic is gone from its own account or its policy
refuses SES, also takes the topic out of the identity's bounce and complaint settings and turns
email feedback forwarding back on, as the SES Developer Guide describes; a delivery setting
stays. The identity's notification settings are written under the identity lock, so that
write and an API call changing them cannot lose each other.
- CreateReceiptRule and UpdateReceiptRule ask the same question of an action's TopicArn, with the
rule's ARN as aws:SourceArn, and answer InvalidSnsTopic when the topic's policy does not let SES
publish, which the SES API Reference lists as "could not publish to the topic, possibly due to
permissions issues". The rules still route no mail.
- A resource policy statement that names the caller only through its account, by its id, root ARN
or S3 canonical user ID, delegates to that account (IAM User Guide, "AWS account principals"):
across accounts it is still the owner's half of the grant, but within the account it no longer
grants on its own, and the caller's identity policies have to allow the request. Floci let such
a statement grant on its own, for bucket and function policies already, so a topic policy naming
its own account would have let every user of the account publish.
- A Deny's NotPrincipal follows the IAM User Guide ("AWS JSON policy elements: NotPrincipal"): it
spares an IAM caller only when it names the caller's account as well as the caller, since without
the account AWS "might deny access to the entire account", and never spares one with a permissions
boundary attached, which it "will always deny". CallerArns says whether a boundary is attached to
the user or to the role a session assumed. An Allow's NotPrincipal still grants everyone it does
not name, as Access Analyzer warns it can.
|
||
|
|
4ea7e3da23 |
fix(dynamodb): authorize every requested item return mode (#5652)
* fix(dynamodb): authorize every requested item return mode * test(dynamodb): share authorization fixtures |
||
|
|
eba058266b |
fix(iam): authorize an operation as the action AWS checks for it (#5604)
Under enforcement a request naming its operation, in a Query Action or an X-Amz-Target header, was authorized as <namespace>:<Operation>, the operation's own name. AWS authorizes some operations as an action of another name: SQS SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch as sqs:SendMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility, and SNS PublishBatch as sns:Publish. None of the batch names is an IAM action, so a policy AWS honours for a batch call was denied, and a policy naming the batch operation granted something AWS does not check. AWS publishes the mapping in the Operations of each Service Reference file. tools/aws/regen_iam_authorized_actions.py vendors the operations authorized by exactly one action of their own namespace under another name, 235 over 33 namespaces, into src/main/resources/aws/iam-authorized-actions.json. Everything else keeps its own name. The generator leaves out operations that list: - several actions, whose extras apply only when tags or a role are passed; - no action, which is missing data; - an action of another namespace; - another action while one of the operation's own name exists; - a tagging action alone; - the same action for several SDK clients, which AWS can authorize differently, as S3 and S3 Control's GetPublicAccessBlock; or whose name is listed again with another answer. A record of the wrong shape fails the run instead of being skipped. make iam-authorized-actions-check gates the file's shape on pull requests that touch it, and iam-authorized-actions-verify, run by the IAM Data Drift workflow, checks every entry against AWS. IamAuthorizedActions reads the file through the new core.common VendoredResources, rather than adding one more copy of the read-or-fail block a dozen catalogs carry, and the Query and X-Amz-Target paths ask it for the action. DynamoDB TransactGetItems, which AWS authorizes as dynamodb:GetItem, keeps its own name: the transaction check recognizes the call by it and checks every Get as dynamodb:GetItem on its own table, with its own dynamodb:LeadingKeys. Renamed, the call would skip that check and be authorized as one GetItem whose body has no top-level Key, which a ForAllValues condition accepts, so a fine-grained policy would grant every key. The check for operations AWS serves without credentials reads the Query action directly, rather than through resolve with a placeholder scope, now that resolve returns the authorized action. A Query request naming no action is not one of them. An SDK compatibility test covers SendMessageBatch and PublishBatch, granted by the single-item action and refused under the batch name, with enforcement on. |
||
|
|
287d683da7 |
feat(iam): populate aws:username, aws:userid and aws:PrincipalType (#5568)
The request context carried seven aws: keys plus aws:PrincipalArn, and none of
the three that say who is calling. A Condition matching on any of them could
not match, which is also why an IAM policy variable has nothing to resolve:
AWS's own IAMUserChangePassword policy scopes itself to user/${aws:username},
and substituting that needs the key to exist before it needs a substituter.
The values come from the user guide's principal key values list, one shape per
principal: Account with the account id for the account-root principal and for a
session token it minted, User with the user's own id for an IAM user access key
and for a session token that user minted, FederatedUser with account:name for a
GetFederationToken session, and AssumedRole with role-id:session-name for a role
session, which for a role on an EC2 instance is role-id:instance-id.
aws:username is the exception and is only published for an IAM user. The guide
is explicit: "always included in the request context for IAM users" while
"anonymous requests and requests that are made using the AWS account root user
or IAM roles do not include this key". Leaving it absent is what makes a
statement matching on it fail to match, which is the documented behaviour for a
key with no value, so the absence is the enforcement rather than a gap in it.
One judgement. The principal key values list renders the role-session type both
as AssumedRole and, twice, as "Assumed role". The unspaced form is the one that
fits the vocabulary of every other value in that list, each a single word or
CamelCase, and it is the form AWS publishes machine-side, as CloudTrail's
userIdentity.type does.
aws:userid was already derived in full by resolveCallerUserId, for every
principal type including the EC2 and ECS session-name fallbacks, so that
derivation is now a shared sessionUserId rather than a second copy inside
resolveCallerArns: reporting one key two ways is how the two readers would
drift. CallerArns carries the three values so they come from the single lookup
its javadoc already required, two lookups being able to straddle a session's
expiry, and it writes them itself, so every context a request is evaluated
against describes the same principal and there is one place that decides which
keys a principal publishes. The enforcement filter builds one context per
resource the request names and, since #5576, one per transaction item, which is
what a policy scoped to dynamodb:LeadingKeys = ${aws:userid} will need. S3
builds one of its own when s3.enforce-auth has it evaluate a bucket policy
there and then, and that one carried aws:PrincipalArn alone, so an inverted
Condition on any of the three keys held against a caller that has them and
fired a Deny the policy meant to leave alone.
Three unit tests and four integration tests, one on the transaction-item path
and one in S3's own bucket-policy class, with the existing caller-ARN
assertions widened to pin the keys for the root, federated and user-minted
session principals they already covered. Each key probed by dropping it alone:
without aws:PrincipalType or aws:userid both enforcement tests fail, without
aws:username one does, and giving a role session a username it should not have
fails the test that asserts the absence. The two contexts outside the filter
are probed the same way, each reverted to aws:PrincipalArn alone, and each
fails its own test. 4489 tests pass at this commit, across all 277 IAM and
core/common classes, the shared enforcement fixtures, and the S3 policy,
enforcement, presigned and account-context ones, the shared filter and
CallerArns reaching all of them. Checkstyle and docs-check clean.
|
||
|
|
9ab820d7f7 |
fix(iam): preserve later policy writes during rollback (#5596)
* fix(iam): preserve later policy writes during rollback * fix(iam): explain rollback ownership conflicts |