Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: Check for unsafe Content Security Policy #7391

Merged
merged 1 commit into from Jul 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion tools/test-static-code
Expand Up @@ -2,7 +2,7 @@
# run static code checks like pyflakes and pep8
set -eu

echo "1..3"
echo "1..4"

cd "${srcdir:-.}"
fail=0
Expand Down Expand Up @@ -56,4 +56,19 @@ else
echo "ok 3 js-translatable-strings"
fi

#
# Unsafe content-security-policy
#
# It's dangerous to have 'unsafe-inline' or 'unsafe-eval' in our
# content-security-policy entries. This is the browser equivalent
# of setenforce 0
#

if grep -E 'content-security-policy.*(\*|unsafe)' pkg/*/*.json*; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new test now needs to bump the total count on the top. I fixed that during rebasing, pushing now.

echo "not ok 4 unsafe-security-policy"
fail=1
else
echo "ok 4 unsafe-security-policy"
fi

exit $fail