Commit 80e7752c authored by Nicolas Gelot's avatar Nicolas Gelot

Update CSP headers

Based on Searx recommendations, see https://github.com/asciimoo/searx/issues/1560#issuecomment-515366654

This patch updates the CSP headers then it enables the image proxy.
parent 49b0b66c
......@@ -13,6 +13,7 @@ services:
VIRTUAL_HOST: ${SPOT_HOSTNAME:-spot}
LETSENCRYPT_HOST: ${SPOT_HOSTNAME:-spot}
SEARX_LOGGER: INFO
SEARX_SECRET: "JCzqlUappxjqi2AHQmCYqqmuufPgdxn9"
proxy:
image: jwilder/nginx-proxy:alpine
......
add_header Content-Security-Policy "frame-ancestors 'self'";
add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; form-action 'self'; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self' https://overpass-api.de; img-src 'self' data: https://*.tile.openstreetmap.org; frame-src https://www.youtube-nocookie.com https://player.vimeo.com https://www.dailymotion.com https://www.deezer.com https://www.mixcloud.com https://w.soundcloud.com https://embed.spotify.com";
add_header Referrer-Policy "no-referrer, strict-origin-when-cross-origin";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
......
......@@ -13,7 +13,7 @@ server:
bind_address : "0.0.0.0" # address to listen on
secret_key : "ultrasecretkey" # change this!
base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/"
image_proxy : False # Proxying image results through searx
image_proxy : True # Proxying image results through searx
http_protocol_version : "1.0" # 1.0 and 1.1 are supported
redis:
......
......@@ -361,7 +361,7 @@ def load_module(filename, module_dir):
def new_hmac(secret_key, url):
return hmac.new(bytes(secret_key, 'utf-8'), url, hashlib.sha256).hexdigest()
return hmac.new(secret_key.encode(), url.encode(), hashlib.sha256).hexdigest()
def to_string(obj):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment