File tree Expand file tree Collapse file tree
terraform-aws-github-runner/modules/webhook/lambdas/webhook Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 "@typescript-eslint/eslint-plugin" : " ^7.10.0" ,
2323 "@typescript-eslint/parser" : " ^7.10.0" ,
2424 "@vercel/ncc" : " ^0.38.1" ,
25- "aws-sdk" : " ^2.1627.0" ,
2625 "body-parser" : " ^1.20.3" ,
2726 "eslint" : " 8.56.0" ,
2827 "express" : " ^4.17.1" ,
3130 "prettier" : " ^3.2.5" ,
3231 "ts-jest" : " ^28.0.8" ,
3332 "ts-node-dev" : " ^2.0.0" ,
34- "typescript-eslint " : " ^7.10 .0" ,
35- "typescript" : " ^4.3 .0"
33+ "typescript" : " ^4.3 .0" ,
34+ "typescript-eslint " : " ^7.10 .0"
3635 },
3736 "dependencies" : {
37+ "@aws-sdk/client-kms" : " ^3.879.0" ,
38+ "@aws-sdk/client-sqs" : " ^3.879.0" ,
3839 "@octokit/rest" : " ^20.1.1" ,
40+ "@octokit/webhooks" : " ^12.2.0" ,
3941 "@octokit/webhooks-methods" : " ^5.1.0" ,
40- "@octokit/webhooks-types" : " ^7.5.1" ,
41- "@octokit/webhooks" : " ^12.2.0"
42+ "@octokit/webhooks-types" : " ^7.5.1"
4243 }
4344}
Original file line number Diff line number Diff line change 1- import { KMS } from 'aws-sdk' ;
2- import AWS from 'aws-sdk' ;
1+ import { KMS } from '@aws-sdk/client-kms' ;
32
4- AWS . config . update ( {
5- region : process . env . AWS_REGION ,
6- } ) ;
7-
8- const kms = new KMS ( ) ;
3+ const kms = new KMS ( { region : process . env . AWS_REGION } ) ;
94
105export async function decrypt ( encrypted : string , key : string , environmentName : string ) : Promise < string | undefined > {
116 let result : string | undefined = encrypted ;
127 if ( key != undefined ) {
13- const decrypted = await kms
14- . decrypt ( {
15- CiphertextBlob : Buffer . from ( encrypted , 'base64' ) ,
16- KeyId : key ,
17- EncryptionContext : {
18- [ 'Environment' ] : environmentName ,
19- } ,
20- } )
21- . promise ( ) ;
8+ const decrypted = await kms . decrypt ( {
9+ CiphertextBlob : Buffer . from ( encrypted , 'base64' ) as Uint8Array ,
10+ KeyId : key ,
11+ EncryptionContext : {
12+ [ 'Environment' ] : environmentName ,
13+ } ,
14+ } ) ;
2215 result = decrypted . Plaintext ?. toString ( ) ;
2316 }
2417 return result ;
Original file line number Diff line number Diff line change 1- import { SQS } from 'aws-sdk' ;
2- import AWS from 'aws-sdk' ;
1+ import { SQS } from '@aws-sdk/client-sqs' ;
32
4- AWS . config . update ( {
5- region : process . env . AWS_REGION ,
6- } ) ;
7-
8- const sqs = new SQS ( ) ;
3+ const sqs = new SQS ( { region : process . env . AWS_REGION } ) ;
94
105export interface ActionRequestMessage {
116 id : number ;
@@ -22,10 +17,8 @@ const NUM_MESSAGE_GROUPS = process.env.NUM_MESSAGE_GROUPS !== undefined ? parseI
2217
2318export const sendActionRequest = async ( message : ActionRequestMessage ) => {
2419 console . info ( `Sending message: ${ JSON . stringify ( message ) } ` ) ;
25- await sqs
26- . sendMessage ( {
27- QueueUrl : String ( process . env . SQS_URL_WEBHOOK ) ,
28- MessageBody : JSON . stringify ( message ) ,
29- } )
30- . promise ( ) ;
20+ await sqs . sendMessage ( {
21+ QueueUrl : String ( process . env . SQS_URL_WEBHOOK ) ,
22+ MessageBody : JSON . stringify ( message ) ,
23+ } ) ;
3124} ;
You can’t perform that action at this time.
0 commit comments