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

aws-sdk-php: fix bucket policy to make comparable. #272

Merged
merged 1 commit into from
Apr 22, 2018
Merged

aws-sdk-php: fix bucket policy to make comparable. #272

merged 1 commit into from
Apr 22, 2018

Conversation

balamurugana
Copy link
Member

No description provided.

@harshavardhana
Copy link
Member

Did you test this with AWS S3 ?

@balamurugana
Copy link
Member Author

What do you mean by testing with aws s3?

@@ -828,7 +828,7 @@ function testBucketPolicy($s3Client, $params) {
$bucket = $params['Bucket'];

// Taken from policy set using `mc policy download`
$downloadPolicy = sprintf('{"Version":"2012-10-17","Statement":[{"Action":["s3:GetBucketLocation","s3:ListBucket"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::%s"],"Sid":""},{"Action":["s3:GetObject"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::%s/*"],"Sid":""}]}', $bucket, $bucket);
$downloadPolicy = sprintf('{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:GetObject"],"Resource":["arn:aws:s3:::%s/*"]}]}', $bucket);
Copy link
Member

Choose a reason for hiding this comment

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

Is it OK forSid to be missing valid in a bucket policy?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@harshavardhana
Copy link
Member

Run the same test against AWS S3

@harshavardhana
Copy link
Member

Without this fix I want see why we need to fix our tests. If AWS S3 works then test is fine.

@balamurugana
Copy link
Member Author

I am sure AWS S3 won't save the passed policy as is. It would save/send back canonical policy. I will show a proof.

@balamurugana
Copy link
Member Author

Current policy: {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":["s3:GetBucketLocation","s3:ListBucket"],"Resource":"arn:aws:s3:::bala-test-bucket1"},{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::bala-test-bucket1/myobject*"}]}

Note that output is not pretty JSON string and field values are trimmed.

Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

LGTM

@harshavardhana harshavardhana merged commit c6ead73 into minio:master Apr 22, 2018
@balamurugana balamurugana deleted the fix-aws-sdk-php-get-bucket-policy branch November 4, 2022 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants