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

chore(kms): add multi_region attribute to AWS KMS key class #6794

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wunzeco
Copy link

@wunzeco wunzeco commented Feb 3, 2025

Context

When developing a custom check to check the multi-region status of keys created in an AWS account, I discovered
that the Key class
was missing a field for the KMS Key KeyMetadata.MultiRegion data. The resulting error I encountered is given below:

E       AttributeError: 'Key' object has no attribute 'multi_region'

Please include relevant motivation and context for this PR.

If fixes an issue please add it with Fix #6792

Description

Please include a summary of the change and which issue is fixed. List any dependencies that are required for this change.

  • Addes missing multi_region field to KMS Key class to store the value of KeyMetadata.MultiRegion that is available in the KMS DescribeKey api response

See example output here

  • No additional dependencies required for this change

Checklist

License

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

@wunzeco wunzeco requested review from a team as code owners February 3, 2025 15:12
@github-actions github-actions bot added the provider/aws Issues/PRs related with the AWS provider label Feb 3, 2025
@MrCloudSec
Copy link
Member

Good catch @wunzeco! Just out of curiosity, how is the check you are developing?

@MrCloudSec MrCloudSec linked an issue Feb 3, 2025 that may be closed by this pull request
@wunzeco
Copy link
Author

wunzeco commented Feb 4, 2025

@MrCloudSec
I was developing a custom check to check the multi-region status of kms keys.
The use case for my organisation is this:

A customer managed key should be single region only. The rationale is that though a multi-region key can facilitate data transfer between AWS regions. However, it can also increase the risk of data exposure because managing access controls and auditing across multi regions becomes more complex, potentially allowing more attack surfaces to could result in compromise of sensitive data.

For organisations with strict data residency requirements (like mine), a multi-region key is not useful.

I'd be happy to contribute this custom check as I believe it might help others.

Currently, I got the custom check working by extending KMS class and Key class locally, which I won't have needed to do if the missing multi_region field was in place. Fortunately, it enabled me explore and be exposed more to the inner workings of this awesome project.

@wunzeco
Copy link
Author

wunzeco commented Feb 4, 2025

Investigating the failed PR build jobs

@MrCloudSec MrCloudSec changed the title fix(kms): add missing multi_region field to Key class chore(kms): add multi_region attribute to AWS KMS key class Feb 4, 2025
@MrCloudSec
Copy link
Member

@MrCloudSec I was developing a custom check to check the multi-region status of kms keys. The use case for my organisation is this:

A customer managed key should be single region only. The rationale is that though a multi-region key can facilitate data transfer between AWS regions. However, it can also increase the risk of data exposure because managing access controls and auditing across multi regions becomes more complex, potentially allowing more attack surfaces to could result in compromise of sensitive data.

For organisations with strict data residency requirements (like mine), a multi-region key is not useful.

I'd be happy to contribute this custom check as I believe it might help others.

Currently, I got the custom check working by extending KMS class and Key class locally, which I won't have needed to do if the missing multi_region field was in place. Fortunately, it enabled me explore and be exposed more to the inner workings of this awesome project.

It would be great if you can add that check here too so we can add value to the Prowler community 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a "multi_region" field that is missing in the KMS Key class
2 participants