zalando-stups/fullstop

Lambda Plugin: Skip on empty code

harti2006 opened this issue · 1 comments

When creating Lambda functions from the AWS UI, the first step of the wizard already creates the function, but without adding the code. This leads to having a dummy function, that always returns "Hello from Lambda", when invoked.

Expected behavior

Fullstop should not report this dummy function as violation, because it is part of the "normal" flow.

Step needed

Adapt the code to skip the violation on empty "code" request params.

Example Event

{
  "eventID": "xxxxxxx-14ff-473f-b254-80bf95534a06",
  "awsRegion": "eu-central-1",
  "eventName": "CreateFunction20150331",
  "eventTime": "2017-12-05T15:57:48Z",
  "eventType": "AwsApiCall",
  "requestID": "xxxxxxx-d9d5-11e7-8d80-5dddfeff1923",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",
  "eventSource": "lambda.amazonaws.com",
  "eventVersion": "1.05",
  "userIdentity": "OBFUSCATED",
  "sourceIPAddress": "OBFUSCATED",
  "responseElements": {
    "role": "arn:aws:iam::111222333444:role/my-lambda-role",
    "handler": "lambda_function.lambda_handler",
    "runtime": "python3.6",
    "timeout": 3,
    "version": "$LATEST",
    "codeSize": 267,
    "codeSha256": "bRdSs7GKxebaTz/CmYYgQF55qOe+NWwSd1ylrYFAiaQ=",
    "memorySize": 128,
    "description": "",
    "functionArn": "arn:aws:lambda:eu-central-1:111222333444:function:helloLambda",
    "functionName": "helloLambda",
    "lastModified": "2017-12-05T15:57:48.016+0000",
    "tracingConfig": {
      "mode": "PassThrough"
    }
  },
  "requestParameters": {
    "code": {},
    "role": "arn:aws:iam::111222333444:role/my-lambda-role",
    "handler": "lambda_function.lambda_handler",
    "publish": false,
    "runtime": "python3.6",
    "timeout": 3,
    "kMSKeyArn": "",
    "memorySize": 128,
    "description": "",
    "functionName": "helloLambda",
    "tracingConfig": {
      "mode": "PassThrough"
    },
    "deadLetterConfig": {}
  },
  "recipientAccountId": "111222333444"
}

fixed by #526