mirror of
https://github.com/floci-io/floci.git
synced 2026-12-04 10:38:00 -05:00
fix(lambda): accept layer ARNs when deleting versions (#8409)
* fix(lambda): accept layer ARNs when deleting versions * test(lambda): share layer publication cleanup * test(iam): include layer deletion in the resource inventory * fix(lambda): read Lambda's IAM resources whole from the generated table
This commit is contained in:
1 parent
ce25aa0247
commit
b8014cbd4e
22 files changed
+1219
-906
No files matched your search
+19
-17
@@ -1925,7 +1925,7 @@ requests retain HTTP 403 XML `AccessDenied` responses, except SNS's, which retur
|
||||
`AuthorizationError`, the error every SNS operation lists for a caller denied access, whichever
|
||||
action is denied. The routed protocol determines the status, not just the request's content type.
|
||||
|
||||
A request is checked against the resources it names. Floci builds their ARNs itself for S3, Lambda,
|
||||
A request is checked against the resources it names. Floci builds their ARNs itself for S3,
|
||||
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge
|
||||
Pipes, Aurora DSQL, EKS, API Gateway, CloudWatch Logs and STS. For Secrets Manager, Elastic Load Balancing, ECR,
|
||||
Step Functions, EventBridge, EventBridge Scheduler, Amazon Cognito user pools and identity pools, Amazon Data Firehose, Cloud
|
||||
@@ -1935,7 +1935,7 @@ AWS Data Exports, AWS Pricing Calculator, Cost Explorer, CloudTrail, Global Acce
|
||||
Timestream for InfluxDB, Amazon Redshift, the Amazon Redshift Data API, AWS Payment Cryptography, AWS DataSync, Amazon EMR,
|
||||
Amazon Rekognition, IAM Identity Center, Amazon Inspector, Amazon Macie, AWS Fault Injection Service, AWS Resource
|
||||
Access Manager, CloudWatch Observability Access Manager, AWS Resource Explorer, AWS Account Management, AWS Control
|
||||
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub and Amazon GuardDuty they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub, Amazon GuardDuty and Lambda they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
operation's action, the resource types that action acts on with their ARN formats, and the request
|
||||
members that name them: a member holding a resource's ARN, which counts when it matches the format
|
||||
of a type the action acts on, or members filling the variables of a type's format. Nothing in it is
|
||||
@@ -2127,21 +2127,23 @@ names one, as botocore documents ("If you omit this, the default schedule group
|
||||
`schedule-group/<name>`, all from the generated table. Its tagging is checked on the group its modeled
|
||||
`/tags/{ResourceArn}` carries, the ARN encoded as an SDK sends it. A Pipes request is checked against `pipe/<name>`. A DSQL request
|
||||
is checked against `cluster/<id>`, `cluster/<id>/stream/<id>` for a stream, or the ARN a tagging
|
||||
route names; `CreateCluster` and `ListClusters` against `cluster/*`, as DSQL checks them. A MicroVM image
|
||||
or network connector request is checked against `microvm-image:<name>` or `network-connector:<id>`
|
||||
in the request's account and Region, an identifier given as an ARN taken for its name, as the
|
||||
service looks it up. `RunMicrovm` is checked against the image its `imageIdentifier` names, an
|
||||
action on a running MicroVM against the image that MicroVM runs, and a managed image's versions
|
||||
against that image, which `aws` owns. A Lambda event source mapping, code signing config or layer
|
||||
version request is checked against `event-source-mapping:<uuid>`, `code-signing-config:<id>` or
|
||||
`layer:<name>:<version>` in the request's account and Region, where Lambda looks them up: a config
|
||||
by the id that ends its ARN, and a layer by its name as given, even a name given as an ARN or
|
||||
holding an encoded `/`, and its version as the number Lambda parses, so `01` is checked as `1`.
|
||||
`PublishLayerVersion` is checked against `layer:<name>`, and `GetLayerVersionByArn` against the
|
||||
layer version its `Arn` names, its number read the same way. A Lambda tagging request, at
|
||||
`/2017-03-31/tags/<arn>`, is checked against the caller's own function, MicroVM image or network
|
||||
connector of that ARN's Region and name, whatever account the ARN names, as Lambda looks it up, and
|
||||
an event source mapping's ARN as written.
|
||||
route names; `CreateCluster` and `ListClusters` against `cluster/*`, as DSQL checks them. A Lambda request
|
||||
is checked on what the table reads from it, as for the other services it reads. A function named by its
|
||||
name, its ARN, a partial ARN (`123456789012:function:my-function`, its Region optional) or its resource
|
||||
part (`function:my-function`) is the function of that name, an ARN keeping its account and Region beside
|
||||
the caller's function of that name. A version or alias written into the name is part of the function
|
||||
checked, `function:<name>:<qualifier>`. `Qualifier` names a version or alias only for the provisioned
|
||||
concurrency operations, which the Service Reference gives the function's version and alias; for an
|
||||
operation it gives the function alone, the function is checked as its name gives it. `AddPermission`'s
|
||||
`SourceAccount` is the account of its `SourceArn`, not the function's. An action on a running MicroVM is
|
||||
checked against the image Lambda says the caller's MicroVM runs, and a durable execution callback
|
||||
against the execution its callback belongs to ("Lambda authorizes callback requests against the ARN of
|
||||
the durable execution that created the callback"). A MicroVM image, network connector, event source
|
||||
mapping, code signing config, layer or Web Function is checked on the resource its member names, a
|
||||
layer version's number read as the number Lambda parses, so `01` is checked as `1`, and a tagging
|
||||
request on the ARN it names. A managed MicroVM image named by its name is checked in the caller's
|
||||
account, where the Service Reference puts the type; named by its ARN, in `aws`, the account that ARN
|
||||
names.
|
||||
|
||||
An EKS request is checked in the caller's account, where EKS looks everything up. A cluster route is
|
||||
checked against the ARN EKS holds the cluster under, or `cluster/<name>` in the request's Region for
|
||||
|
||||
+14
-6
@@ -116,15 +116,18 @@ part in authorizing calls to the function:
|
||||
- Provisioned-concurrency configuration operations also act in the account named by the function
|
||||
reference. Cross-account access requires that function's policy to allow the caller.
|
||||
- Other operations act on the caller's own function of the name the ARN gives, whatever account
|
||||
the ARN names, and are authorized against that function. Floci does not serve them on another
|
||||
account's function, which AWS allows through a function policy.
|
||||
the ARN names, and are authorized against both the function the ARN names and the caller's own
|
||||
function of that name. Floci does not serve them on another account's function, which AWS allows
|
||||
through a function policy.
|
||||
- Within one account, a statement naming the caller grants on its own. One naming only the
|
||||
account, as `AddPermission --principal <account-id>` writes it, delegates to the account, so the
|
||||
caller's identity policy has to allow the call too.
|
||||
- An invoke or provisioned-concurrency configuration operation is authorized against the version or
|
||||
alias it names, in the function name or in `Qualifier`. A grant added with `Qualifier` covers that
|
||||
version or alias only, and a grant on the function does not cover a qualified operation.
|
||||
Other operations are authorized against the unqualified function.
|
||||
- A version or alias written into the function name is part of the function an operation is
|
||||
authorized against, so a grant added with `Qualifier` covers a call naming that version or alias,
|
||||
and a grant on the function does not. `Qualifier` itself names a version or alias only for the
|
||||
provisioned-concurrency configuration operations, which act on it; every other operation is
|
||||
authorized against the function as its name gives it, as the Service Reference lists the function
|
||||
alone for those actions.
|
||||
- A statement conditioned on `InvokedViaFunctionUrl` does not admit a direct `Invoke`.
|
||||
- `aws:PrincipalOrgID` is not part of the request context, so a grant added with `PrincipalOrgID`
|
||||
admits no caller.
|
||||
@@ -519,6 +522,11 @@ validate each `Layers` ARN in the caller's own account eagerly against that stor
|
||||
real AWS - an unresolvable one is rejected with `InvalidParameterValueException: Layer version
|
||||
... does not exist.`, not silently accepted.
|
||||
|
||||
`DeleteLayerVersion` accepts either a layer name or an unversioned layer ARN, with
|
||||
`VersionNumber` supplied separately. ARN deletion resolves the stored version in the ARN's
|
||||
region and removes its archive. IAM checks use that same layer-version ARN; another
|
||||
account's ARN cannot select a same-named layer in the caller's account.
|
||||
|
||||
An ARN naming another account or another partition is answered on the live service by the layer's
|
||||
resource policy: an AWS-managed public layer resolves, and everything else is
|
||||
`AccessDeniedException`. Measured on `CreateFunction` in ap-southeast-1, a foreign-account ARN and
|
||||
|
||||
Reference in new issue
Block a user