mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode GetCallerIdentity's root fallback, the AssumeRole family's session ARNs, the OIDC provider ARN and GetFederationToken built their ARNs with an empty region, which falls back to the commercial partition, so they carried arn:aws: whatever partition the request signed. They now go through RegionResolver.buildGlobalArn. GetAccountSummary reports GlobalEndpointTokenVersion only where the partition publishes a global STS host, which is aws alone. floci.partitions.strict (FLOCI_PARTITIONS_STRICT, default false) refuses a request signed for a service AWS publishes in another partition but not in the request's one (CloudFront in GovCloud, IAM in aws-eusc) with the unknown-service guard's 404, mirroring the host that never resolves on AWS. endpoints.json omits the services that ship only an endpoint ruleset, so a service the data lists nowhere is served everywhere. Credential scopes carry signing names, and 46 of them differ from the endpoints.json keys they cover (73 keys, such as ecr for api.ecr); regen_partitions.py vendors that map as signingNames and AwsPartition.offersSigningName joins it. Part of #4272 * fix(core): read the gzipped botocore models the pip package ships when collecting signing names The botocore wheel ships each service model as service-2.json.gz, while the checkout under local/aws/botocore ships it plain. collect_signing_names looked only for the plain file, so in CI, which resolves botocore to the installed package, it found no models, generated an empty signingNames and failed aws-data-check against the committed map. It now reads either form, as regen_dynamodb_shapes.py already does. * fix(sts): keep an assumed-role session in its role's partition, and answer strict-mode Query requests in XML GetCallerIdentity rebuilt an assumed-role session's ARN with an empty region, which falls back to the commercial partition, so a session AssumeRole issued as arn:aws-cn:sts:: came back as arn:aws:sts::, and a chained AssumeRole was then refused by a China trust policy as a caller from another partition. The session ARN now takes the partition its role ARN names. Strict partition mode refused a form-encoded Query request (IAM in aws-eusc) with a JSON body; it now returns the Query XML error the unknown-region guard beside it already returns for such requests. * fix(iam): mint IAM resource ARNs in the request's partition and keep them there CreateUser, CreateGroup, CreateRole, CreatePolicy, CreateInstanceProfile and CreateOpenIDConnectProvider minted arn:aws: whatever partition the request signed, while STS now followed the request. Under China that denied AssumeRoleWithWebIdentity (the trust policy names the arn:aws: provider ARN CreateOpenIDConnectProvider returned, matched against arn:aws-cn:), and AssumeRole reported the request's partition while GetCallerIdentity reported the role's. An IAM resource is now created in the request's partition and keeps it: UpdateUser and UpdateGroup re-mint in the stored ARN's partition. Anything derived from a stored role follows the role: all three AssumeRole handlers, resolveCallerArn and the web identity OIDC provider ARN take the role ARN's partition through AwsArnUtils.partitionOrDefault. The credential report's root row takes the request's partition. * fix(sts): mint a session from the stored role, and keep one credential report per partition AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML find the role by account and name, but minted the session ARN from the RoleArn the request named. A China role assumed with an arn:aws: RoleArn therefore came back as an arn:aws:sts:: session, while AssumeRole registered the session under the stored role's ARN, so GetCallerIdentity reported aws-cn. All three handlers now mint the session from the stored role's ARN when the role exists and register it under the same ARN. The credential report was cached once per account, so a report generated for one partition was handed to a caller in another for four hours, with the wrong partition's root row. It is now kept per partition.