-
Notifications
You must be signed in to change notification settings - Fork 31
Create rule S7608: S3 operations should verify bucket ownership using ExpectedBucketOwner parameter #5131
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
base: master
Are you sure you want to change the base?
Conversation
4d561cf
to
816e95d
Compare
1041ef9
to
1a39458
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule looks good. Nice work 💪
I've left some nitpick comments about formatting and the links.
Also, at least right now, the framework names haven't been added to the allowed frame work list. (see #5132 which adds this)
"aws", | ||
"s3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set tags already? Isn't this something Jean has to approve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we can do the tags ourselves, we just need to be consistent with each other
rules/S7608/python/rule.adoc
Outdated
@@ -0,0 +1,114 @@ | |||
This rule raises an issue when S3 operations are performed without verifying bucket ownership using the ExpectedBucketOwner parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule raises an issue when S3 operations are performed without verifying bucket ownership using the ExpectedBucketOwner parameter. | |
This rule raises an issue when S3 operations are performed without verifying bucket ownership using the `ExpectedBucketOwner` parameter. |
Same applies to the other mentions of ExpectedBucketOwner
rules/S7608/python/rule.adoc
Outdated
import boto3 | ||
|
||
def lambda_handler(event, context): | ||
s3_client = boto3.client('s3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: the s3_client
should probably be initialized outside of the lambda_handler
rules/S7608/python/rule.adoc
Outdated
import aiobotocore.session | ||
|
||
async def lambda_handler(event, context): | ||
session = aiobotocore.session.get_session() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the aiobotocore.session
should also be initialized outside of the lambda_handler
rules/S7608/python/rule.adoc
Outdated
* https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_object[boto3 S3 get_object documentation with ExpectedBucketOwner parameter] | ||
* https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-owner-condition.html[AWS S3 bucket owner condition documentation] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format of the links are not quite right 1
* https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_object[boto3 S3 get_object documentation with ExpectedBucketOwner parameter] | |
* https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-owner-condition.html[AWS S3 bucket owner condition documentation] | |
* boto3 Documentation - https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_object[get_object] | |
* AWS Documentation - https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-owner-condition.html[Verifying bucket ownership with bucket owner condition] |
Footnotes
rules/S7608/python/rule.adoc
Outdated
|
||
== Why is this an issue? | ||
|
||
Verifying S3 bucket ownership is a critical security practice in AWS applications. The ExpectedBucketOwner parameter confirms you're accessing the correct bucket owned by the intended AWS account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find that this section flows a bit weird with so many small paragraphs. Personally, I would prefer one bigger paragraph, but that's personal preference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule looks good. Nice work 💪
I've left some nitpick comments about formatting and the links.
Also, at least right now, the framework names haven't been added to the allowed frame work list. (see #5132 which adds this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule looks good. Nice work 💪
I've left some nitpick comments about formatting and the links.
Also, at least right now, the framework names haven't been added to the allowed frame work list. (see #5132 which adds this)
|
|
You can preview this rule here (updated a few minutes after each push).
Review
A dedicated reviewer checked the rule description successfully for: