mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 00:21:51 -05:00
Under enforcement a REST route no vendored model names runs unchecked, and AWS Backup was among them: a caller could start a backup job or assign resources to a backup plan with any role and no iam:PassRole, and a grant scoped to one backup vault or plan covered every one, as #6255 reports. Backup's model routes are vendored, so each request is checked as its operation's action, and Backup joins the tables of request resources, passed roles and tags on create. The Service Reference passes most of Backup's roles to one service, which the passed-roles generator reads alone: IamRoleArn to backup.amazonaws.com, a backup plan's scan settings' ScannerRoleArn to malware-protection.guardduty.amazonaws.com, and a restore testing selection's to restore-testing.backup.amazonaws.com. It passes StartScanJob's IamRoleArn and ScannerRoleArn to both of the first two without saying which goes where, so a vendored source, tools/aws/sources/backup-roles.json, written by tools/aws/fetch_backup_roles.py from the developer guide's malware protection page, gives each: the scanner role "trusts malware-protection.guardduty.amazonaws.com", and the backup role is "the same role found in ... the BackupSelection API", linking CreateBackupSelection, whose role the Service Reference passes to backup alone. The generator reads such a role as going where the reference passes that operation's roles, when that is one service. A backup vault is checked by its name and a backup plan by its id; BackupStoredResourceArns answers the tags Backup holds on either, which an aws:ResourceTag condition reads. A recovery point's format the Service Reference gives with a literal * account, which the reader matches as written, so a request naming a recovery point by its ARN is checked on *, as one naming a DMS endpoint is. A namespace the table reads is served on the shared tag routes only with a method its model gives on the path, as it already was only on the paths its model gives: Backup removes tags with POST /untag/{resourceArn}, so a DELETE on its /tags/{resourceArn}, which no Backup operation is and no action checks, was let through and removed tags an aws:ResourceTag deny relies on. It is now refused with MethodNotAllowedException (405), as a tag call sent with the other verb is. Closes #6255.