Skip to content

Commit 5ca3e23

Browse files
committed
Add gitAttributes file to treat SVGs as binary (not text)
Also prevent SVGs from containing Javascript
1 parent a83ba32 commit 5ca3e23

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.svg -diff

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ post-build-tests-fast: check-for-build-errors ensure-each-svg-has-a-png check-fo
6363
check-for-broken-kramdown-tables check-for-duplicate-header-ids \
6464
check-for-headers-containing-auto-link check-for-missing-subhead-links \
6565
check-for-subheading-anchors \
66-
check-jshint
66+
check-jshint \
67+
check-for-javascript-in-svgs
6768

6869
## All pre-build tests, including those which might take multiple minutes
6970
pre-build-tests: pre-build-tests-fast
@@ -268,3 +269,7 @@ check-for-subheading-anchors:
268269
$S grep -r -i --include \*.html -L 'Note: this file exempt from check-for-subheading-anchors check' _site/ \
269270
| xargs grep '<h[23456]' \
270271
| grep -v '<h[23456][^>]* id=' | eval $(ERROR_ON_OUTPUT)
272+
273+
check-for-javascript-in-svgs:
274+
## Security check: don't allow any SVGs that contain Javascript.
275+
$S find _site/ -name '*.svg' | xargs grep '<script' | eval $(ERROR_ON_OUTPUT)

0 commit comments

Comments
 (0)