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

Add prefix to _s3_exists_dir to avoid permissions issues #214

Closed
wants to merge 1 commit into from

Conversation

ericphanson
Copy link
Member

@ericphanson ericphanson commented Sep 22, 2021

The comment here is wrong; you can use both start-after and prefix on AWS (see the examples here: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_Examples). And in fact, if you have per-prefix access control setup, you need to restrict your queries to the prefix to not get access denied errors.

I am guessing the comment refers to Minio, where this can be solved by a dispatch in Minio.jl. We can see what the tests say.

cc @christopher-dG @ExpandingMan

@ericphanson
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Sep 22, 2021
@bors
Copy link
Contributor

bors bot commented Sep 22, 2021

try

Build failed:

@ExpandingMan
Copy link
Contributor

Getting this to work reliably was extremely tricky and subtle, even if that comment is wrong it seems likely this will break. Are you sure it will still pick up the directory in all cases with both arguments?

Can you be more specific about what permission issue the existing code is causing?

@omus
Copy link
Member

omus commented Sep 22, 2021

Using IAM permissions that use conditional s3:prefix restrictions is when this problem occurs. There's an example of an IAM permissions policy using that here: https://aws.amazon.com/premiumsupport/knowledge-center/iam-s3-user-specific-folder/

We should definitely be adding a test for this behaviour.

@omus
Copy link
Member

omus commented Sep 22, 2021

For testing we should probably create an IAM role and an associated policy which creates the original problem. Ideally we'd do use something like a CFN template to create these resources similar to: https://github.com/JuliaCloud/AWS.jl/blob/v1.61.0/test/resources/aws_jl_test.yaml. Unfortunately this project doesn't have an existing setup for that.

@ExpandingMan
Copy link
Contributor

Yikes. Man, AWS is so painful sometimes.

Ok, well of course after you do whatever it takes to get tests passing on AWS I will implement new (or rather old) methods in Minio.jl as needed.

@mattBrzezinski
Copy link
Member

I feel like we need to vamp up our test cases for this stuff. From personal experience I've found it's very very tricky to get right.

@iamed2
Copy link
Member

iamed2 commented May 8, 2023

If the path already ends with /, shouldn't any results that show up with the prefix path indicate the dir exists? Could we just check for:

q = Dict("delimiter" => "", "max-keys" => 1, "prefix" => path)

?

@kleinschmidt
Copy link
Contributor

Just to verify what's blocking this:

  • we need more tests to reproduce this current behavior
  • this maybe requires setting up a role with the necessary permissions (or lack thereof)

Is there anything else?

@omus
Copy link
Member

omus commented Jun 12, 2023

Superseded by #289

@omus omus closed this Jun 12, 2023
@omus omus deleted the eph/exists_perms branch June 13, 2023 18:51
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.

6 participants