mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:15:25 -05:00
99a414f345
[misc] rewrite single quote to left/right single quotation mark in locales GitOrigin-RevId: a021fb6841425555b9af79a9146820299cb93fc2
36 lines
691 B
Bash
Executable file
36 lines
691 B
Bash
Executable file
#!/bin/bash
|
||
|
||
set -e
|
||
|
||
TEMPLATES_EXTENDING_META_BLOCK=$(\
|
||
grep \
|
||
--files-with-matches \
|
||
--recursive locales/ \
|
||
--regex "'" \
|
||
|| echo "all-good"
|
||
)
|
||
if [[ "$TEMPLATES_EXTENDING_META_BLOCK" == "all-good" ]]; then
|
||
exit 0
|
||
fi
|
||
|
||
for file in ${TEMPLATES_EXTENDING_META_BLOCK}; do
|
||
cat <<MSG >&2
|
||
|
||
ERROR: $file contains a locale with a single quote.
|
||
|
||
---
|
||
$(grep "$file" --regex "'")
|
||
---
|
||
|
||
Using single quotes in locales can lead to Angular XSS.
|
||
|
||
You will need to replace the quote with a similar looking character.
|
||
’ (\u2019) is a good candidate.
|
||
|
||
Links:
|
||
- https://en.wikipedia.org/wiki/Right_single_quotation_mark
|
||
- https://github.com/overleaf/issues/issues/4478
|
||
|
||
MSG
|
||
exit 1
|
||
done
|