mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: make HTML attribute sanitization stricter (#8977)
* feat: make HTML attribute sanitization stricter * fix double escape
This commit is contained in:
parent
c84babf574
commit
b63689c230
5 changed files with 32 additions and 12 deletions
|
@ -1225,3 +1225,16 @@ export class PromisePool<T> {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const sanitizeHTMLAttribute = (html: string) => {
|
||||
return (
|
||||
html
|
||||
// note, if we're not doing stupid things, escaping " is enough,
|
||||
// but we might end up doing stupid things
|
||||
.replace(/&/g, "&")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/</g, "<")
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue