-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
fix: throw error on invalid URLs when setting cookie #18756
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor change. Thanks!
Co-Authored-By: Samuel Attard <samuel.r.attard@gmail.com>
Co-Authored-By: Samuel Attard <samuel.r.attard@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporarily requesting a hold while we figure out why the is_valid
change blew up the test suite on master --> #18770 (review)
Release Notes Persisted
|
Congrats on merging your first pull request! 🎉🎉🎉 |
I was unable to backport this PR to "4-2-x" cleanly; |
@erickzhao trop failed us here; can you open a manual bp to |
A maintainer has manually backported this PR to "4-2-x", please check out #18911 |
Description of Change
With this PR, invalid inputs to the
url
parameter will throw an error when usingcookie.set()
. This is done by checking if the URL is parseable usingGURL
rather than checking if the URL string being passed in is empty.Previously, invalid URLs would be able to be added as a cookie, but you would not be able to filter for them or remove them.
See Electron Fiddle gist: https://gist.github.com/d8ae35040d44d426cb40d97d5d77a47e
N.B. This behavior was fixed in Electron 6, so we based this PR a lot on the changes in the cookies API from 5.0.3 to 6.0.0-beta.
This issue was discovered when playing around with the example from #18220.
cc @deermichel @codebytere @ckerr
Checklist
npm test
passes(https://github.com/electron/electron/blob/master/docs/development/testing.md)Release Notes
Notes: Added check for invalid URLs upon setting cookies