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

[Key Vault Secrets] keyId should be populated, as a string #9639

Closed

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant requested review from sophiajt and willmtemple June 22, 2020 17:49
@sadasant sadasant self-assigned this Jun 22, 2020
@@ -4,6 +4,8 @@

- Fixed [bug 8378](https://github.com/Azure/azure-sdk-for-js/issues/8378), which caused the challenge based authentication to re-authenticate on every new request.
- Fixed [bug 9005](https://github.com/Azure/azure-sdk-for-js/issues/9005), which caused parallel requests to throw if one of them needed to authenticate.
- Fixed a bug in which the `keyId` was missing on the secret properties.
- Removed the dependency of the TypeScript types for the `dom`.
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this change related to populating keyId?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before this specific change: https://github.com/Azure/azure-sdk-for-js/pull/9639/files#diff-f3c93f553a685134bd5ce75e2fbad25eR961 keyId wouldn't be populated, because none of the previous objects had this property.

@@ -123,7 +123,7 @@ export interface SecretProperties {
enabled?: boolean;
readonly expiresOn?: Date;
id?: string;
readonly keyId?: URL;
readonly keyId?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a breaking change for someone who has the below code

if (mySecret.keyId) {
     console.log(mySecret.keyId.toJSON());
}

One approach could be that we deprecate this property and use a new name, perhaps something to denote that this is related to the KV certificate?

cc @bterlson, @xirzec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

KeyVault Certificates uses string already. That if that you mention couldn't have been used because this property was never received as keyId.

Copy link
Contributor

Choose a reason for hiding this comment

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

If someone has written the code Ramya wrote above with a KeyVaultSecret, then it will break their compilation if we change the type signature to string, even though the current implementation can't set it to anything at runtime.

Copy link
Contributor Author

@sadasant sadasant Jun 23, 2020

Choose a reason for hiding this comment

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

I'm assuming that we could get away with it since we're in preview. What is the recommended path forward? If it's a version change, I can do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

This property was introduced in 4.0 GA, so even though 4.1 is in preview, it create a breaking change between 4.0 and 4.1 to remove something from the API.

I think we have to put a deprecation on the docs for keyId that mentions that the property will never be defined and create a new property name (I agree with Ramya that something that lets a customer know that this is about correlation to a certificate would be good). When we eventually do 5.0 we can remove the property entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should deprecate keyId since it will be a misalignment with the other languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could deprecate keyId in the GA versions and re-introduce it in 4.1.0? in the GA versions we would introduce kid, which is the one that gets populated? (then deprecate kid again in 4.1.0)

@sadasant
Copy link
Contributor Author

Closing on favor of a new issue: #10726

@sadasant sadasant closed this Aug 20, 2020
@sadasant sadasant deleted the keyvault/secrets-missing-keyId branch August 20, 2020 19:02
maorleger added a commit that referenced this pull request Feb 23, 2021
…3908)

## what

- Deprecate `secretProperties.keyId` and replace it with `secretProperties.certificateKeyId`
- Remove `dom` from tsconfig

## why

`secretProperties.keyId` being a URL is the only reason we need `dom` lib in this library.
Even though it has never been populated we cannot remove it because we might break 
someone's compilation (although it would have never worked at runtime). 

Instead we'll deprecate it, note that it will always be undefined, and make it an any so
we can remove the dependency on `dom`. 

Refer to #9639 for previous work in this area.

Resolves #10726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants