Skip to content

Commit

Permalink
Fix SSRF: do not use urljoin, quote uuids
Browse files Browse the repository at this point in the history
  • Loading branch information
bhelx committed Nov 9, 2017
1 parent 9db2d1a commit 049c746
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions recurly/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import recurly.errors
from recurly.link_header import parse_link_value
from six.moves import http_client
from six.moves.urllib.parse import urlencode, urljoin, urlsplit

from six.moves.urllib.parse import urlencode, urlsplit, quote

class Money(object):

Expand Down Expand Up @@ -338,7 +337,8 @@ def get(cls, uuid):
can be directly requested with this method.
"""
url = urljoin(recurly.base_uri(), cls.member_path % (uuid,))
uuid = quote(str(uuid))
url = recurly.base_uri() + (cls.member_path % (uuid,))
resp, elem = cls.element_for_url(url)
return cls.from_element(elem)

Expand Down Expand Up @@ -606,7 +606,7 @@ def all(cls, **kwargs):
parameters.
"""
url = urljoin(recurly.base_uri(), cls.collection_path)
url = recurly.base_uri() + cls.collection_path
if kwargs:
url = '%s?%s' % (url, urlencode(kwargs))
return Page.page_for_url(url)
Expand All @@ -616,7 +616,7 @@ def count(cls, **kwargs):
"""Return a count of server side resources given
filtering arguments in kwargs.
"""
url = urljoin(recurly.base_uri(), cls.collection_path)
url = recurly.base_uri() + cls.collection_path
if kwargs:
url = '%s?%s' % (url, urlencode(kwargs))
return Page.count_for_url(url)
Expand All @@ -638,7 +638,7 @@ def _update(self):
return self.put(self._url)

def _create(self):
url = urljoin(recurly.base_uri(), self.collection_path)
url = recurly.base_uri() + self.collection_path
return self.post(url)

def put(self, url):
Expand Down

0 comments on commit 049c746

Please sign in to comment.