mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
fix(editor): Prevent clipboard XSS injection (#10805)
This commit is contained in:
committed by
GitHub
parent
cef64329a9
commit
db846d3235
@@ -37,6 +37,17 @@ export function sanitizeHtml(dirtyHtml: string) {
|
||||
return sanitizedHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the input is a string and sanitizes it by removing or escaping harmful characters,
|
||||
* returning the original input if it's not a string.
|
||||
*/
|
||||
export const sanitizeIfString = <T>(message: T): string | T => {
|
||||
if (typeof message === 'string') {
|
||||
return sanitizeHtml(message);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
export function setPageTitle(title: string) {
|
||||
window.document.title = title;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user