-
-
Notifications
You must be signed in to change notification settings - Fork 351
Cookies not being sent with secure: true #10754
Copy link
Copy link
Labels
Affects: 4.10.0Affects: 4.11.0Affects: 4.12.0Affects: 4.13.0Affects: 4.14.0Affects: 4.15.0Affects: 4.16.0Affects: 4.17.0Affects: 4.18.0Affects: 4.19.0Affects: 4.2.0Affects: 4.2.1Affects: 4.2.2Affects: 4.2.3Affects: 4.2.4Affects: 4.20.0Affects: 4.20.1Affects: 4.21.0Affects: 4.21.1Affects: 4.22.0Affects: 4.3.0Affects: 4.3.1Affects: 4.3.2Affects: 4.4.0Affects: 4.4.1Affects: 4.4.2Affects: 4.5.0Affects: 4.5.1Affects: 4.5.2Affects: 4.6.0Affects: 4.7.0Affects: 4.7.1Affects: 4.7.2Affects: 4.8.0Affects: 4.8.1Affects: 4.9.0Affects: 5.0.0Affects: 5.0.1Affects: 5.0.2Affects: 5.1.0Type: BugFix something that isn't working as intendedFix something that isn't working as intended
Milestone
Metadata
Metadata
Assignees
Labels
Affects: 4.10.0Affects: 4.11.0Affects: 4.12.0Affects: 4.13.0Affects: 4.14.0Affects: 4.15.0Affects: 4.16.0Affects: 4.17.0Affects: 4.18.0Affects: 4.19.0Affects: 4.2.0Affects: 4.2.1Affects: 4.2.2Affects: 4.2.3Affects: 4.2.4Affects: 4.20.0Affects: 4.20.1Affects: 4.21.0Affects: 4.21.1Affects: 4.22.0Affects: 4.3.0Affects: 4.3.1Affects: 4.3.2Affects: 4.4.0Affects: 4.4.1Affects: 4.4.2Affects: 4.5.0Affects: 4.5.1Affects: 4.5.2Affects: 4.6.0Affects: 4.7.0Affects: 4.7.1Affects: 4.7.2Affects: 4.8.0Affects: 4.8.1Affects: 4.9.0Affects: 5.0.0Affects: 5.0.1Affects: 5.0.2Affects: 5.1.0Type: BugFix something that isn't working as intendedFix something that isn't working as intended
Type
Projects
Status
🚀 Done
Describe the bug
In our api code for sending cookies to the user we have some logic for setting the
secureattribute. (This attribute controls whether the cookie is only allowed to be sent via HTTPS and not just HTTP.) Unfortunately, this logic depends on the value of theNODE_ENVenvironment variable being set toproduction. Otherwise, we default tosecure: false. However, it seems that we are no longer setting theNODE_ENVvalue anywhere in our containers/config. So, I do not thinksecureis ever getting set totrue(even in production).(It is also worth noting that we need
secure: falsewhen running the server locally for cht-core development since that is via HTTP.)To Reproduce
Deploy a CHT server production-style (e.g. via Docker Helper).
Run this curl command with your instance info:
See that the result is:
Expected behavior
The result of the curl command should include
Secure;. Like this:Additional context
This secure cookie logic based on
NODE_ENVwas added a long time ago: ae75e27.I found this issue while reviewing this PR which is updating the logging to not be based on NODE_ENV.
I am not exactly sure what the best solution here is. We need to be able to toggle the
securevalue on for production and off for development. I wonder if maybe we just makeNODE_ENV=productioninto our api Dockerfile and call it good... 🤔 I suppose any time we are running in Docker, we are running with HTTPS, correct?