Skip to content
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

Cookies are sent to domains that are not allowed #1758

Closed
3 tasks done
ShiraNagen opened this issue Dec 15, 2022 · 1 comment
Closed
3 tasks done

Cookies are sent to domains that are not allowed #1758

ShiraNagen opened this issue Dec 15, 2022 · 1 comment
Labels

Comments

@ShiraNagen
Copy link
Contributor

ShiraNagen commented Dec 15, 2022

Describe the bug

I use superagent.agent() to run several requests. The cookies from set-cookies are sent to all domains without checking if the domain is the one that the set-cookie returned from.

Actual behavior

I send a request to httpbin.org that returns a header with set-cookie and then send a request to google.com and the cookie from httpbin is sent to google as well

Expected behavior

The cookie of google request should be empty

Code to reproduce

const superagent = require("superagent")
const request = superagent.agent();
const cookie = encodeURIComponent('_ga=s%3ACcsRO5I9SasTzV;Path=/;Expires=Sat,07Jan202313:53:43GMT')2023 13:53:43 GMT')
await request.get(`http://httpbin.org/response-headers?set-cookie=${cookie}`);
request.get('https://google.com').cookies;

This pull request solves that issue: #1757

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
@ShiraNagen ShiraNagen added the Bug label Dec 15, 2022
@ShiraNagen ShiraNagen changed the title Cookies send to domains that are not allowed Cookies are sent to domains that are not allowed Dec 15, 2022
@titanism
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants