feat(dynamodb): cross-account table and stream access through ARNs - #2532
Merged
Merged
Conversation
- A table ARN naming another account reaches that account's table for the operations AWS supports cross-account: item operations, Query, Scan, batches, transactions, DescribeTable/UpdateTable/DeleteTable, tagging, and the Streams DescribeStream/GetShardIterator/GetRecords - Batches and transactions resolve each table's owner account; a transaction snapshots and reverts per account, so it stays atomic - Other operations do not find another account's table, and an ARN naming another region is not found for any operation - IAM authorizes the table the handler serves, so the table's resource policy combines with the caller's identity policy cross-account - Unit and two-account strict-mode e2e tests; docs
…e's account A batch or transaction can name same-named tables in two accounts; each table's dynamodb:LeadingKeys and dynamodb:Attributes now come only from the entries sent to that account's table.
ListBackups, ListExports and ListImports take a table only as a filter and model no not-found error, so another account's or region's table matches nothing instead of failing the call.
…ount The owner-account switch now applies only to operations with cross-account support. ListBackups's TableName filter naming another account's table no longer switches the listing into that account.
A TableName ARN naming another account's or region's table no longer matches the caller's same-named table's backups.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DynamoDB table ARNs naming another account now reach that account's table, the way AWS cross-account access with resource-based policies works. Before this,
resolve_table_namedropped the ARN's account and region, so a request always acted on the caller's own table of the same name.GetItem,PutItem,UpdateItem,DeleteItem,Query,Scan,BatchGetItem,BatchWriteItem,TransactGetItems,TransactWriteItems,DescribeTable,UpdateTable,DeleteTable,ListTagsOfResource,TagResource,UntagResource, and the StreamsDescribeStream,GetShardIterator,GetRecords. A single-table request is served in the owner's account.(account, table), so it stays atomic across accounts. Duplicate-item detection covers both accounts, and the idempotency token stays with the caller.ResourceNotFoundException,TableNotFoundException,BackupNotFoundException, ...).ListBackups/ListExports/ListImportstreat the table only as a filter, so a foreign table matches nothing;ListBackupsnow compares a table ARN filter as a whole ARN.dynamodb:LeadingKeys/dynamodb:Attributesfor batches and transactions count only entries sent to that account's table.Test plan
dynamodb_cross_account.rs(strict IAM + SigV4, three accounts): denied without a resource policy; allowed with one for GetItem/PutItem/DescribeTable/Query/cross-account BatchWriteItem + BatchGetItem/TransactWriteItems; DeleteItem not granted is denied; an unnamed account is denied; a user without an identity policy is denied; unsupported ops and another region find no table; stream reads need the stream's own policycargo test -p fakecloud-dynamodb(506), e2edynamodb,dynamodb_streams,iam_enforcement_dynamodb,iam_enforcement_abac,multi_account,dynamodb_persistenceSummary by cubic
Adds cross-account DynamoDB table and stream access through ARNs, matching AWS's resource-policy model. Table ARNs naming another account now reach that account's table for the supported operations, instead of being resolved to the caller's own table of the same name.
New Features
GetItem,PutItem,UpdateItem,DeleteItem,Query,Scan,BatchGetItem,BatchWriteItem,TransactGetItems,TransactWriteItems,DescribeTable,UpdateTable,DeleteTable, tagging operations, and stream reads (DescribeStream,GetShardIterator,GetRecords). Single-table requests are served in the owner's account.ListBackups/ListExports/ListImportstreat the table as a filter, so foreign tables match nothing.dynamodb:LeadingKeysanddynamodb:Attributesfor batches and transactions count only entries sent to that account's table.Written for commit 851a54d. Summary will update on new commits.