Skip to content

Commit e112968

Browse files
authored
Merge pull request #67 from ChillerDragon/pr_nojs
Prohibit the use of any javascript in the SVGs
2 parents 9f0323d + cd4ff40 commit e112968

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/check_svg_meta.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,26 @@ check_width_height() {
113113
fi
114114
}
115115

116+
check_javascript() {
117+
local file="$1"
118+
local match
119+
# matches both "text/javascript" and <script> tags
120+
while read -r match
121+
do
122+
error "found script: ${match::64}"
123+
done < <(grep -Hn script "$file")
124+
while read -r match
125+
do
126+
error "found function: ${match::64}"
127+
done < <(grep -Hn function "$file")
128+
}
129+
116130
while IFS= read -r file
117131
do
118132
check_absolute_path "$file"
119133
check_meta_filename_match "$file"
120134
check_width_height "$file"
135+
check_javascript "$file"
121136
done < <(find . -type f -name "*.svg")
122137
123138
if [ "$num_errors" -ne "0" ]

0 commit comments

Comments
 (0)