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

The ProtectKeysWithAzureKeyVault section of this page suggests a series of steps that result in a serious security issue. #22546

Closed
hypermoose opened this issue Jun 15, 2021 · 7 comments · Fixed by #24184
Labels
doc-enhancement Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

@hypermoose
Copy link

The ProtectKeysWithAzureKeyVault section of this page suggests that the reader run the sample code twice. Once with the ProtectKeysWithAzureKeyVault call commented out to create the initial blob and then a second time with the protect call left in. The problem with that is that not only is the block file created for the keyring but an initial key is created that is valid for 3 months from the time you ran it. When you add the ProtectKeysWithAzureKeyVault it actually does NOTHING!. Your key is now free and clear in blob storage for anyone to read UNTIL that key expires and a new one is generated which is keyvault encrypted. The instructions should state that the block file should be edited to remove the key or the sample empty file is so small you should just include it in the instructions.

The other thing that is wrong is the permissions need for the web app in keyvault, You must have the get permissions as well as wrap and unwrap.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added ⌚ Not Triaged Source - Docs.ms Docs Customer feedback via GitHub Issue labels Jun 15, 2021
@Rick-Anderson
Copy link
Contributor

@markmcgookin please review

@markmcgookin
Copy link
Contributor

Yeah, this is a super confusing topic. We do state here that ideally you should just upgrade to the new libraries as that will create things properly, but it might be made clearer that this doesn't require running the code twice with the line removed.

We recommended upgrading to the Azure.Extensions.AspNetCore.DataProtection.Blobs and Azure.Extensions.AspNetCore.DataProtection.Keys packages because the API provided automatically creates the blob if it doesn't exist.

Maybe we should remove the workaround and just insist people use the new packages?

Also... re: keyvault config, yeah we should probably mention that those specific permissions are needed. Even though this isn't necessarily about configuring keyvault itself, it would make sense to at least give users a heads up for what is required.

@Rick-Anderson
Copy link
Contributor

Maybe we should remove the workaround and just insist people use the new packages?

Yes, let's do that. We want to encourage folks to use the latest bits.

we should probably mention that those specific permissions are needed. Even though this isn't necessarily about configuring keyvault itself, it would make sense to at least give users a heads up for what is required.

Can you PR this?

@hypermoose
Copy link
Author

hypermoose commented Jun 18, 2021 via email

@markmcgookin
Copy link
Contributor

I am pretty sure the new libraries work fine without the second line commented out. I had this discussion here and here

I'll have a look at re-doing this bit as it's pretty confusing at the minute.

@Rick-Anderson
Copy link
Contributor

@markmcgookin can you take a look at this and #24096

@markmcgookin
Copy link
Contributor

@markmcgookin can you take a look at this and #24096

PR #24184 should cover both of these, not sure if it's automatically picked up this one though. Might need to manually close if/when it's merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants