cds-snc / url-shortener

An API written in Python that shortens URLs
MIT License
4 stars 0 forks source link

fix: split the ALLOWED_DOMAINS into two env vars #368

Closed patheard closed 1 year ago

patheard commented 1 year ago

Summary

Update the allowed email domains and allowed shortened domains to be controlled by two distinct environment variables.

This will allow us to have more fine grained control over which email domains can login and which URLs can be shortened.

Related

github-actions[bot] commented 1 year ago

Staging: api

✅   Terraform Init: success ✅   Terraform Validate: success ✅   Terraform Format: success ✅   Terraform Plan: success ✅   Conftest: success

Plan: 0 to add, 1 to change, 0 to destroy
Show summary | CHANGE | NAME | |--------|--------------------------------------------------------| | update | `module.url_shortener_lambda.aws_lambda_function.this` |
Show plan ```terraform Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # module.url_shortener_lambda.aws_lambda_function.this will be updated in-place ~ resource "aws_lambda_function" "this" { id = "url-shortener-api" tags = { "CostCentre" = "url-shortener-staging" "Terraform" = "true" } # (19 unchanged attributes hidden) ~ environment { ~ variables = { - "ALLOWED_DOMAINS" = "canada.ca,gc.ca,cds-snc.ca" -> null + "ALLOWED_EMAIL_DOMAINS" = "canada.ca,gc.ca,cds-snc.ca" + "ALLOWED_SHORTENED_DOMAINS" = "canada.ca,gc.ca" # (4 unchanged elements hidden) } } # (3 unchanged blocks hidden) } Plan: 0 to add, 1 to change, 0 to destroy. ───────────────────────────────────────────────────────────────────────────── Saved the plan to: plan.tfplan To perform exactly these actions, run the following command to apply: terraform apply "plan.tfplan" ```
Show Conftest results ```sh WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_cloudwatch_log_group.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_role.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder"] 21 tests, 17 passed, 4 warnings, 0 failures, 0 exceptions ```