aws-samples / aws-serverless-workshop-innovator-island

Welcome to the Innovator Island serverless workshop! This repo contains all the instructions and code you need to complete the workshop.
MIT No Attribution
564 stars 228 forks source link

Step 3 - eval in Lambda function code #43

Closed alexcasalboni closed 4 years ago

alexcasalboni commented 4 years ago

We're passing HSV_LOWER and HSV_UPPER a python tuples.

lower_range = eval(os.environ["HSV_LOWER"])
upper_range = eval(os.environ["HSV_UPPER"])

I think this is not something we'd want to recommend in production.

I can think of two better options:

  1. provide the values as a json list -> [36, 100, 100] instead of (36, 100, 100), then simply tuple(json.loads(os.environ["HSV_LOWER"]))
  2. Make these env variables optional and simply use the default values (no need to eval of json.loads)
jbesw commented 4 years ago

This has been resolved and merged by issue #49