8000 fix: security doc now provides solid url check by polict · Pull Request #16775 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: security doc now provides solid url check #16775

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

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/tutorial/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ session
callback(true)
}

if (!url.startsWith('https://my-website.com')) {
// Verify URL
if (!url.startsWith('https://my-website.com/')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does that extra / benefit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said in #16774, the current example (if followed by the reader) can be bypassed with an URL which starts with the required string, but may be a subdomain (or part of the domain) like https://my-website.com.attacker.com, which passes the check.
Also, this follows the example provided in point 11 (https://github.com/electron/electron/blob/master/docs/tutorial/security.md#how-9). Another option would be to parse the URL and strictly check the origin like in point 12 (https://github.com/electron/electron/blob/master/docs/tutorial/security.md#how-10).

// Denies the permissions request
return callback(false)
}
Expand Down
0