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

KeyManagementServiceClient is leaked on each call to sign or getPublicKey #6

Open
nedgar opened this issue Aug 8, 2022 · 1 comment

Comments

@nedgar
Copy link

nedgar commented Aug 8, 2022

In src/util/gcp-kms-utils.ts it instantiates a new KeyManagementServiceClient each time sign or getPublicKey is called.
See:

const kms = new KeyManagementServiceClient();

const kms = new KeyManagementServiceClient();

The client maintains a gRPC channel, plus one in its referenced IAM client. close() should be called on the client when it's no longer needed.

The logical lifetime of the client is that of the GcpKmsSigner. I suggest changing it to instantiate the KeyManagementServiceClient, and pass that to the util methods.

@nedgar
Copy link
Author

nedgar commented Aug 8, 2022

Alternatively, since GcpKmsSigner doesn't take the Google credentials, the KeyManagementServiceClient could be made a singleton field in the utils for now. At least that would reduce leakage to just that instance and its channels.

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

No branches or pull requests

1 participant