2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Remove hidden characters from form fields (#3597)

* Remove control and non-printable characters from form fields (server side)

* Update regex to properly filter out control characters only

* Add regex lib to requirements flie

* Fix regex in javascript (client side)

* add required unicode flag
This commit is contained in:
Oliver
2022-08-24 15:12:02 +10:00
committed by GitHub
parent 2dd5a43444
commit 69c3e5e222
5 changed files with 42 additions and 3 deletions

View File

@ -341,8 +341,8 @@ function sanitizeInputString(s, options={}) {
// Remove ASCII control characters
s = s.replace(/[\x01-\x1F]+/g, '');
// Remove non-printable characters
s = s.replace(/[^ -~]+/g, '');
// Remove Unicode control characters
s = s.replace(/[\p{C}]+/gu, '');
s = s.trim();