@fuentis/phoenix-ui 0.0.9-alpha.606 → 0.0.9-alpha.607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3758,16 +3758,23 @@ class WhiteSpaceValidator {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
|
|
3760
3760
|
function noDangerousCharsValidator() {
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3761
|
+
const dangerousPatterns = [
|
|
3762
|
+
/<\s*script/i, // <script tags
|
|
3763
|
+
/<\s*\/\s*script/i, // </script>
|
|
3764
|
+
/javascript\s*:/i, // javascript: protocol
|
|
3765
|
+
/on\w+\s*=/i, // event handlers like onerror= onclick=
|
|
3766
|
+
/<\s*iframe/i, // iframes
|
|
3767
|
+
/<\s*img[^>]+onerror/i, // <img onerror=
|
|
3768
|
+
/expression\s*\(/i, // CSS expression() attacks
|
|
3769
|
+
/vbscript\s*:/i, // vbscript: protocol
|
|
3770
|
+
];
|
|
3764
3771
|
return (control) => {
|
|
3765
3772
|
const value = control.value;
|
|
3766
3773
|
if (!value)
|
|
3767
3774
|
return null;
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3775
|
+
const str = String(value);
|
|
3776
|
+
const isdangerous = dangerousPatterns.some(pattern => pattern.test(str));
|
|
3777
|
+
return isdangerous ? { dangerousChars: true } : null;
|
|
3771
3778
|
};
|
|
3772
3779
|
}
|
|
3773
3780
|
|