Skip to content

Commit

Permalink
Forbid iframes
Browse files Browse the repository at this point in the history
This prevents clickjacking attacks.
  • Loading branch information
Demindiro committed Feb 1, 2023
1 parent 0827fb2 commit a372d7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.py
Expand Up @@ -33,6 +33,13 @@ class Role:
MODERATOR = 1
ADMIN = 2

@app.after_request
def after_request(response):
# This forbids other sites from embedding this site in an iframe,
# preventing clickjacking attacks.
response.headers['X-Frame-Options'] = 'DENY'
return response

@app.route('/')
def index():
return render_template(
Expand Down

0 comments on commit a372d7d

Please sign in to comment.