Skip to content
Closed
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
9 changes: 9 additions & 0 deletions backend/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Base(Configuration):
MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"apps.common.middlewares.csrf_referer_fallback.CsrfRefererFallbackMiddleware",
Expand Down Expand Up @@ -241,6 +242,14 @@ class Base(Configuration):
SLACK_EVENTS_ENABLED = True
SLACK_SIGNING_SECRET = values.SecretValue()

SELF_CONSTANT = "'self'"
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_SSL_REDIRECT = False
X_FRAME_OPTIONS = "DENY"
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"

# HSTS Settings (Strict-Transport-Security)
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = False
4 changes: 4 additions & 0 deletions backend/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ class Local(Base):

SLACK_COMMANDS_ENABLED = True
SLACK_EVENTS_ENABLED = True

# HSTS Overrides for local development
SECURE_HSTS_SECONDS = 0
SECURE_HSTS_PRELOAD = False
31 changes: 31 additions & 0 deletions frontend/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { withSentryConfig } from '@sentry/nextjs'
import type { NextConfig } from 'next'

Expand All @@ -6,6 +7,36 @@ const isLocal = process.env.NEXT_PUBLIC_ENVIRONMENT === 'local'

const nextConfig: NextConfig = {
devIndicators: false,
async headers() {
return [
{
source: '/(.*)',
headers: [
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
...(isLocal ? [] : [
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload'
},
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: https:",
// Removed the jogruber.de API host below
"connect-src 'self' https://*.ingest.sentry.io https://us.i.posthog.com"
].join('; '),
}
]),
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
],
},
]
},
images: {
// This is a list of remote patterns that Next.js will use to determine
// if an image is allowed to be loaded from a remote source.
Expand Down