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

Control artifact go-getter "mode" #2678

Closed
jippi opened this issue May 30, 2017 · 1 comment
Closed

Control artifact go-getter "mode" #2678

jippi opened this issue May 30, 2017 · 1 comment

Comments

@jippi
Copy link
Contributor

jippi commented May 30, 2017

Nomad version

Nomad v0.5.6

Issue

When using go-getter within s3, to download a specific file, deeply nested inside a directory hierarchy, the current usage of go-getter requires some unnecessary wide s3 policies to work.

With the current usage, you need a policy similar to the one below to make downloading artficats work, since go-getter run in any Mode by default - meaning it will try to traverse the bucket to find the file, and other files (if it happen to be a directory)

Being able to control the Mode would allow us to drop the ListObjects policy from our aws instances, and further harden our security footprint.

Looking at the code in go-getter, it seem like it tries, by default, to be recursive and download multiple files in the bucket if the source in nomad artifact happened to be a folder rather than a file

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::bucket/folder1/folder2/folder3/file"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "s3:ListObjects"
            ],
            "Resource": [
                "arn:aws:s3:::bucket/*",
                "arn:aws:s3:::bucket"
            ],
            "Effect": "Allow"
        }
    ]
}

Reproduction steps

any mode (current in nomad)

Without ListObjects policy:

go-getter -mode any s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 Error downloading: AccessDenied: Access Denied

WIth ListObjects policy:

go-getter -mode any s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 OK!

dir mode

Without ListObjects policy:

go-getter -mode dir s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 Error downloading: AccessDenied: Access Denied

WIth ListObjects policy:

go-getter -mode dir s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 OK!

file mode

Without ListObjects policy:

go-getter -mode file s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 OK

With ListObjects policy:

go-getter -mode file s3::https://s3.amazonaws.com/bucket/folder1/folder2/folder3/file file
2017/05/30 10:16:06 OK
@jippi jippi changed the title Control go-getter "mode" Control artifact go-getter "mode" May 30, 2017
schmichael added a commit that referenced this issue Jul 6, 2017
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants