This repository was archived by the owner on Jul 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
This repository was archived by the owner on Jul 13, 2023. It is now read-only.
Client hangs on encryption if the account making the request does not have encryption permission #375
Copy link
Copy link
Closed
Labels
api: cloudkmsIssues related to the googleapis/nodejs-kms API.Issues related to the googleapis/nodejs-kms API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- OS: Linux Debian
- Node.js version: 10.21.0
- npm version: 6.14.3
@google-cloud/kmsversion: 2.1.2
Steps to reproduce
-
Ensure the IAM account in question does not have permission to encrypt e.g. no 'Cloud KMS CryptoKey Encrypter/Decrypter' or 'Cloud KMS CryptoKey Encrypter' IAM roles
-
Try encrypting a payload e.g.
await kmsClient.encrypt({
name: kmsClient.cryptoKeyPath('PROJECT_ID', 'LOCATION', 'KEY_RING', 'KEY'),
plaintext: 'payload to encrypt'
}, { timeout: 5000 });
The client hangs hangs indefinitely. For some reason if the plaintext parameter is removed then the invalid permission error is thrown e.g.
await kmsClient.encrypt({
name: kmsClient.cryptoKeyPath('PROJECT_ID', 'LOCATION', 'KEY_RING', 'KEY')
}, { timeout: 5000 });
Error:
{ Error: 7 PERMISSION_DENIED: Permission 'cloudkms.cryptoKeyVersions.useToEncrypt' denied on resource 'RESOURCE_PATH' (or it may not exist).
Expected behavior
When the plaintext parameter is included, the client should throw an error similar to that when the plaintext parameter is excluded
Note: This may actually not be related to a missing permission. The client also hangs and never returns a response even when the right IAM roles are present
Metadata
Metadata
Assignees
Labels
api: cloudkmsIssues related to the googleapis/nodejs-kms API.Issues related to the googleapis/nodejs-kms API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.