Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
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";
+1 −1
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -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):