From bca36ce5b5aca629fd0bd75e5dec7f064a741a69 Mon Sep 17 00:00:00 2001
From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
Date: Sun, 15 Nov 2026 19:10:14 -0400
Subject: [PATCH] fix(scheduler): give resource-tag conditions the tags of the
schedule group a request names (#8517)
The generated request resources give Scheduler's schedule-group type
aws:ResourceTag/ keys, but SchedulerService did not answer storedTags, so a
condition on a schedule group's tags saw none. SchedulerService.storedTags
now reads the one group entry in the account and Region the ARN names and
gives its tags, matched on the whole ARN, reading only; a group stored before
storage was account-aware is read in place for the default account, and the
default group has none until a request stores it.
Tagging and untagging now put a new tag map in place of the group's, taking
turns on the group, and the field is volatile, so the lookup, and the
existing tag listing, always copies one whole set nothing changes after.
---
docs/services/iam.md | 4 +-
.../aws/core/common/StoredResourceArns.java | 6 +--
.../services/scheduler/SchedulerService.java | 47 +++++++++++++++++--
.../scheduler/model/ScheduleGroup.java | 2 +-
...amRestRouteEnforcementIntegrationTest.java | 20 ++++++++
.../scheduler/SchedulerServiceTest.java | 46 ++++++++++++++++++
6 files changed, 114 insertions(+), 11 deletions(-)
diff --git a/docs/services/iam.md b/docs/services/iam.md
index b02e1c60eb..dc16af3c15 100644
--- a/docs/services/iam.md
+++ b/docs/services/iam.md
@@ -3071,8 +3071,8 @@ floci populates:
its type (`aws:ResourceTag/`, `secretsmanager:ResourceTag/`), which `regen_iam_request_resources.py`
reads from the Service Reference for every namespace it reads, valued from the tags the type's service
holds on that resource (`StoredResourceArns.storedTags`); a service that holds none leaves them absent.
- Secrets Manager answers for its secrets, and S3 Tables for its table buckets and tables. Tag keys differing
- only in case are one condition key holding every value.
+ Secrets Manager answers for its secrets, S3 Tables for its table buckets and tables, and EventBridge
+ Scheduler for its schedule groups. Tag keys differing only in case are one condition key holding every value.
- EC2 resource keys such as a network interface's `ec2:Vpc`, `ec2:Subnet`, `ec2:AvailabilityZone` and
`ec2:NetworkInterfaceID`: for every action on a resource EC2 holds, the members of the resource the
key names, an ARN for a key the Service Reference types as one. `resourceKeys` in
diff --git a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
index 5978e5f7fd..4aec68e485 100644
--- a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
+++ b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
@@ -25,9 +25,9 @@ import java.util.Optional;
* the key an alias names; EMR, for the clusters of its instance groups; 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; CloudFormation, for
- * the stack or the stack set a name names, whose id it minted; 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); looked up lazily by
+ * 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; 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); looked up lazily by
* {@code ResourceArnBuilder} and {@code IamConditionContextResolver} through {@code Instance} for
* the namespace a request or an ARN is of, so IAM never depends on that service directly.
*
diff --git a/src/main/java/io/floci/aws/services/scheduler/SchedulerService.java b/src/main/java/io/floci/aws/services/scheduler/SchedulerService.java
index da80242836..29113830a8 100644
--- a/src/main/java/io/floci/aws/services/scheduler/SchedulerService.java
+++ b/src/main/java/io/floci/aws/services/scheduler/SchedulerService.java
@@ -25,6 +25,7 @@ import org.jboss.logging.Logger;
import java.time.DateTimeException;
import java.time.Instant;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -41,6 +42,7 @@ public class SchedulerService implements StoredResourceArns {
"arn:(?:" + AwsArnUtils.PARTITION_REGEX + "):iam::\\d{12}:role/[\\w+=,.@/-]+");
private static final String ROLE_ARN_MODEL_PATTERN = "^arn:aws(-[a-z]+)?:iam::\\d{12}:role\\/[\\w+=,.@\\/-]+$"; // partition-literal: the Scheduler model's RoleArn pattern, quoted verbatim in the error message
private static final String DEFAULT_GROUP = "default";
+ private static final String GROUP_RESOURCE = "schedule-group/";
// ListScheduleGroups and ListSchedules model MaxResults as 1-100 and NextToken as 1-2048 chars.
private static final int MAX_PAGE_SIZE = 100;
private static final int MAX_TOKEN_LENGTH = 2048;
@@ -95,6 +97,31 @@ public class SchedulerService implements StoredResourceArns {
return "schedule-group".equals(type) ? Optional.of(buildGroupArn(region, DEFAULT_GROUP)) : Optional.empty();
}
+ /**
+ * The tags of the schedule group stored under {@code arn}, in the account and Region the ARN names, by key, which
+ * IAM gives a resource-tag condition; empty when there is none, the default group before a request stores it among
+ * them. Reads that one group's entry, a pre-multi-account one of the default account in place, and matches it on
+ * the whole ARN, leaving it as it is.
+ */
+ @Override
+ public Map storedTags(String arn) {
+ if (!AwsArnUtils.isArnFor(arn, "scheduler")) {
+ return Map.of();
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ if (!parsed.resource().startsWith(GROUP_RESOURCE)) {
+ return Map.of();
+ }
+ String key = groupKey(parsed.region(), parsed.resource().substring(GROUP_RESOURCE.length()));
+ String account = parsed.accountId();
+ Optional group = groupStore instanceof AccountAwareStorageBackend aware
+ ? aware.getForAccount(account, key).or(() -> aware.getLegacyForAccount(account, key))
+ : groupStore.get(key);
+ return group.filter(stored -> arn.equals(stored.getArn()))
+ .