Skip to content

Commit

Permalink
Add encryption context to KMS (#120)
Browse files Browse the repository at this point in the history
* Add encryption context to KMS

* Fix lint issue
  • Loading branch information
DarcyRaynerDD authored Oct 23, 2020
1 parent 4e4f12c commit 98e8853
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/metrics/kms-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export class KMSService {
}
const buffer = Buffer.from(value, "base64");

const result = await this.kms.decrypt({ CiphertextBlob: buffer }).promise();
const encryptionContext = { LambdaFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME ?? "" };
const result = await this.kms.decrypt({ CiphertextBlob: buffer, EncryptionContext: encryptionContext }).promise();
if (result.Plaintext === undefined) {
throw Error("Couldn't decrypt value");
}
Expand Down

0 comments on commit 98e8853

Please sign in to comment.