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

fix: handles key vault name with double quotes. #102

Merged
merged 6 commits into from
May 27, 2021

Conversation

nilekhc
Copy link
Contributor

@nilekhc nilekhc commented May 26, 2021

Signed-off-by: Nilekh Chaudhari 1626598+nilekhc@users.noreply.github.com

Reason for Change:

Removes double quotes from keyvault name.

Issue Fixed:

fixes #85

Notes for Reviewers:

Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com>
@nilekhc nilekhc requested a review from aramase May 26, 2021 18:33
@@ -115,6 +116,10 @@ func getVaultURL(vaultName string, azureEnvironment *azure.Environment) (vaultUR
if len(vaultName) < 3 || len(vaultName) > 24 {
return nil, fmt.Errorf("invalid vault name: %q, must be between 3 and 24 chars", vaultName)
}

//Trim quotes from vault name. https://github.com/Azure/kubernetes-kms/issues/85
vaultName = strings.Trim(vaultName, "\"")
Copy link
Member

Choose a reason for hiding this comment

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

We'll need this for keyName and keyVersion too. Also, there could be a possibility of additional whitespace in the string. To account for that, we could probably define a sanitize function, that'll take a string, trim quotes, trim space and return the sanitized string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@nilekhc nilekhc requested a review from aramase May 27, 2021 00:25
@aramase aramase merged commit 3012412 into Azure:master May 27, 2021
@nilekhc nilekhc deleted the keyvault-name branch May 27, 2021 19:38
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.

Quotes are not allowed in vault name
2 participants