diff --git a/backend/src/models/Snippet.ts b/backend/src/models/Snippet.ts index e0ab7b7..659b633 100644 --- a/backend/src/models/Snippet.ts +++ b/backend/src/models/Snippet.ts @@ -86,7 +86,7 @@ SnippetSchema.pre('save', function (next) { // Remover atributos perigosos let previousCode; - const dangerousAttrRegex = /on\w+=(["'])(?:(?=(\\?))\2.)*?\1/g; + const dangerousAttrRegex = /on\w+=(["'])(?:(?=(\\?))\2.)*?\1|javascript:|data:|vbscript:/gi; do { previousCode = this.code; this.code = this.code.replace(dangerousAttrRegex, '');