LukeMathWalker / LukeMathWalker/zero-to-production
login flash messages only work because you're talking to localhost
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 585
- PR merge metrics
- No merged PRs in 30d
Description
I was very confused when after switching to actix-web-flash-messages, both the `login::an_error_flash_message_is_set_on_failure` test and the functionality in question stopped working.
I eventually discovered that this is a side effect of my setup; I have `host:` in the local config set to `0.0.0.0` because I'm running my tests on my linux box but my browser is on my windows box (and publishing ports from a container doesn't work when the port is opened on loopback, at least in my podman config).
The specific issue is that actix-web-flash-messages sets Secure on the cookies, which the previous manual cookie solution did not. This appears to be important to you (see https://github.com/LukeMathWalker/actix-web-flash-messages/pull/6 ), but you should be aware it makes things weird in testing situations.
FWIW, the reason the test works with 127.0.0.1 is https://github.com/pfernie/cookie_store/blob/403db6b2bd5acb4844aa9ac5b10f909d273678ee/src/cookie_store.rs#L1552 , so, pretty hacky. :D
To get the browser to work I had to use SSH port forwarding so that I could go to http://localhost/ in the browser, even though it's not actually on the local host.
Fun side note: the version of curl in Debian bullseye *also* fails to be usable with these flash cookies, even on localhost, because https://github.com/curl/curl/commit/c495dcd02e885fc3f35164b1c3c5f72fa4b60c46
Anyway, having lost ~3 hours of my life to this, I thought you should be aware that it's a bit fragile.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the login::an_error_flash_message_is_set_on_failure test and the actix-web-flash-messages integration described in the report. Reproduce the behavior with host set to 0.0.0.0 and with 127.0.0.1, then inspect how Secure cookies are handled. Done means the intended flash-message behavior is established for non-loopback testing and the test or documentation reflects it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100