Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.6: Disable MIME-sniffing #63

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.6 (2022-08-04)

Disable MIME-sniffing with `x-content-type-options: NOSNIFF` ([rationale here](https://github.com/canonical/web-design-systems-squad/issues/77#issuecomment-1205100399))

# 1.0.5 (2022-05-05)

Pin to Flask 1.1.2 to avoid dependency conflicts
Expand Down
4 changes: 4 additions & 0 deletions canonicalwebteam/flask_base/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


def set_security_headers(response):
# Decide whether to add x-frame-options
add_xframe_options_header = True

# Check if view_function has exclude_xframe_options_header decorator
Expand All @@ -35,6 +36,9 @@ def set_security_headers(response):
if add_xframe_options_header and "X-Frame-Options" not in response.headers:
response.headers["X-Frame-Options"] = "SAMEORIGIN"

# Add standard security headers
response.headers["X-Content-Type-Options"] = "NOSNIFF"

return response


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="canonicalwebteam.flask-base",
version="1.0.5",
version="1.0.6",
description=(
"Flask extension that applies common configurations"
"to all of webteam's flask apps."
Expand Down