Преглед изворни кода

Merge pull request #6525 from overleaf/jpa-harden-translations-sanitize

[web] scripts/translations: sanitize: double down on angular xss

GitOrigin-RevId: d08deab392942e593e920e648118f0e196af1740
Timothée Alby пре 4 година
родитељ
комит
22ee7d6da2
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      services/web/scripts/translations/sanitize.js

+ 3 - 0
services/web/scripts/translations/sanitize.js

@@ -25,6 +25,9 @@ function sanitize(input) {
       a: ['href', 'class'],
     },
     textFilter(text) {
+      // Block Angular XSS
+      if (text === '{') return '{'
+      if (text === '}') return '}'
       return text
         .replace(/\{\{/, '{{')
         .replace(/\}\}/, '}}')