diff --git a/Dockerfile b/Dockerfile index dc4e5825e5..7ed814e1ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -99,6 +99,9 @@ COPY --from=frontend-builder /frontend/client/dist /app/client/dist RUN chown -R redash /app USER redash +# Patch 'Feature-Policy' header to 'Permissions-Policy' +COPY ./patches/talisman.py /usr/local/lib/python3.7/site-packages/talisman.py + # Customized runtime environment variables ENV REDASH_WEB_WORKERS=8 ENV WORKER_COUNT=3 diff --git a/patches/talisman.py b/patches/talisman.py new file mode 100644 index 0000000000..2ef53fc649 --- /dev/null +++ b/patches/talisman.py @@ -0,0 +1,381 @@ +# Copyright 2015 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from collections import OrderedDict + +import flask +from six import iteritems, string_types + + +DENY = 'DENY' +SAMEORIGIN = 'SAMEORIGIN' +ALLOW_FROM = 'ALLOW-FROM' +ONE_YEAR_IN_SECS = 31556926 + +DEFAULT_REFERRER_POLICY = 'strict-origin-when-cross-origin' + +DEFAULT_CSP_POLICY = { + 'default-src': '\'self\'', +} + +GOOGLE_CSP_POLICY = { + # Fonts from fonts.google.com + 'font-src': '\'self\' themes.googleusercontent.com *.gstatic.com', + #