-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Cookies not sent #1676
Comments
Could you try API with https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies |
@codingskynet thank you for the suggestion, but the api is hosted on https and there is no way to makes calls over http. Not sure what Postman has to do here. Did you meant Bruno ? |
Actually, I experienced like this on |
Just adding my thoughts here. It would be GREAT if Bruno sent secure cookies over a localhost so we don't have to either a.) setup a secure certificate for localhost testing or Webrowser's already do this.
But bruno does not. |
Ok looking quickly at the code, the issue I think is here: https://github.com/usebruno/bruno/blob/main/packages/bruno-electron/src/utils/cookies.js#L14 specifically
Bruno uses tough-cookie. according to those docs you can send in an options opbject as a second argument. By default it considers whether your connection is secure if you have https
So a suggest improvement might be to do something like this
Thoughts? |
It's can be merge your suggestion to next release? |
This implementation does not look comprehensive enough. See this spec It should do some checks with the host instead of simply checking the URL if starts with a specific string. Furthermore, it is also necessary to check if the URL is a local address by CIDR matching. |
Just saw this issue again with a different backend. It would sure be nice to send out SECURE cookies on localhost for local development. How friendly is Bruno to accepting PRs outside the core dev team? |
For those with this problem using http with localhost, one temporary fix that I'm using ngrok to create a https endpoint and it worked fine |
Hi, I'm not able to reproduce the issue on 1.37. Can you check and let me know if it still persists? Thanks! |
I upgraded my Bruno from 1.20 to 1.37 just now. It could be reproduced and behaves the same as 1.20. We have to set the cookie as non- |
I can reproduce the issue too. If the cookie has secure set to True it will not send it to localhost or any http:// |
Can we have an override for "localhost" to be considered "secure"?
Localhost is a secure context only when you have a guarantee that it'll resolve to the loopback address (or the application does that on its own). |
That's a nice point I missed. As this spec says, only treat localhost as secure context when [let localhost be localhost] is confirmed. In simple terms, you're right. |
Hey, I opened a PR for this issue here that implements an RFC 6761 compliant URL trustworthiness check that allows |
Thats great @Chriss4123 maybe @sreelakshmi-bruno can review and get this in. |
Hi, thanks for the contribution, we'll look into it. |
Version: 1.9.0
I have a collection with 2 requests inside,
login
andfoo
. When runninglogin
(POST, with data) I get a response with a set_cookie header :When running request
foo
(GET, not data), cookie is not sent despite it being listed in the cookies visible with the bottom-left cookie and get rejected because of missing access_token.If I manually add the cookie header to the
foo
request, the request is properly authorized.Also, cookie is properly updated each time I call
login
.Both requests uses same protocol + url + port.
Both Store and Send Cookies automatically are enabled. I also tried to deactivate+save then activate+save as I was upgrading from 1.2.0.
I also tried using the runner, in case that could have an impact, but same result.
On a side note, I tried looking at the documentation on how to use the cookies, but could not find any reference.
The text was updated successfully, but these errors were encountered: