File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed
src/semmle/javascript/frameworks
test/library-tests/frameworks/ServerLess Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* Provides classes and predicates for working with serverless handlers.
3
- * E.g. AWS: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html
3
+ * E.g. [ AWS]( https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) or [serverless](https://npmjs.com/package/serverless)
4
4
*/
5
5
6
6
import javascript
7
7
8
8
/**
9
9
* Provides classes and predicates for working with serverless handlers.
10
- * In particular a `RemoteFlowSource` is added for AWS and Alibaba serverless.
10
+ * In particular a `RemoteFlowSource` is added for AWS, Alibaba, and serverless.
11
11
*/
12
12
private module ServerLess {
13
13
/**
@@ -24,6 +24,14 @@ private module ServerLess {
24
24
then codeURI = properties .lookup ( "CodeUri" ) .( YAMLScalar ) .getValue ( )
25
25
else codeURI = ""
26
26
)
27
+ or
28
+ // The `serverless` library, which specifies a top-level `functions` property
29
+ exists ( YAMLMapping functions |
30
+ functions = resource .lookup ( "functions" ) and
31
+ not exists ( resource .getParentNode ( ) ) and
32
+ handler = functions .getValue ( _) .( YAMLMapping ) .lookup ( "handler" ) .( YAMLScalar ) .getValue ( ) and
33
+ codeURI = ""
34
+ )
27
35
)
28
36
}
29
37
Original file line number Diff line number Diff line change 4
4
| tst4/app.js:1:36:1:40 | event |
5
5
| tst5/app.js:1:36:1:40 | event |
6
6
| tst6/handler.js:6:23:6:36 | req.query.name |
7
+ | tst7/handler.js:1:34:1:38 | event |
Original file line number Diff line number Diff line change
1
+ export async function myFunction ( event , context , callback ) {
2
+ const body = JSON . parse ( event . body ) ;
3
+ // do something
4
+ }
Original file line number Diff line number Diff line change
1
+
2
+ service : serverless-myChecker
3
+
4
+ plugins :
5
+ - serverless-webpack
6
+ - serverless-offline
7
+
8
+ custom :
9
+ webpack :
10
+ webpackConfig : ./webpack.config.js
11
+ includeModules : true
12
+
13
+ provider :
14
+ name : aws
15
+ runtime : nodejs12.x
16
+ profile : personal
17
+ region : eu-west-1
18
+
19
+ functions :
20
+ myChecker :
21
+ handler : handler.myFunction
22
+ events :
23
+ - http :
24
+ path : webhook
25
+ method : post
You can’t perform that action at this time.
0 commit comments