mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(iam): read Route 53 Resolver from the generated tables (#9368)
Move `route53resolver` from NOT_COVERED to NAMESPACES in regen_iam_request_resources.py, so Route 53 Resolver requests are checked on the resources they name instead of `*`: a resolver rule, an endpoint or a firewall domain list by its id, as <type>/<id>, the ARN the service mints, and a tag call on its ResourceArn. The reference's DNSSEC configuration format takes a ResourceId, which the request gives as the VPC's id, so the DNSSEC calls are checked under the VPC's id. A member whose botocore pattern is another service's ARN now holds nothing of the namespace, read where every rule first reads the request's members: CreateOutpostResolver's OutpostArn, an outposts ARN whose name begins the outpost resolver's, had taken the place of the resolver it makes, which is now checked as outpost-resolver/*. Over the whole table that rule changes this one operation. No other namespace's rows change. A managed firewall domain list, which AWS owns, was checked under the caller's account, though the service gives it an ARN of its own, so a grant on the ARN ListFirewallDomainLists returns was refused. Route 53 Resolver's request-resource lookup now answers a managed list's ARN for its id, which the reader already asks a service for for a resource filled from one member; a custom list stays in the caller's account.
This commit is contained in:
1 parent
e15b64d07b
commit
464aaaf734
8 files changed
+251
-11
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
package io.floci.aws.services.route53resolver;
|
||||
|
||||
import io.floci.aws.core.common.AwsException;
|
||||
import io.floci.aws.core.common.StoredResourceArns;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* What IAM asks Route 53 Resolver of the resources a request names: the ARN of the managed firewall domain list an id
|
||||
* names, which AWS owns rather than the caller, so a request naming one is checked on the ARN the service gives it.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class Route53ResolverStoredResourceArns implements StoredResourceArns {
|
||||
|
||||
private final Route53ResolverService resolver;
|
||||
|
||||
@Inject
|
||||
public Route53ResolverStoredResourceArns(Route53ResolverService resolver) {
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "route53resolver";
|
||||
}
|
||||
|
||||
/**
|
||||
* The ARN of the managed firewall domain list the id names; none for any other id, a custom list's among them,
|
||||
* which is the caller's own.
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
if (!"firewall-domain-list".equals(type) || names.size() != 1 || names.getFirst() == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
try {
|
||||
return Optional.of(resolver.getFirewallDomainList(region, names.getFirst()).arn());
|
||||
} catch (AwsException expected) {
|
||||
// Not a managed list: a custom one, or none, which the rendered ARN in the caller's account names.
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user