Skip to content

Commit

Permalink
Issue #1328. Add security-related headers into @app.after_request.
Browse files Browse the repository at this point in the history
Note: we don't set STS because localhost is not served over TLS.
Fixes #1328.
  • Loading branch information
Mike Taylor committed Feb 27, 2017
1 parent ffd75dc commit 4af9549
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def before_request():
@app.after_request
def after_request(response):
session_db.remove()
# Security headers
if not app.config['LOCALHOST']:
response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains' # nopep8
response.headers['X-Content-Type-Options'] = 'nosniff'
response.headers['X-XSS-Protection'] = '1; mode=block'
response.headers['X-Frame-Options'] = 'DENY'
return response


Expand Down

0 comments on commit 4af9549

Please sign in to comment.