fix(sso): give resource-tag conditions the tags of the resource a request names (#8703)

The generated request resources give IAM Identity Center's instance,
permission set, application and trusted token issuer types the
aws:ResourceTag/ key, but SsoAdminService answered no tags, so a
condition on such a resource's tags saw none. SsoAdminService.storedTags
now reads them as ListTagsForResource does, in place: the resource the
ARN names, found as the handlers find it by its whole ARN, then the tags
a tagging call left on it or else its own. Its tag writes already put a
new map in place of the held one.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-17 01:00:44 -04:00
1 parent 81f484fc18
commit a00b091da2
5 files changed
+86 -6

No files matched your search

@@ -23,10 +23,11 @@ import java.util.Optional;
* connections and API destinations; Application Auto Scaling, for its scalable targets; Redshift Data, for the
* Redshift Serverless workgroups it runs statements on and the targets of its sessions; Payment Cryptography, for
* the key an alias names; EMR, for the clusters of its instance groups and a tag call's resource and the tags of a
* cluster; IAM Identity Center, for the accounts its permission sets are provisioned to; Resource Explorer, for its
* default view; OAM and RAM, for the sinks, invitations and shares of other accounts they act on; Secrets Manager,
* for the secret a name or an ARN names, random suffix included, and its tags; EventBridge Scheduler, for its
* default schedule group and its groups' tags;
* cluster; IAM Identity Center, for the accounts its permission sets are provisioned to and the tags of an instance,
* a permission set, an application or a trusted token issuer; Resource Explorer, for its default view; OAM and RAM,
* for the sinks, invitations and shares of other accounts they act on; Secrets Manager, for the secret a name or an
* ARN names, random suffix included, and its tags; EventBridge Scheduler, for its default schedule group and its
* groups' tags;
* CloudFormation, for the stack or the stack set a name names, whose id it minted, and the tags of a stack, a stack set
* or a change set; S3 Tables, for the table a request names by its table bucket, namespace and name, and the tags of a
* table bucket or a table; Lambda, for the layer version a layer version ARN selects, the image of a MicroVM and the
@@ -1963,6 +1963,31 @@ public class SsoAdminService implements Resettable, StoredResourceArns {
return Optional.empty();
}
/**
* The tags held on the instance, permission set, application or trusted token issuer {@code arn} names, as
* ListTagsForResource reads them: the tags a tagging call left on it, else the resource's own; read in place where
* the handlers find these resources, by their whole ARN. Empty for an ARN naming nothing stored.
*/
@Override
public Map<String, String> storedTags(String arn) {
Map<String, String> tags;
try {
TaggableResource resource = resolveTaggableResource(arn);
tags = resourceTagOverrides.get(arn).orElseGet(resource::tags);
} catch (AwsException notStored) {
return Map.of();
}
Map<String, String> held = new LinkedHashMap<>();
if (tags != null) {
tags.forEach((key, value) -> {
if (key != null && value != null) {
held.put(key, value);
}
});
}
return held;
}
private void ensurePermissionSetProvisioned(String permissionSetArn, String accountId) {
String key = permissionSetArn + "::" + accountId;
PermissionSet permissionSet = permissionSetForPortal(permissionSetArn);