|
5 | 5 | import javascript
|
6 | 6 |
|
7 | 7 | module AWS {
|
| 8 | + /** |
| 9 | + * Gets the name of a supported AWS service. |
| 10 | + */ |
| 11 | + private string getAWSServiceName() { |
| 12 | + result = |
| 13 | + [ |
| 14 | + "EC2", "Lambda", "ECS", "EKS", "Batch", "ElasticBeanstalk", "Lightsail", "AppRunner", "S3", |
| 15 | + "EFS", "Glacier", "S3Control", "StorageGateway", "Backup", "DynamoDB", "DynamoDBStreams", |
| 16 | + "RDS", "Redshift", "ElastiCache", "Neptune", "QLDB", "Athena", "Route53", "CloudFront", |
| 17 | + "APIGateway", "ApiGatewayV2", "DirectConnect", "GlobalAccelerator", "CloudWatch", |
| 18 | + "CloudFormation", "CloudTrail", "Config", "Organizations", "ServiceCatalog", "SSM", |
| 19 | + "ResourceGroups", "IAM", "CognitoIdentity", "CognitoIdentityServiceProvider", "GuardDuty", |
| 20 | + "Inspector", "KMS", "SecretsManager", "SecurityHub", "STS", "WAF", "WAFRegional", |
| 21 | + "SageMaker", "Rekognition", "Comprehend", "Textract", "Translate", "Polly", |
| 22 | + "LexModelBuildingService", "MachineLearning", "Personalize", "EMR", "Kinesis", |
| 23 | + "KinesisAnalytics", "KinesisVideo", "QuickSight", "DataPipeline", "Glue", "LakeFormation", |
| 24 | + "SNS", "SQS", "SES", "Pinpoint", "Chime", "Connect", "Amplify", "AppSync", "DeviceFarm", |
| 25 | + "IoTAnalytics", "IoTEvents", "IoT1ClickDevicesService", "IoTSiteWise", "MediaConvert", |
| 26 | + "MediaLive", "MediaPackage", "MediaStore", "ElasticTranscoder", "EventBridge", "MQ", "SWF", |
| 27 | + "StepFunctions" |
| 28 | + ] |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Gets a node representing an import of the AWS SDK. |
| 33 | + */ |
| 34 | + private API::Node getAWSImport() { result = API::moduleImport("aws-sdk") } |
| 35 | + |
| 36 | + /** |
| 37 | + * Gets a data flow node representing an instantiation of an AWS service. |
| 38 | + */ |
| 39 | + private DataFlow::Node getServiceInstantation() { |
| 40 | + result = |
| 41 | + getAWSImport().getMember(getAWSServiceName()).getAnInstantiation().getReturn().asSource() |
| 42 | + } |
| 43 | + |
8 | 44 | /**
|
9 | 45 | * Holds if the `i`th argument of `invk` is an object hash for `AWS.Config`.
|
10 | 46 | */
|
@@ -36,6 +72,11 @@ module AWS {
|
36 | 72 | exists(string prop, DataFlow::InvokeNode invk, int i |
|
37 | 73 | takesConfigurationObject(invk, i) and
|
38 | 74 | this = invk.getOptionArgument(i, prop)
|
| 75 | + or |
| 76 | + // `new AWS.ServiceName({ accessKeyId: <user>, secretAccessKey: <password> })` |
| 77 | + invk = getServiceInstantation() and |
| 78 | + i = 0 and |
| 79 | + this = invk.getOptionArgument(i, prop) |
39 | 80 | |
|
40 | 81 | prop = "accessKeyId" and kind = "user name"
|
41 | 82 | or
|
|
0 commit comments