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

Added S3 SSEKMSKeyId config option #3762

Merged
merged 2 commits into from
May 11, 2020

Conversation

jackwellsxyz
Copy link
Contributor

  • [X ] ❗ I have followed the Contributing to DVC checklist.

  • [(will do) ] πŸ“– If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.

  • [X ] ❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

I added an sse_kms_key_id parameter to the S3 config section.

Ultimately, it may make sense to iterate through the S3 ALLOWED_UPLOAD_ARGS and add any that exist to extra_args, but you'd need to enable ALLOW_EXTRA in the S3 voluptuous schema. With the way the schema is set up, you'd end up allowing extra arguments in the entire configuration schema, which I'm not sure is what we want.

Here's an example of the S3 init sequence if you did ALLOW_EXTRA in the S3 schema - and you could git rid of the sse, acl, and _append_aws_grants_to_extra_args() code.

        self.extra_args = {}
        for key in self.ALLOWED_UPLOAD_ARGS:
            value = config.get(key)
            if value:
                self.extra_args[key] = value

@efiop
Copy link
Contributor

efiop commented May 8, 2020

Thanks @jackwellsxyz ! Could you also submit a doc PR for your change, please? https://dvc.org/doc/command-reference/remote/modify

Also, could you confirm that this works for you?

Obviously we can't really create a good test for this, but it would be great to at least add a unit test for this to tests/unit/remote/test_s3.py just to make sure that this config option is being read.

@jackwellsxyz
Copy link
Contributor Author

jackwellsxyz commented May 8, 2020

Hi @efiop, thanks for taking a look! Where do you think would be the best place to document this new configuration option? I'm not seeing much of the existing S3 options in the documentation, including the sse parameter, for example. I thought perhaps to put it under dvc.org/content/docs/command-reference/config.md, but that doc seems more higher level, and there isn't an S3-specific page either. What do you think? Here's the command you can type to add the SSE-KMS key: dvc remote modify s3remote sse_kms_key_id <your key alias or id>.

Also, I've verified that yes dvc does actually work with the KMS key id and uploads to S3 using the key. I'm loving it!

@efiop
Copy link
Contributor

efiop commented May 8, 2020

@jackwellsxyz sse is here https://github.com/iterative/dvc.org/blob/master/content/docs/command-reference/remote/modify.md , it is just under the foldable "details" button. You could easily find it if you click raw or edit there.

@efiop
Copy link
Contributor

efiop commented May 8, 2020

@jackwellsxyz Btw, your idea about ALLOWED_UPLOAD_ARGS is great! I'm a bit worried about introducing config options that we don't have any user to verify that they work though, so I would not do it for now. Plus, we need to document them anyway, which is easier when we manually add them πŸ™‚ And also we are able to give them names that are following the style of our other config options.

@jackwellsxyz
Copy link
Contributor Author

Thanks @efiop I've just submitted a PR in dvc.org to update the documentation in remote modify. Also, makes sense to me on the ALLOWED_UPLOAD_ARGS - I can appreciate wanting to lock down the schema. Thanks for considering!

Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

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

Thanks @jackwellsxyz ! πŸŽ‰

@efiop efiop merged commit 7ca3a11 into iterative:master May 11, 2020
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.

2 participants