Skip to content
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

feat(kms): add sign and verify related grant methods #32681

Merged
merged 10 commits into from
Jan 6, 2025

Conversation

clementallen
Copy link
Contributor

@clementallen clementallen commented Dec 28, 2024

Issue

Closes #23185

Reason for this change

Adds grant methods for signing and verifying signatures with KMS

Description of changes

Three new grant methods have been added:

  • grantSign(): Adds 'kms:Sign' to the principal
  • grantVerify(): Adds 'kms:Verify' to the principal
  • grantSignVerify(): Adds ['kms:Sign', 'kms:Verify'] to the principal

Description of how you validated changes

  • Added new unit tests to verify the output of the 3 new grant methods
  • Added a new integ test for grantSignVerify()

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team December 28, 2024 22:23
@github-actions github-actions bot added repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Dec 28, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@clementallen clementallen changed the title feat(kms): Add sign and verify related grant methods feat(kms): add sign and verify related grant methods Dec 28, 2024
Copy link

codecov bot commented Dec 28, 2024

Codecov Report

Attention: Patch coverage is 11.76471% with 15 lines in your changes missing coverage. Please review.

Project coverage is 66.91%. Comparing base (caf2415) to head (2b4e644).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #32681      +/-   ##
==========================================
- Coverage   66.96%   66.91%   -0.06%     
==========================================
  Files         329      329              
  Lines       18667    18684      +17     
  Branches     3260     3260              
==========================================
+ Hits        12501    12503       +2     
- Misses       5839     5854      +15     
  Partials      327      327              
Flag Coverage Δ
suite.unit 66.91% <11.76%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 80.71% <ø> (ø)
packages/aws-cdk-lib/core 82.09% <ø> (ø)

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 28, 2024 22:44

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 28, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks 👍

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Dec 29, 2024
samson-keung
samson-keung previously approved these changes Jan 2, 2025
Copy link
Contributor

@samson-keung samson-keung left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contribution.

Copy link
Contributor

mergify bot commented Jan 2, 2025

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

Copy link
Contributor

mergify bot commented Jan 2, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 2, 2025
Copy link
Contributor

mergify bot commented Jan 2, 2025

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

@clementallen clementallen requested a review from a team as a code owner January 2, 2025 18:42
@mergify mergify bot dismissed samson-keung’s stale review January 2, 2025 18:43

Pull request has been modified.

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation added the pr/needs-cli-test-run This PR needs CLI tests run against it. label Jan 2, 2025
@clementallen
Copy link
Contributor Author

LGTM! Thank you for your contribution.

Thank you @samson-keung, there seemed to be some issue rebasing automatically so I've just done it manually

@aws-cdk-automation aws-cdk-automation dismissed their stale review January 2, 2025 18:47

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@samson-keung
Copy link
Contributor

there seemed to be some issue rebasing automatically so I've just done it manually

@clementallen I checked the logs. Looks like the PR had to be rebased again to get the year change in the license files. I have updated the PR branch so it should be good to go. I will check through out the day to make sure this gets merged 👍

samson-keung
samson-keung previously approved these changes Jan 2, 2025
Copy link
Contributor

mergify bot commented Jan 2, 2025

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

@mergify mergify bot dismissed samson-keung’s stale review January 2, 2025 21:39

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 2, 2025
@samson-keung
Copy link
Contributor

Codecov is complaining about missing coverage on the Alias class. Can you add similar unit test you have for the Key class?

Codecov also complains about missing coverage for the KeyBase class which does not make sense to me because you have the unit tests with the Key class already. I will check with the team on this.

@clementallen
Copy link
Contributor Author

Thanks for checking in on this again @samson-keung, I've added tests for all three methods against the Alias class now as well. Agree it's odd about KeyBase - please let me know if there's anything I can add to help with this!

@clementallen
Copy link
Contributor Author

@samson-keung I took a further look into the unit test reporting and it still doesn't make sense.

Codecov reports missing lines in the Key class, yet there are unit tests for these lines, and the local Jest coverage report correctly identifies these lines as being tested.

Codecov:
image

Jest coverage report:
image

There doesn't see much point adding tests to for the grant methods against Alias.fromAliasName as these are no-ops anyway as grant methods aren't usable against an imported alias just by name.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 2b4e644
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

mergify bot commented Jan 5, 2025

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

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 5, 2025
Copy link
Contributor

mergify bot commented Jan 5, 2025

Thank you for contributing! Your pull request will be updated from main 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 86d2853 into aws:main Jan 6, 2025
21 of 23 checks passed
Copy link

github-actions bot commented Jan 6, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2025
@samson-keung
Copy link
Contributor

@clementallen One of the Codecov jobs were not intended to run in this PR. The configuration has been updated, hence, the PR is now merged. Thanks for waiting while I was resolving the issue.

@clementallen clementallen deleted the kms-grants branch January 6, 2025 09:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr/needs-cli-test-run This PR needs CLI tests run against it. repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-kms: missing sign and verify IAM roles
5 participants