Skip to content

Commit

Permalink
secure cookies, add X-Content-Type-Options header (bug 1371613)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short authored and jezdez committed Sep 6, 2018
1 parent 5d20a19 commit fc46cc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def create_app(load_admin=True):
app.config['SQLALCHEMY_DATABASE_URI'] = settings.SQLALCHEMY_DATABASE_URI
app.config.update(settings.all_settings())

def set_response_headers(response):
response.headers['X-Content-Type-Options'] = 'nosniff'
return response

app.after_request(set_response_headers)
provision_app(app)
db.init_app(app)
migrate.init_app(app, db)
Expand Down
1 change: 1 addition & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def all_settings():

return settings

SESSION_COOKIE_SECURE = True
REDIS_URL = os.environ.get('REDASH_REDIS_URL', os.environ.get('REDIS_URL', "redis://localhost:6379/0"))
PROXIES_COUNT = int(os.environ.get('REDASH_PROXIES_COUNT', "1"))

Expand Down

0 comments on commit fc46cc9

Please sign in to comment.