-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Allow valid_origin? to accept subdomains #44
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,7 +415,11 @@ defmodule Wax do | |
end | ||
|
||
defp valid_origin?(client_data, challenge) do | ||
if client_data.origin == challenge.origin do | ||
client_origin = URI.parse(client_data.origin) | ||
challenge_origin = URI.parse(challenge.origin) | ||
|
||
if client_origin.scheme == challenge_origin.scheme && | ||
String.ends_with?(client_origin.host, challenge.rp_id) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like one of my comments didn't get through. I think we would accept a challenge for example.com signed by evil-site-example.com. This is a serious security vulnerability. Treating When accepting PRs for security libraries, I'd prefer the author to be a public identifiable person. It's an additional protection against introduction of vulnerabilities. Please consider creating a PR with such a profile. |
||
:ok | ||
else | ||
{:error, %Wax.InvalidClientDataError{reason: :origin_mismatch}} | ||
|
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.
Better use the boolean
and
operator here. Ensure to run Dialyzer even though I think there are some errors.