Skip to content
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

Always use HTTPS for OIDC redirects #1062

Merged
merged 2 commits into from
Dec 20, 2019
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
3 changes: 1 addition & 2 deletions timesketch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ def create_app(config=None):
if app.config['UPLOAD_ENABLED']:
try:
from plaso import __version__ as plaso_version
app.config['PLASO_VERSION'] = plaso_version
except ImportError:
sys.stderr.write('Upload is enabled, but Plaso is not installed.')
sys.exit()
app.config['PLASO_VERSION'] = plaso_version

# Setup the database.
configure_engine(app.config['SQLALCHEMY_DATABASE_URI'])
Expand Down
12 changes: 10 additions & 2 deletions timesketch/lib/google_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def get_oauth2_authorize_url(hosted_domain=None):
"""
csrf_token = _generate_random_token()
nonce = _generate_random_token()
redirect_uri = url_for('user_views.google_openid_connect', _external=True)
redirect_uri = url_for(
'user_views.google_openid_connect',
_scheme='https',
_external=True
)
scopes = ('openid', 'email', 'profile')

# Add the generated CSRF token to the client session for later validation.
Expand Down Expand Up @@ -160,7 +164,11 @@ def get_encoded_jwt_over_https(code):
"""

discovery_document = get_oauth2_discovery_document()
redirect_uri = url_for('user_views.google_openid_connect', _external=True)
redirect_uri = url_for(
'user_views.google_openid_connect',
_scheme='https',
_external=True
)
post_data = {
'code': code,
'client_id': current_app.config.get('GOOGLE_OIDC_CLIENT_ID'),
Expand Down