File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ def create_app(test_config=None):
1313 app .config .from_mapping (
1414 SECRET_KEY = os .environ ["FLASK_SECRET" ],
1515 DATABASE = database ,
16+ SESSION_COOKIE_SECURE = True ,
17+ SESSION_COOKIE_SAMESITE = 'Strict'
1618 )
1719
1820 if test_config is None :
@@ -41,6 +43,22 @@ def create_app(test_config=None):
4143 app .register_blueprint (stats .bp )
4244 app .add_url_rule ('/' , endpoint = 'index' )
4345
46+ @app .after_request
47+ def setSecureHeaders (response ):
48+ headers = {
49+ 'Strict-Transport-Security' : 'max-age=31536000; includeSubDomains' ,
50+ 'Content-Security-Policy' : "default-src 'self'; script-src 'self';\
51+ img-src 'self' https://*.scdn.co data: ;" ,
52+ 'X-Content-Type-Options' : 'nosniff' ,
53+ 'X-Frame-Options' : 'SAMEORIGIN' ,
54+
55+
56+ }
57+
58+ response .headers .update (headers )
59+
60+ return response
61+
4462 return app
4563
4664def getHostname ():
Original file line number Diff line number Diff line change 5252 secretKeyRef :
5353 name : badstats
5454 key : flask_secret
55+ - name : FLASK_ENV
56+ value : " production"
5557 volumeMounts :
5658 - mountPath : /usr/src/app/instance
5759 name : data
You can’t perform that action at this time.
0 commit comments