Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.1.3] - 2018-09-12
### Fixed
- Detect requests coming from orca pdf generation and disable unsupported secure cookies. [#60](https://github.com/plotly/dash-auth/pull/60)

## [1.1.2] - 2018-08-15
### Fixed
- Remove trailing slash from the cookie path.
Expand Down
18 changes: 17 additions & 1 deletion dash_auth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import itsdangerous
import functools

from ua_parser import user_agent_parser

from .auth import Auth


Expand Down Expand Up @@ -238,11 +240,25 @@ def serve_oauth_redirect(self):

def set_cookie(self, response, name, value, max_age,
httponly=True, samesite='Strict'):

secure = True if 'https:' in self._app_url else False

is_http = flask.request.environ.get(
'wsgi.url_scheme',
flask.request.environ.get('HTTP_X_FORWARDED_PROTO', 'http')
) == 'http'

ua = user_agent_parser.ParseUserAgent(
flask.request.environ.get('HTTP_USER_AGENT', ''))
Comment thread
scjody marked this conversation as resolved.

if ua.get('family') == 'Electron' and is_http:
secure = False

response.set_cookie(
name,
value=value,
max_age=max_age,
secure=True if 'https:' in self._app_url else False,
secure=secure,
path=self._app.config['requests_pathname_prefix'].rstrip('/'),
httponly=httponly,
samesite=samesite
Expand Down
2 changes: 1 addition & 1 deletion dash_auth/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.2'
__version__ = '1.1.3'
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dash_core_components
dash_html_components
dash_renderer
dash>=0.18.3
ua_parser
selenium
mock
tox
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
'dash_html_components',
'dash_core_components',
'retrying',
'itsdangerous>=0.18'
'itsdangerous>=0.18',
'ua_parser'
],
include_package_data=True,
url='https://plot.ly/dash',
Expand Down