Files
floci/.github
Hector Ventura d72923ab33 fix(core): compare ARN partitions with the resource's region, not the literal aws (#4791)
* fix(core): compare ARN partitions with the resource's region, not the literal aws

Part of #4272 (P10b). Running the Java SDK suite against a Floci deployed in
cn-north-1 (#4790) found five checks comparing a parsed ARN with "aws" and a
seeded ARN fixed to the commercial partition:

- RdsService.hasRdsResourceIdentity required partition aws, so DB instances,
  clusters, DB and cluster snapshots and subnet groups created outside aws
  failed their own ownership check and were not found right after creation.
  The proxy target group check had the same comparison, and CopyDBSnapshot
  refused any source ARN outside aws; it now requires the target region's
  partition, since a snapshot copies within its partition.
- ElastiCache ListTagsForResource rejected every arn:aws-cn: ARN; it now
  expects the request region's partition and names it in the message.
- RAM ignored organization principals outside aws; any published partition is
  accepted, the organization id ties the principal to the caller's.
- The seeded IAM Identity Center instance was arn:aws:sso:::instance/... in
  every deployment, so China permission sets never found it. It now takes the
  partition of the deployment's home region, and AddRegion compares against
  the instance's own primary region instead of a fixed us-east-1.

* fix(sso): move a persisted bootstrap instance to its partition, and drop the fixed China allowlist entries

Greptile on #4791: a deployment persisted before the seeded instance took its
partition keeps it as arn:aws:sso:::instance/..., while its permission sets were
already minted in the instance's own partition, so the fix would not reach it.
ensureBootstrapInstance now rewrites a stored bootstrap instance whose ARN is
not in its primary region's partition.

pgermosen on #4791: with #4790 on main, the cn-north-1 allowlist entries this
fixes would turn stale and fail the nightly. Measured against this branch in
cn-north-1: CloudFormationRdsDynamicReferenceTest, the ten RdsControlPlaneTest
entries, RdsJdbcCompatTest#createDbInstanceAndConnectWithPassword and
SsoPortalTest now pass and are deleted. The four IAM-token connection tests
still fail because they sign their tokens for a pinned us-east-1, which a
cn-north-1 database rightly refuses; they move to the group of tests that pin
commercial values.

* fix(ram): answer the listing operations for the request's region only

Greptile on #4791: with organization principals accepted in every partition,
a commercial GetResourceShares from a member of the organization returned a
China share. The cause predates this PR: GetResourceShares, ListResources,
ListPrincipals and GetResourceShareInvitations walked every stored share, so
a share created in eu-west-1 was listed through us-east-1 too, while a
resource share is a regional resource. RamController now passes the request
region and the four operations keep only shares (and invitations to shares)
in it, which also keeps a share out of another partition.

* fix(ram): resolve a share or invitation to mutate in the request's region only

pgermosen on #4791: after the listings were scoped to the request's region,
findOwnedShare still walked every stored share, so a share invisible to
GetResourceShares in one region could still be deleted, updated, associated,
disassociated or retagged from there; AssociateResourceShare would add a
resource the same endpoint's ListResources does not report. Accept and
RejectResourceShareInvitation had the same gap.

The six share mutations and the two invitation responses now take the request
region from RamController and resolve only a share or invitation in it: one
from another region gets UnknownResourceException or
ResourceShareInvitationArnNotFoundException, like an ARN that does not exist.
2026-10-01 21:00:35 -04:00
..