Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OK. I'm a bit stuck here.
Currently this application allows anything in the host header. This makes the site vulnerable to a range of spoofing attacks. I want to tighten this up.
The changes in f680c9a achieve this. However, they cause another problem.
When we deploy this app, we bring the lambda up and then run some smoke tests against it before we finalise the deploy. Because at the stage we're running the smoke tests, we haven't pointed the DNS at it yet, we have to test this on a direct URL i.e: we have to call https://fig9r88dhk.execute-api.eu-west-2.amazonaws.com/Prod/ rather than https://developers.womblelabs.co.uk/ or whatever.
That means those URLs also have to be in ALLOWED_HOSTS, otherwise we raise
400 Bad Request
in the smoke tests.So my first bash at a fix for this is fe21b96. In theory that should work. Unfortunately, when we try to run that code on lambda I get
so in order to get that to work, I need to grant our
AggregatorApiLambdaExecutionRole
s the ability to perform that action but I'm unclear on how permissions are managed in this application. It looks from the docs like this was probably done as a one-off rather than as part of the deploy process.The other thing we could consider doing is just setting the IDs as env vars. We can't use the
AggregatorApiFrontendFqdn
output to set an env var because we have to define the env vars before that output is available. I'm slightly less clear onServerlessRestApi
. I don't think I can really explain where that comes from.I think this would be a good one for us to catch up on next week @symroe