Skip to content

Commit

Permalink
fix(s3): grantRead does not allow s3:HeadObject (#27416)
Browse files Browse the repository at this point in the history
Fixes the policy enforced by `grantRead` to allow operations that require to read an object's metadata, for example:
```
s3 = boto3.client("s3")
# this operation requires s3:HeadObject permission
s3.download_file(bucket, key, filepath)
```

Closes #27389.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
lpizzinidev authored Oct 11, 2023
1 parent 3fc86ca commit beac675
Show file tree
Hide file tree
Showing 124 changed files with 299 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -63,6 +64,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -392,6 +393,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -556,6 +558,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -433,6 +434,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -558,6 +560,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -668,6 +671,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -497,6 +498,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -614,6 +616,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -923,6 +926,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -1031,6 +1035,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -1347,6 +1352,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -1558,6 +1564,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -360,6 +361,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -361,6 +362,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -233,6 +234,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -351,6 +353,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -438,6 +441,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -163,6 +164,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -356,6 +358,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -453,6 +456,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -408,6 +409,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -535,6 +537,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -672,6 +675,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -425,6 +426,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -170,6 +171,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -530,6 +532,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -358,6 +359,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -614,6 +616,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -431,6 +432,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*",
"s3:PutObject",
"s3:PutObjectLegalHold",
Expand Down Expand Up @@ -230,6 +231,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down Expand Up @@ -438,6 +440,7 @@
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:HeadObject",
"s3:List*"
],
"Effect": "Allow",
Expand Down
Loading

0 comments on commit beac675

Please sign in to comment.