Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7a2b17e
Merge remote-tracking branch 'remotes/origin/dev-first-party-mode' in…
alexbpx Nov 24, 2018
9b850e5
Merge remote-tracking branch 'remotes/origin/dev' into dev-refactor-c…
alexbpx Nov 24, 2018
1159bbb
Fxied errors
alexbpx Nov 24, 2018
8e2a9d4
Config refactoring
alexbpx Nov 24, 2018
36e5e6e
Config
alexbpx Nov 25, 2018
b65dc14
merging confligcts
alexbpx Nov 25, 2018
c811d14
Deleted Notes
alexbpx Nov 25, 2018
12e2efb
Feactored static files check
alexbpx Nov 25, 2018
47f4b0e
Refactored literals
alexbpx Nov 25, 2018
694ce36
Block activity
alexbpx Nov 25, 2018
e0f9092
Block action added to block acitivity
alexbpx Nov 25, 2018
a89913a
Removed socket_ip from context
alexbpx Nov 25, 2018
4ca2ee2
property
alexbpx Nov 25, 2018
c69dd9e
Telemetry
alexbpx Nov 25, 2018
0385fe5
Whitelist and sensitive route capabilities
alexbpx Nov 25, 2018
2417a14
Merge branch 'dev-refactor-config' into dev-custom-params-enforcer-tel
alexbpx Nov 25, 2018
07c26f9
Changes
alexbpx Nov 26, 2018
63a43b5
px_blocker tests
alexbpx Nov 26, 2018
b685b68
px_utils tests
alexbpx Nov 26, 2018
2e58395
px_validator tests
alexbpx Nov 26, 2018
63332dd
px_validator tests
alexbpx Nov 26, 2018
4c8f7ae
Fixed a few files after running automation
alexbpx Nov 27, 2018
1897868
Merge remote-tracking branch 'remotes/origin/dev' into dev-custom-par…
alexbpx Nov 27, 2018
8b04726
Fixed unittests
alexbpx Nov 27, 2018
35efd5a
Fxied j challenge response
alexbpx Nov 27, 2018
d89edaf
Added px_proxy tests
alexbpx Nov 27, 2018
c0abed6
Fxied building process of telemetry config
alexbpx Nov 27, 2018
6a694ff
Changed telemtry uri
alexbpx Nov 27, 2018
009e13c
Empty tests
alexbpx Nov 27, 2018
7581c84
Empty tests
alexbpx Nov 27, 2018
8b9922a
Fxied captcha loop
alexbpx Nov 28, 2018
febc41d
Fixed captcha loops
alexbpx Nov 28, 2018
757745e
fixed unittests
alexbpx Nov 28, 2018
d827064
Fixed spacing
alexbpx Nov 29, 2018
1e08684
Added custom params - I have no idea where it went
alexbpx Nov 29, 2018
51aebe5
Removed printing of exception in httpc exception handling
alexbpx Nov 29, 2018
666ad59
fixed api_timeout to work with seconds
alexbpx Nov 29, 2018
fedd704
Moved the transformation of timeoit to the getter
alexbpx Nov 29, 2018
0335e20
Moved the transformation of timeoit to the getter
alexbpx Nov 29, 2018
014e5d7
Fixed first party
alexbpx Nov 29, 2018
a6e797c
something
alexbpx Nov 29, 2018
bb1af1a
Holla
alexbpx Nov 29, 2018
6241dd3
Merge branch 'dev' into dev-custom-params-enforcer-tel
Nov 29, 2018
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
2 changes: 1 addition & 1 deletion perimeterx/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _verify(self, environ, start_response):
return self.app(environ, start_response)

def handle_verification(self, ctx, config, environ, start_response):
score = ctx.get('score', -1)
score = ctx.get('risk_score', -1)
result = None
headers = None
status = None
Expand Down
2 changes: 1 addition & 1 deletion perimeterx/px_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def build_context(environ, config):
if len(protocol_split) > 1:
http_version = protocol_split[1]
if key == 'CONTENT_TYPE' or key == 'CONTENT_LENGTH':
headers['Content-type'.replace('_', '-')] = environ.get(key)
headers[key.replace('_', '-').lower()] = environ.get(key)


cookies = Cookie.SimpleCookie(environ.get('HTTP_COOKIE', ''))
Expand Down
2 changes: 1 addition & 1 deletion perimeterx/px_cookie_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def verify(ctx, config):
if px_cookie.is_high_score():
ctx['block_reason'] = 'cookie_high_score'
logger.debug('Cookie with high score: ' + str(ctx['risk_score']))
return True
return False

if px_cookie.is_cookie_expired():
ctx['s2s_call_reason'] = 'cookie_expired'
Expand Down
4 changes: 2 additions & 2 deletions perimeterx/px_httpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def send(full_url, body, headers, config, method):
try:
start = time.time()
if method == 'GET':
response = requests.get(url=full_url, headers=headers, timeout=config.api_timeout)
response = requests.get(url='https://' + full_url, headers=headers, timeout=500, stream=True)
else:
response = requests.post(url=full_url, headers=headers, data=body, timeout=config.api_timeout)
response = requests.post(url='https://' + full_url, headers=headers, data=body, timeout=config.api_timeout)

if response.status_code >= 400:
logger.debug('PerimeterX server call failed')
Expand Down
10 changes: 7 additions & 3 deletions perimeterx/px_proxy_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ def send_reverse_client_request(self, config, context, start_response):
px_constants.ENFORCER_TRUE_IP_HEADER: context.get('ip')}
filtered_headers = px_utils.handle_proxy_headers(context.get('headers'), context.get('ip'))
filtered_headers = px_utils.merge_two_dicts(filtered_headers, headers)
del filtered_headers['content-length']
del filtered_headers['content-type']
response = px_httpc.send(full_url=px_constants.CLIENT_HOST + client_request_uri, body='',
headers=filtered_headers, config=config, method='GET')

self.handle_proxy_response(response, start_response)
return response.content
return response.raw.read()


def send_reverse_xhr_request(self, config, context, start_response, body):
uri = context.get('uri')
Expand Down Expand Up @@ -119,11 +122,12 @@ def send_reverse_captcha_request(self, config, context, start_response):
px_constants.ENFORCER_TRUE_IP_HEADER: context.get('ip')}
filtered_headers = px_utils.handle_proxy_headers(context.get('headers'), context.get('ip'))
filtered_headers = px_utils.merge_two_dicts(filtered_headers, headers)
del filtered_headers['content-length']
del filtered_headers['content-type']
self._logger.debug('Forwarding request from {} to client at {}{}'.format(context.get('uri').lower(), host, uri))
response = px_httpc.send(full_url=host + uri, body='',
headers=filtered_headers, config=config, method='GET')
self.handle_proxy_response(response, start_response)
return response.content

return response.raw.read()