Files
floci/tools/aws/sources/backup-arn-formats.json
T
Priamo Germosen 16bdd60072 fix(iam): check an AWS Backup recovery point on the ARN its request names (#9884)
The Service Reference gives AWS Backup's recovery point the format
arn:${Partition}:${Vendor}:${Region}:*:${ResourceType}:${RecoveryPointId}, a wildcard where the account goes, which
no ARN a request names matches as written, so every request naming a recovery point by its ARN
(DescribeRecoveryPoint, DeleteRecoveryPoint, StartRestoreJob and the rest) was checked on *.

The AWS Backup Developer Guide's table of resource ARNs gives each kind of recovery point's ARN with the account, or
nothing, in that place. tools/aws/fetch_backup_arn_formats.py vendors the table's recovery point rows as they stand
into tools/aws/sources/backup-arn-formats.json, refusing a row with anything else there, and writes the Service
Reference's format with the account variable in place of the wildcard. ARN_FORMAT_SOURCES grants it for backup, and
with_vendored_formats now takes a vendored format that has a variable for each of the reference's wildcards and
nothing else changed. The table's recovery point format becomes
arn:${Partition}:${Vendor}:${Region}:${Account}:${ResourceType}:${RecoveryPointId}.

Some rows give a recovery point no colon between its type and id, which that format does not fit (an EBS snapshot's
arn:aws:ec2:region::snapshot/*, a DynamoDB backup's table/*/backup/*). The fetcher also writes each row as a format
of its own, the last wildcard as ${RecoveryPointId} and one before it as ${Resource}, and the table gives the
recovery point those its format does not fit already (alternateFormats): EBS snapshots, EC2 images, FSx backups and
DynamoDB backups. RequestResourceMembers matches a type's ARN against its format or any of them.

The generic recovery point format also fits an IAM role whose path holds a colon, and the rule for an ARN member had
typed the roles StartRestoreJob, StartCopyJob and StartScanJob pass as recovery points. The generator now reads the
generated passed-roles table, as it reads the authorized-actions one, and reads no resource of an action from a
member it gives as a role the operation passes, whose ARN iam:PassRole is checked on: 98 rows in 83 operations go,
of which only those five could fit a role's ARN.

test_fetch_backup_arn_formats.py checks the fetcher's copy, its formats and refusals;
test_regen_iam_request_resources.py the account wildcard's replacement, the alternates kept and the passed-role rows
dropped; RequestResourceMembersTest the alternates' read and refusals; ResourceArnBuilderTest that DescribeRecoveryPoint
is checked on the ARN in its path, a Backup one sent encoded or not and an EBS one as an SDK encodes it, and
StartRestoreJob on its recovery point and not on the role it passes; IamRequestResourceEnforcementIntegrationTest that a
grant on one recovery point's ARN lets the caller describe that one and not another.
2026-12-01 07:44:42 -04:00

110 lines
4.5 KiB
JSON

{
"_source": {
"pages": [
"https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html",
"https://servicereference.us-east-1.amazonaws.com/v1/backup/backup.json"
],
"fetcher": "tools/aws/fetch_backup_arn_formats.py",
"retrieved": "2026-12-01",
"note": "The Developer Guide's recovery point ARNs, copied as they stand, each with the account or nothing in the account's place; each Service Reference AWS Backup format with a wildcard there, with the account variable in its place; and each recovery point ARN as a format."
},
"recoveryPoints": [
{
"resourceType": "Recovery point for Amazon EBS",
"format": "arn:aws:ec2:<region>::snapshot/*"
},
{
"resourceType": "Recovery point for Amazon EC2 images",
"format": "arn:aws:ec2:<region>::image/ami-*"
},
{
"resourceType": "Recovery point for Amazon RDS",
"format": "arn:aws:rds:<region>:<account-id>:snapshot:awsbackup:*"
},
{
"resourceType": "Recovery point for Aurora",
"format": "arn:aws:rds:<region>:<account-id>:cluster-snapshot:awsbackup:*"
},
{
"resourceType": "Recovery point for Aurora DSQL",
"format": "arn:<aws-partition>:backup:<region>:<account-id>:recovery-point:<recovery-point-id>"
},
{
"resourceType": "Recovery point for Storage Gateway",
"format": "arn:aws:ec2:<region>::snapshot/*"
},
{
"resourceType": "Recovery point for DynamoDB without Advanced DynamoDB backup",
"format": "arn:aws:dynamodb:<region>:<account-id>:table/*/backup/*"
},
{
"resourceType": "Recovery point for DynamoDB with Advanced DynamoDB backup enabled",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for Amazon EFS",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for Amazon FSx",
"format": "arn:aws:fsx:<region>:<account-id>:backup/backup-*"
},
{
"resourceType": "Recovery point for virtual machine",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for Amazon S3 continuous backup",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for S3 periodic backup",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for Amazon DocumentDB",
"format": "arn:aws:rds:<region>:<account-id>:cluster-snapshot:awsbackup:*"
},
{
"resourceType": "Recovery point for Neptune",
"format": "arn:aws:rds:<region>:<account-id>:cluster-snapshot:awsbackup:*"
},
{
"resourceType": "Recovery point for Amazon Redshift",
"format": "arn:aws:redshift:<region>:<account-id>:snapshot:<resource>/awsbackup:*"
},
{
"resourceType": "Recovery point for Amazon Redshift Serverless",
"format": "arn:aws:redshift-serverless:<region>:<account-id>:snapshot:<resource>/awsbackup:*"
},
{
"resourceType": "Recovery point for Amazon Timestream",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for AWS CloudFormation template",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
},
{
"resourceType": "Recovery point for SAP HANA database on Amazon EC2 instance",
"format": "arn:aws:backup:<region>:<account-id>:recovery-point:*"
}
],
"arnFormats": {
"recoveryPoint": "arn:${Partition}:${Vendor}:${Region}:${Account}:${ResourceType}:${RecoveryPointId}"
},
"alternateFormats": {
"recoveryPoint": [
"arn:${Partition}:backup:${Region}:${Account}:recovery-point:${RecoveryPointId}",
"arn:${Partition}:dynamodb:${Region}:${Account}:table/${Resource}/backup/${RecoveryPointId}",
"arn:${Partition}:ec2:${Region}::image/ami-${RecoveryPointId}",
"arn:${Partition}:ec2:${Region}::snapshot/${RecoveryPointId}",
"arn:${Partition}:fsx:${Region}:${Account}:backup/backup-${RecoveryPointId}",
"arn:${Partition}:rds:${Region}:${Account}:cluster-snapshot:awsbackup:${RecoveryPointId}",
"arn:${Partition}:rds:${Region}:${Account}:snapshot:awsbackup:${RecoveryPointId}",
"arn:${Partition}:redshift-serverless:${Region}:${Account}:snapshot:${Resource}/awsbackup:${RecoveryPointId}",
"arn:${Partition}:redshift:${Region}:${Account}:snapshot:${Resource}/awsbackup:${RecoveryPointId}"
]
}
}