feat: Add initial tests for AWS Lambda support

This commit is contained in:
Mathew Payne
2023-05-10 12:36:15 +01:00
committed by Michael Nebel
parent 78a3749601
commit 2f5cb1ab29
3 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using System.Net;
using System.Collections.Generic;
using Amazon.Lambda.Core;
using Amazon.Lambda.APIGatewayEvents;
namespace LambdaTests {
public class Functions {
public APIGatewayProxyResponse Get(APIGatewayHttpApiV2ProxyRequest request, ILambdaContext context) {
string body = request.Body; // source
string cookie = request.Cookies[0]; // source
string rawpath = request.RawPath; // source
string rawquery = request.RawQueryString; // source
request.PathParameters.TryGetValue("x", out var pathparameter); // source
string header = request.Headers["test"]; // source
request.Headers.TryGetValue("test", out var header2); // source
return new APIGatewayProxyResponse {
StatusCode = 200
};
}
}
}

View File

@@ -0,0 +1,4 @@
import csharp
import semmle.code.csharp.dataflow.ExternalFlow
query predicate awsRemoteSources(DataFlow::ExprNode node) { sourceNode(node, "remote") }

View File

@@ -0,0 +1 @@
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/Amazon.Lambda/2.1.0/Amazon.Lambda.csproj