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 11/**
22 * 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)
44 */
55
66import javascript
77
88/**
99 * 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.
1111 */
1212private module ServerLess {
1313 /**
@@ -24,6 +24,14 @@ private module ServerLess {
2424 then codeURI = properties .lookup ( "CodeUri" ) .( YAMLScalar ) .getValue ( )
2525 else codeURI = ""
2626 )
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+ )
2735 )
2836 }
2937
Original file line number Diff line number Diff line change 44| tst4/app.js:1:36:1:40 | event |
55| tst5/app.js:1:36:1:40 | event |
66| 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