This repository was archived by the owner on Sep 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Starts_with when fetching jku #109
Copy link
Copy link
Open
Description
Hi,
I was looking at the code and it seems like starts_with may not be the ideal method here (or maybe some level of canonicalisation would be good):
| key_prefixes.any? { |acceptable| key_url.starts_with?(acceptable) } |
Example:
http://trusted.com/.well-known/../bad/another_file.json starts_with? http://trusted.com/.well-known/
http://trusted.com/.well-known/../bad/another_bug starts_with? http://trusted.com/.well-known/
http://trusted.com@example.org starts_with? http://trusted.com
One good thing is that your http client configuration doesn't follow redirect so it makes exploitation a lot harder.
It may also be good to enforce the scheme to https in
| json = http_request.get(mapped_url(key_url)).body |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels