fix(iam): grant a delegation request's holder what the guide gives it (#8531)

Under enforcement, the identity that owns a delegation request was denied every
operation on it unless a policy named them, so a customer who claimed a request
could not read it, forward it, reject it or release its token without being
granted each one. AWS grants those by default. The customer page's note, under
"Managing Permissions for Delegation Requests", reads "By default, IAM
principals who initiate a delegation request are automatically granted
permissions to manage that specific request. They can associate it with their
account, view request details, reject a request, forward it to an administrator
for approval, release the exchange token to the product provider after admin
approval, and list delegation requests that they own."

So the holder now carries a grant over the requests it owns:
GetDelegationRequest with GetHumanReadableSummary, UpdateDelegationRequest,
which is the forward, RejectDelegationRequest and SendDelegationToken on those
requests, and ListDelegationRequests. The summary sits beside the read because
the reference puts it there itself: its "rules are identical to
GetDelegationRequest API behavior, such that a party who has permissions to call
GetDelegationRequest for a given delegation request will always be able to
retrieve the human readable summary for that request".

Listing names no resource, the Service Reference giving that action none, and is
scoped by the condition key the same reference publishes on it:
iam:DelegationRequestOwner, under ArnEquals, held to the owner's own ARN. That
is the line the guide draws between its two listing permissions, the table's
"List delegation requests for your account", which an administrator grants, and
the note's "list delegation requests that they own", which an owner has without
one. So an owner names itself in OwnerId and is answered with its own requests,
while naming another owner, or naming none, is refused, and the account's whole
listing stays with the granted permission. The key is read from the request's
OwnerId member through the IAM condition-key table, which names the member for
the pair so that the table's own gates re-derive it. The seven other delegation
actions the reference lists that key on take its value from the stored request
rather than from a parameter, so they stay unread.

The grant reaches whoever claimed the request, user or role session alike:
AssociateDelegationRequest stores "the ARN of the current calling identity", so
a session is recorded under its own assumed-role ARN and is looked up by that
rather than by the role it assumed. It is read where an identity's policies are
assembled, beside the password self-service grant that works the same way, so a
live request, a simulation and the user's access report all see it.

That lookup runs wherever policies are assembled, so on every authorized
request and not only on a delegation one. It answers an empty store without
reading it, and otherwise from a view of who owns what that one scan builds and
any stored write invalidates whole, so the usual answer costs a lookup rather
than a scan of every record in every account. Invalidating the view whole is
what keeps it true: nothing updates it in place, so a claim, an expiry and a
reload all land the same way. An emulator reset wipes the backend without a
request passing through that one method, so the service is Resettable and drops
the view in clear(), which makes the invariant a hook rather than a
coincidence of the store being empty afterwards.

Two abilities the note names are left out, each for its own reason. Approving is
not implicit: the same page lists iam:AcceptDelegationRequest among the
permissions an administrator grants, which is the step the flow keeps for one.
Associating cannot be granted here at all, because a request records no owner
until it is claimed, so before the claim there is no identity to write a grant
for; the claim still needs a permission and everything after it does not.

The ownership itself comes through a port rather than a new dependency:
DelegationRequestOwnership, implemented by DelegationRequestService and asked by
IamService, which is how ScpProvider and ResourcePolicyProvider are declared so
that IAM does not reach into another store.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-15 23:51:05 -04:00
1 parent e6f57d849d
commit 53ef87af1c
11 files changed
+621 -54

No files matched your search

@@ -0,0 +1,27 @@
package io.floci.aws.services.iam;
import java.util.List;
/**
* Which delegation requests an identity owns, asked by the policy set rather than by a handler.
*
* <p>The customer-side guide says of these requests that "By default, IAM principals who initiate a
* delegation request are automatically granted permissions to manage that specific request", naming
* what that covers: viewing the request, rejecting it, forwarding it to an administrator for
* approval, releasing the exchange token after approval, and listing the requests they own. So the
* grant is per request rather than per account, and the policy set has to know which requests the
* caller holds before it can write one.
*
* <p>Declared as a port so {@link IamService} does not depend on the delegation store it would
* otherwise have to read, the way {@code ScpProvider} and {@code ResourcePolicyProvider} are
* declared for the same reason. {@link DelegationRequestService} implements it.
*/
public interface DelegationRequestOwnership {
/**
* The ids of the requests {@code ownerArn} owns in {@code accountId}, newest first is not
* promised and order does not matter: the grant names them all. Empty when the identity owns
* none, which is every caller who has claimed no request.
*/
List<String> requestIdsOwnedBy(String accountId, String ownerArn);
}
@@ -6,6 +6,7 @@ import io.floci.aws.core.common.AwsArnUtils;
import io.floci.aws.core.common.AwsException;
import io.floci.aws.core.common.AwsRegionFacts;
import io.floci.aws.core.common.AwsRegions;
import io.floci.aws.core.common.Resettable;
import io.floci.aws.core.storage.AccountAwareStorageBackend;
import io.floci.aws.core.storage.StorageFactory;
import io.floci.aws.services.iam.model.DelegationPermission;
@@ -20,10 +21,14 @@ import java.time.Clock;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HexFormat;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
/**
@@ -57,7 +62,7 @@ import java.util.regex.Pattern;
* announces the expiry, which is why they are published in a finally rather than on the way out.
*/
@ApplicationScoped
public class DelegationRequestService {
public class DelegationRequestService implements DelegationRequestOwnership, Resettable {
/** {@code delegationRequestIdType}, and the "dr-" prefix the reference's own examples carry. */
private static final String ID_PREFIX = "dr-";
@@ -136,6 +141,12 @@ public class DelegationRequestService {
*/
private final Object requestLock = new Object();
/** Bumped on every stored change, so a view of who owns what can tell that it is stale. */
private final AtomicLong ownershipVersion = new AtomicLong();
/** The last view built, with the version it was built from; null until one is built. */
private final AtomicReference<OwnedRequests> ownedRequests = new AtomicReference<>();
/**
* The permissions boundaries registered for each partner account, which a request this partner
* files carries. AWS registers them out of band and reports them on the request rather than
@@ -538,6 +549,66 @@ public class DelegationRequestService {
}
}
/** An owner, as ownership records one: the account a request was claimed in and the identity. */
private record Owner(String accountId, String arn) {}
/** Every owner's request ids as one scan found them, with the version that scan read. */
private record OwnedRequests(long version, Map<Owner, List<String>> ids) {}
/**
* The requests an identity owns, for the grant the policy set writes from them. It reads the
* same ownership the lifecycle records, an owner being whoever claimed the request, and asks
* nothing of state: a rejected or expired request is still theirs to read and list, and the
* operations that would move it refuse on its state rather than on permission.
*
* <p>This is called wherever a caller's policies are assembled, so on every authorized
* request and not only on a delegation one. It answers an empty store without reading it, and
* otherwise from a view of who owns what that one scan builds and any stored change
* invalidates whole, so the usual answer costs a lookup rather than a scan of every record in
* every account.
*
* <p>A scan is what gets cached rather than replaced because there is no account to read
* instead: a request is stored under the account that asked for it while ownership names the
* account that claimed it. And invalidating the whole view is what keeps it true, where an
* index maintained in place would be a second copy of the store to keep in step with every
* claim, expiry and reload.
*/
@Override
public List<String> requestIdsOwnedBy(String accountId, String ownerArn) {
if (accountId == null || ownerArn == null || requests.isEmptyInAllAccounts()) {
return List.of();
}
return ownership().getOrDefault(new Owner(accountId, ownerArn), List.of());
}
/**
* Who owns what, from the last scan still current, or from a fresh one. A scan that a write
* overtook answers this caller and is not kept, so the next caller reads the store again
* rather than a view of the moment before that write.
*/
private Map<Owner, List<String>> ownership() {
long version = ownershipVersion.get();
OwnedRequests cached = ownedRequests.get();
if (cached != null && cached.version() == version) {
return cached.ids();
}
Map<Owner, List<String>> owned = new HashMap<>();
for (DelegationRequest request : requests.scanAllAccounts()) {
if (request.getOwnerAccountId() == null || request.getOwnerId() == null
|| request.getDelegationRequestId() == null) {
continue;
}
owned.computeIfAbsent(new Owner(request.getOwnerAccountId(), request.getOwnerId()),
owner -> new ArrayList<>()).add(request.getDelegationRequestId());
}
owned.replaceAll((owner, ids) -> List.copyOf(ids));
Map<Owner, List<String>> view = Map.copyOf(owned);
if (ownershipVersion.get() == version) {
ownedRequests.compareAndSet(cached, new OwnedRequests(version, view));
}
return view;
}
private List<DelegationRequest> visibleToOwner(String callerAccountId, String ownerId,
Instant now,
List<DelegationNotifier.Notice> notices) {
@@ -708,8 +779,22 @@ public class DelegationRequestService {
+ " hours or less. Approve it as an IAM user or role instead.", 403);
}
/**
* A reset wipes the backend without a request passing through {@link #put}, so the view of who
* owns what is dropped here rather than left to outlive what it was built from. The store is
* already wiped by the time this runs, which is why nothing else is cleared.
*/
@Override
public void clear() {
ownershipVersion.incrementAndGet();
ownedRequests.set(null);
}
private void put(DelegationRequest request) {
requests.putForAccount(request.getRequestorId(), request.getDelegationRequestId(), request);
// Every stored change makes a view of who owns what stale, and saying so here is the whole
// of keeping that view true: it is the one place a request reaches the store from.
ownershipVersion.incrementAndGet();
}
private void validatePermissions(DelegationPermission permissions) {
@@ -3179,13 +3179,14 @@ public class IamQueryHandler {
IamUser user = requireMatchingArn(iamService.getUser(parsed.name()).getArn(), arn,
iamService.getUser(parsed.name()));
// The report lists "every AWS service that the resource could access using
// permissions policies", so a permission the account applies to its users without
// attaching it counts: a user with no policies of their own still reaches IAM
// while the password policy allows self-service. It is added to the documents the
// service list is read from rather than to policiesForIdentity, since it is no
// policy of the user's and has no name or ARN to report as one.
// permissions policies", so a permission applied to a user without being attached
// counts: a user with no policies of their own still reaches IAM while the
// password policy allows self-service, and still reaches the delegation requests
// it owns. These are added to the documents the service list is read from rather
// than to policiesForIdentity, since they are no policies of the user's and have
// no name or ARN to report as one.
List<String> documents = new ArrayList<>(identityPolicyDocuments(accountId, arn));
documents.addAll(iamService.accountLevelUserGrants(accountId));
documents.addAll(iamService.implicitUserGrants(accountId, arn));
yield new AccessAdvisorTarget(documents, List.of(entityOf(user)));
}
case "role" -> {
@@ -145,6 +145,47 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
+ "\"Resource\":[\"%s\",\"%s\"]},"
+ "{\"Effect\":\"Allow\",\"Action\":\"iam:GetAccountPasswordPolicy\","
+ "\"Resource\":\"*\"}]}";
/**
* What the customer-side guide grants the holder of a delegation request: "By default, IAM
* principals who initiate a delegation request are automatically granted permissions to manage
* that specific request. They can associate it with their account, view request details, reject
* a request, forward it to an administrator for approval, release the exchange token to the
* product provider after admin approval, and list delegation requests that they own."
*
* <p>So the actions are the ones that note names, each on the requests the caller owns, and
* approving is not among them: the page lists {@code iam:AcceptDelegationRequest} as a
* permission an administrator grants, which is the step this grant deliberately leaves to one.
* The summary rides along with reading the request, which the API reference states outright:
* {@code GetHumanReadableSummary}'s "rules are identical to GetDelegationRequest API
* behavior, such that a party who has permissions to call GetDelegationRequest for a given
* delegation request will always be able to retrieve the human readable summary for that
* request", so the two are granted together or the summary would be refused to the one
* identity the note says may read the request.
*
* <p>Listing carries no resource of its own, the Service Reference giving
* {@code ListDelegationRequests} no resource type, so the statement is written on {@code *}
* and scoped by the condition key that reference does publish for it,
* {@code iam:DelegationRequestOwner}, held to the owner's own ARN. That is the difference the
* guide draws between the two permissions: the one an administrator grants is "List
* delegation requests for your account", while the one an owner carries without a policy is
* to "list delegation requests that they own". So an owner's call names itself as
* {@code OwnerId} and is answered, one that names another owner or no owner at all is
* refused, and an account-wide listing stays with the granted permission. The key's published
* type is ARN, hence {@code ArnEquals}.
*
* <p>Associating cannot be granted here at all: a request records no owner until it is
* claimed, so there is nobody to write a grant for before the claim. That is a documented
* limit of this reading rather than a decision about the operation.
*/
private static final String DELEGATION_OWNER_GRANT =
"{\"Version\":\"2012-10-17\",\"Statement\":["
+ "{\"Effect\":\"Allow\",\"Action\":[\"iam:GetDelegationRequest\","
+ "\"iam:GetHumanReadableSummary\",\"iam:RejectDelegationRequest\","
+ "\"iam:UpdateDelegationRequest\",\"iam:SendDelegationToken\"],"
+ "\"Resource\":[%s]},"
+ "{\"Effect\":\"Allow\",\"Action\":\"iam:ListDelegationRequests\","
+ "\"Resource\":\"*\",\"Condition\":{\"ArnEquals\":"
+ "{\"iam:DelegationRequestOwner\":\"%s\"}}}]}";
private static final String DEFAULT_DEPLOYER_USER = "floci-deployer";
private static final String DEFAULT_DEPLOYER_ACCESS_KEY_ID = "floci";
private static final String DEFAULT_DEPLOYER_SECRET_ACCESS_KEY = "floci";
@@ -459,6 +500,13 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
@Inject
Instance<ScpProvider> scpProvider;
/**
* Which delegation requests an identity owns, for the grant the guide gives its holder. Absent
* in a unit test that builds this service directly, which then writes no such grant.
*/
@Inject
Instance<DelegationRequestOwnership> delegationRequestOwnership;
/**
* The service control policy levels that cap {@code accountId}, or null when SCPs do not apply
* to it, for callers that evaluate a principal outside the request filter.
@@ -5593,7 +5641,14 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
: List.of(SCOPED_IDENTITY_SESSION_BASE_POLICY, session.getSessionPolicyDocument()),
null, null);
}
List<String> identityPolicies = collectRolePolicies(session.getRoleArn());
// A session that claimed a delegation request is recorded as its owner under its own
// assumed-role ARN, AssociateDelegationRequest storing "the ARN of the current calling
// identity", so the owner grant is looked up by that ARN and not by the role's.
String sessionAccount = AwsArnUtils.accountOrDefault(session.getRoleArn(),
regionResolver.getAccountId());
List<String> identityPolicies = withDelegationOwnerGrant(
collectRolePolicies(session.getRoleArn()), sessionAccount,
assumedRoleSessionArn(session, session.getRoleArn()));
String boundaryDoc = resolveRoleBoundaryDocument(session.getRoleArn());
return new CallerContext(identityPolicies, session.getSessionPolicyDocument(), boundaryDoc);
}
@@ -5889,18 +5944,7 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
return Optional.of(new CallerArns(roleArn, roleArn, CallerArns.TYPE_ACCOUNT,
AwsArnUtils.accountOrDefault(roleArn, regionResolver.getAccountId()), null));
}
String roleName = roleArn.contains("/") ? roleArn.substring(roleArn.lastIndexOf('/') + 1) : "UnknownRole";
String accountId = AwsArnUtils.accountOrDefault(roleArn, regionResolver.getAccountId());
String sessionName = session.getRoleSessionName();
if (sessionName == null) {
sessionName = session.getEc2InstanceId() != null
? session.getEc2InstanceId() : "floci-session";
}
// The session lives in its role's partition, as AssumeRole issued it, whatever region
// a later call is signed for.
String partition = AwsArnUtils.partitionOrDefault(roleArn, regionResolver.getPartition());
String sessionArn = AwsArnUtils.Arn.global(partition, "sts", accountId,
"assumed-role/" + roleName + "/" + sessionName).toString();
String sessionArn = assumedRoleSessionArn(session, roleArn);
Optional<IamRole> role = roleFromArnOrName(roleArn);
return Optional.of(new CallerArns(sessionArn, roleArn, CallerArns.TYPE_ASSUMED_ROLE,
sessionUserId(session).orElse(null), null,
@@ -5960,6 +6004,27 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
* list gives the kind of principal that holds it. Shared with {@link #resolveCallerArns}, which
* reports the same key for the same credential and must not derive it a second way.
*/
/**
* The ARN a role session acts as: the {@code assumed-role} ARN, not the role's own. It is the
* identity its calls are recorded under, which is why a grant written for what a session owns
* has to be looked up by this ARN rather than by the role that was assumed.
*
* <p>The session lives in its role's partition, as AssumeRole issued it, whatever region a
* later call is signed for.
*/
private String assumedRoleSessionArn(SessionCredential session, String roleArn) {
String roleName = roleArn.contains("/") ? roleArn.substring(roleArn.lastIndexOf('/') + 1) : "UnknownRole";
String accountId = AwsArnUtils.accountOrDefault(roleArn, regionResolver.getAccountId());
String sessionName = session.getRoleSessionName();
if (sessionName == null) {
sessionName = session.getEc2InstanceId() != null
? session.getEc2InstanceId() : "floci-session";
}
String partition = AwsArnUtils.partitionOrDefault(roleArn, regionResolver.getPartition());
return AwsArnUtils.Arn.global(partition, "sts", accountId,
"assumed-role/" + roleName + "/" + sessionName).toString();
}
private Optional<String> sessionUserId(SessionCredential session) {
if (session.getDelegatedApproverArn() != null) {
return delegatedApproverUserId(session.getDelegatedApproverArn());
@@ -6270,25 +6335,80 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
// The flag that answers is the user's own account's, which is the account the lookup above
// resolved them in: a PolicySourceArn may name another account's user, and that user
// carries whatever their own account's password policy says, never this one's.
Optional<String> grant = passwordSelfServiceGrant(
AwsArnUtils.accountOrDefault(userArnOrName, regionResolver.getAccountId()));
if (grant.isEmpty()) {
String account = AwsArnUtils.accountOrDefault(userArnOrName, regionResolver.getAccountId());
Optional<String> grant = passwordSelfServiceGrant(account);
Optional<String> delegationGrant = delegationOwnerGrant(account, userArnOrName);
if (grant.isEmpty() && delegationGrant.isEmpty()) {
return docs;
}
List<String> withGrant = new ArrayList<>(docs);
grant.ifPresent(withGrant::add);
delegationGrant.ifPresent(withGrant::add);
return withGrant;
}
/**
* The grant the holder of a delegation request carries over that request, or empty for an
* identity that owns none. See {@link #DELEGATION_OWNER_GRANT} for what the guide gives them
* and what it leaves to a granted permission.
*
* <p>The principal is whoever claimed the request, which is an IAM user's ARN or a role
* session's {@code assumed-role} ARN, so a name is resolved to a user's ARN first and anything
* else is already the ARN its calls record. A simulation of a role is the one caller this
* cannot answer for: {@code PolicySourceArn} names the role, never one of its sessions, and
* the owner recorded is the session, so there is no ARN to match.
*/
private Optional<String> delegationOwnerGrant(String accountId, String principalArnOrName) {
if (delegationRequestOwnership == null || delegationRequestOwnership.isUnsatisfied()) {
return Optional.empty();
}
String ownerArn = userFromArnOrName(principalArnOrName).map(IamUser::getArn)
.orElse(principalArnOrName);
List<String> owned = delegationRequestOwnership.get().requestIdsOwnedBy(accountId, ownerArn);
if (owned.isEmpty()) {
return Optional.empty();
}
String resources = owned.stream()
.map(id -> "\"" + regionResolver.buildGlobalArn("iam", accountId,
"delegation-request/" + id) + "\"")
.collect(Collectors.joining(","));
return Optional.of(DELEGATION_OWNER_GRANT.formatted(resources, ownerArn));
}
/**
* {@code documents} with the delegation owner grant beside them, for a principal that holds a
* request. Returns the list unchanged when it owns none, and {@code null} when the principal
* itself was not found, as the collectors answer for an identity that does not exist.
*/
private List<String> withDelegationOwnerGrant(List<String> documents, String accountId,
String principalArn) {
if (documents == null) {
return null;
}
Optional<String> grant = delegationOwnerGrant(accountId, principalArn);
if (grant.isEmpty()) {
return documents;
}
List<String> withGrant = new ArrayList<>(documents);
withGrant.add(grant.get());
return withGrant;
}
/**
* The account-level grants an IAM user of {@code accountId} is authorized by without holding a
* policy of its own, which today is the password self-service grant alone. Separate from
* {@link #userIdentityPolicies} because a caller reporting on a user needs these without the
* user's own documents, and because "the policies attached to a user" and "what the user can
* reach" are different questions that AWS answers from different sets.
* The grants an IAM user is authorized by without holding a policy of its own: the account's
* password self-service grant, and the owner grant over whatever delegation requests the user
* holds. Separate from {@link #userIdentityPolicies} because a caller reporting on a user
* needs these without the user's own documents, and because "the policies attached to a user"
* and "what the user can reach" are different questions that AWS answers from different sets.
*
* <p>Both belong here for the same reason: a report that left them out would answer that a
* user with no attached policy reaches nothing, while authorization lets it reach IAM.
*/
public List<String> accountLevelUserGrants(String accountId) {
return passwordSelfServiceGrant(accountId).map(List::of).orElseGet(List::of);
public List<String> implicitUserGrants(String accountId, String userArnOrName) {
List<String> grants = new ArrayList<>();
passwordSelfServiceGrant(accountId).ifPresent(grants::add);
delegationOwnerGrant(accountId, userArnOrName).ifPresent(grants::add);
return List.copyOf(grants);
}
/**
@@ -392,26 +392,29 @@ public class ResourceArnBuilder {
* {@code CreateServiceLinkedRole}, an access key id for {@code GetAccessKeyLastUsed}, a
* deletion task id for {@code GetServiceLinkedRoleDeletionStatus}, an Organizations
* entity path for {@code GenerateOrganizationsAccessReport}, whose resource lives in another
* service's tree, and a request id for the five delegation actions that name one.
* service's tree, and a request id for the six delegation actions that name one.
*
* <p>The resolver is the value rather than a branch elsewhere, so this cannot become a list
* that says an action is handled while the dispatch has nothing for it. The keys are also what
* {@code IamActionResourcesTest} reads to tell a type one of these covers from a type nothing
* resolves.
*/
static final Map<String, DerivedResolver> DERIVED_RESOLVERS = Map.of(
"CreateServiceLinkedRole", ResourceArnBuilder::serviceLinkedRoleArn,
"GetAccessKeyLastUsed",
(self, ctx, region, accountId) -> self.accessKeyOwnerArn(ctx, accountId),
"GetServiceLinkedRoleDeletionStatus", ResourceArnBuilder::deletionTaskRoleArn,
"GenerateOrganizationsAccessReport",
ResourceArnBuilder::organizationsAccessReportArn,
"AssociateDelegationRequest", ResourceArnBuilder::delegationRequestArn,
"AcceptDelegationRequest", ResourceArnBuilder::delegationRequestArn,
"RejectDelegationRequest", ResourceArnBuilder::delegationRequestArn,
"GetDelegationRequest", ResourceArnBuilder::delegationRequestArn,
"SendDelegationToken", ResourceArnBuilder::delegationRequestArn,
"GetHumanReadableSummary", ResourceArnBuilder::summarizedRequestArn);
// Map.ofEntries rather than Map.of: this map passed ten pairs when the forward action gained
// its resource, and Map.of has no overload beyond ten.
static final Map<String, DerivedResolver> DERIVED_RESOLVERS = Map.ofEntries(
Map.entry("CreateServiceLinkedRole", ResourceArnBuilder::serviceLinkedRoleArn),
Map.entry("GetAccessKeyLastUsed",
(self, ctx, region, accountId) -> self.accessKeyOwnerArn(ctx, accountId)),
Map.entry("GetServiceLinkedRoleDeletionStatus", ResourceArnBuilder::deletionTaskRoleArn),
Map.entry("GenerateOrganizationsAccessReport",
ResourceArnBuilder::organizationsAccessReportArn),
Map.entry("AssociateDelegationRequest", ResourceArnBuilder::delegationRequestArn),
Map.entry("AcceptDelegationRequest", ResourceArnBuilder::delegationRequestArn),
Map.entry("RejectDelegationRequest", ResourceArnBuilder::delegationRequestArn),
Map.entry("GetDelegationRequest", ResourceArnBuilder::delegationRequestArn),
Map.entry("UpdateDelegationRequest", ResourceArnBuilder::delegationRequestArn),
Map.entry("SendDelegationToken", ResourceArnBuilder::delegationRequestArn),
Map.entry("GetHumanReadableSummary", ResourceArnBuilder::summarizedRequestArn));
/** How one of {@link #DERIVED_RESOLVERS} reads its resource out of the request. */
interface DerivedResolver {
@@ -609,9 +612,12 @@ public class ResourceArnBuilder {
* actions use, one step earlier, because this family passes an id where they pass an ARN.
*
* <p>{@code CreateDelegationRequest} is not here: IAM mints the id, so the request names no
* resource and the wildcard is the honest answer. {@code UpdateDelegationRequest} is not here
* either, AWS publishing no authorizable action for it at all, so it carries no type to
* resolve.
* resource and the wildcard is the honest answer. {@code UpdateDelegationRequest} is here,
* which corrects what this note said before: the customer-side page "Managing Permissions for
* Delegation Requests" lists {@code iam:UpdateDelegationRequest} among the permissions an
* administrator grants, describing it as "Forward a delegation request to an administrator for
* approval", so it is an authorizable action and it names the request its id names, as its
* siblings do.
*/
private List<String> delegationRequestArn(ContainerRequestContext ctx, String region,
String accountId) {