Skip to content

fix(dynamodb): grant*Data() methods are missing the dynamodb:DescribeTable permission #19129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2022

Conversation

chris-smith-zocdoc
Copy link
Contributor

Fixes #18773

This allows the high level dynamodb clients to function correctly


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Feb 24, 2022

@github-actions github-actions bot added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Feb 24, 2022
@chris-smith-zocdoc chris-smith-zocdoc force-pushed the issue_18773 branch 2 times, most recently from 340a14f to 321b4de Compare February 24, 2022 04:20
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @chris-smith-zocdoc! One small suggestion.

@@ -29,3 +29,5 @@ export const READ_STREAM_DATA_ACTIONS = [
'dynamodb:GetRecords',
'dynamodb:GetShardIterator',
];

export const DESCRIBE_TABLE = 'dynamodb:DescribeTable';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of just adding 'dynamodb:DescribeTable' to the READ_STREAM_DATA_ACTIONS array? I think that's basically what we're going for here, and it would save us from doing any other edits to the production code in this PR (OK, minus the comments 😉).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean READ_DATA_ACTIONS? READ_STREAM_DATA_ACTIONS is for the DynamoDB stream, not reading/writing to the table.

I did consider adding it to READ_DATA_ACTIONS but that had two issues

  1. It doesn't cover the write use case, ie grantWriteData()
  2. If I added it to both READ_DATA_ACTIONS and WRITE_DATA_ACTIONS then I'd need code to de-dup it for grantReadWriteData

So it seemed simpler to implement it as an additional permission that is added to the necessary grant* calls

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I meant READ_DATA_ACTIONS.

OK, fair enough!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 0b5b5bc
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@skinny85 skinny85 changed the title fix(dynamodb): Add dynamodb:DescribeTable to all grant*Data() calls fix(dynamodb): grant*Data() methods are missing the dynamodb:DescribeTable permission Feb 25, 2022
@skinny85 skinny85 changed the title fix(dynamodb): grant*Data() methods are missing the dynamodb:DescribeTable permission fix(dynamodb): grant*Data() methods are missing the dynamodb:DescribeTable permission Feb 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 25, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 4a44a65 into aws:master Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_dynamodb: grant*Data() should include the dynamodb:DescribeTable permission
3 participants