File tree Expand file tree Collapse file tree 4 files changed +936
-211
lines changed
terraform-aws-github-runner/modules/webhook/lambdas/webhook Expand file tree Collapse file tree 4 files changed +936
-211
lines changed Original file line number Diff line number Diff line change 22
22
"@typescript-eslint/eslint-plugin" : " ^7.10.0" ,
23
23
"@typescript-eslint/parser" : " ^7.10.0" ,
24
24
"@vercel/ncc" : " ^0.38.1" ,
25
- "aws-sdk" : " ^2.1627.0" ,
26
25
"body-parser" : " ^1.20.3" ,
27
26
"eslint" : " 8.56.0" ,
28
27
"express" : " ^4.17.1" ,
31
30
"prettier" : " ^3.2.5" ,
32
31
"ts-jest" : " ^28.0.8" ,
33
32
"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"
36
35
},
37
36
"dependencies" : {
37
+ "@aws-sdk/client-kms" : " ^3.879.0" ,
38
+ "@aws-sdk/client-sqs" : " ^3.879.0" ,
38
39
"@octokit/rest" : " ^20.1.1" ,
40
+ "@octokit/webhooks" : " ^12.2.0" ,
39
41
"@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"
42
43
}
43
44
}
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' ;
3
2
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 } ) ;
9
4
10
5
export async function decrypt ( encrypted : string , key : string , environmentName : string ) : Promise < string | undefined > {
11
6
let result : string | undefined = encrypted ;
12
7
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
+ } ) ;
22
15
result = decrypted . Plaintext ?. toString ( ) ;
23
16
}
24
17
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' ;
3
2
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 } ) ;
9
4
10
5
export interface ActionRequestMessage {
11
6
id : number ;
@@ -22,10 +17,8 @@ const NUM_MESSAGE_GROUPS = process.env.NUM_MESSAGE_GROUPS !== undefined ? parseI
22
17
23
18
export const sendActionRequest = async ( message : ActionRequestMessage ) => {
24
19
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
+ } ) ;
31
24
} ;
You can’t perform that action at this time.
0 commit comments