Skip to content

Commit

Permalink
Revert change to Content-Security-Policy: script-src header
Browse files Browse the repository at this point in the history
b/c we're loading an image, not a script and this isn't needed for now
  • Loading branch information
atodorov committed Feb 3, 2025
1 parent 29b358f commit f08483c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion etc/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ http {
}

# WARNING: make sure these match tcms.core.middleware.ExtraHeadersMiddleware
add_header Content-Security-Policy "script-src 'self' cdn.crowdin.com *.ethicalads.io plausible.io static.scarf.sh;";
add_header Content-Security-Policy "script-src 'self' cdn.crowdin.com *.ethicalads.io plausible.io;";

server {
listen 8080;
Expand Down
2 changes: 1 addition & 1 deletion tcms/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ExtraHeadersMiddleware(MiddlewareMixin):
def process_response(self, request, response):
if settings.DEBUG:
response.headers["Content-Security-Policy"] = (
"script-src 'self' cdn.crowdin.com *.ethicalads.io plausible.io static.scarf.sh;"
"script-src 'self' cdn.crowdin.com *.ethicalads.io plausible.io;"
)

if request.path.find("/uploads/") > -1:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ _EOF_
rlPhaseEnd

rlPhaseStartTest "Should send Content-Security-Policy header"
rlRun -t -c "curl -k -D- $HTTPS 2>/dev/null | grep $'Content-Security-Policy: script-src \'self\' cdn.crowdin.com \*.ethicalads.io plausible.io static.scarf.sh;'"
rlRun -t -c "curl -k -D- $PROXY 2>/dev/null | grep $'Content-Security-Policy: script-src \'self\' cdn.crowdin.com \*.ethicalads.io plausible.io static.scarf.sh;'"
rlRun -t -c "curl -k -D- $HTTPS 2>/dev/null | grep $'Content-Security-Policy: script-src \'self\' cdn.crowdin.com \*.ethicalads.io plausible.io;'"
rlRun -t -c "curl -k -D- $PROXY 2>/dev/null | grep $'Content-Security-Policy: script-src \'self\' cdn.crowdin.com \*.ethicalads.io plausible.io;'"
rlPhaseEnd

rlPhaseStartTest "Should not execute inline JavaScript"
Expand Down

0 comments on commit f08483c

Please sign in to comment.