Skip to content

Commit 9ed403a

Browse files
committed
feat: safer replacement to avoid <Script /> injections
1 parent df22e64 commit 9ed403a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libraries/helpers/src/utils/strip.html.validation.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const stripHtmlValidation = (
138138
none = false
139139
): string => {
140140
if (type === 'html') {
141-
return value;
141+
return striptags(value, ['ul', 'ol', 'li', 'h1', 'h2', 'h3', 'p', 'strong', 'u']);
142142
}
143143

144144
if (type === 'markdown') {
@@ -178,7 +178,6 @@ export const convertLinkedinMention = (value: string) => {
178178
return value.replace(
179179
/<span.+?data-linkedin-id="(.+?)".+?>(.+?)<\/span>/gi,
180180
(match, id, name) => {
181-
console.log(id, name);
182181
return `@[${name.replace('@', '')}](${id})`;
183182
}
184183
);

0 commit comments

Comments
 (0)