File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ SQLITE = sqlite3
4
4
5
5
default : venv
6
6
7
- test :: venv
7
+ test : venv
8
8
test/all.sh
9
9
10
10
venv :
13
13
14
14
forum.db :
15
15
$(SQLITE ) $@ < schema.txt
16
+
17
+ .PHONY : test
Original file line number Diff line number Diff line change 14
14
app = Flask (__name__ )
15
15
db = DB (os .getenv ('DB' ))
16
16
17
+ # This defaults to None, which allows CSRF attacks in FireFox
18
+ # and older versions of Chrome.
19
+ # 'Lax' is sufficient to prevent malicious POST requests.
20
+ app .config ['SESSION_COOKIE_SAMESITE' ] = 'Lax'
21
+
17
22
class Config :
18
23
pass
19
24
config = Config ()
@@ -28,6 +33,13 @@ class Role:
28
33
MODERATOR = 1
29
34
ADMIN = 2
30
35
36
+ @app .after_request
37
+ def after_request (response ):
38
+ # This forbids other sites from embedding this site in an iframe,
39
+ # preventing clickjacking attacks.
40
+ response .headers ['X-Frame-Options' ] = 'DENY'
41
+ return response
42
+
31
43
@app .route ('/' )
32
44
def index ():
33
45
return render_template (
You can’t perform that action at this time.
0 commit comments