Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

refactor(security): remove server-side DOMPurify from comments service

mertmite35f589d042d
diff --git a/packages/nocodb/src/services/comments.service.ts b/packages/nocodb/src/services/comments.service.ts
index ec26862503..459f3067ea 100644
--- a/packages/nocodb/src/services/comments.service.ts
+++ b/packages/nocodb/src/services/comments.service.ts
@@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common';
import { AppEvents, EventType } from 'nocodb-sdk';
-import DOMPurify from 'isomorphic-dompurify';
import { Base, Model } from '../models';
import type {
CommentReqType,
@@ -33,11 +32,6 @@ export class CommentsService {
) {
validatePayload('swagger.json#/components/schemas/CommentReq', param.body);
- // Sanitize comment HTML to prevent stored XSS
- if (param.body.comment) {
- param.body.comment = DOMPurify.sanitize(param.body.comment);
- }
-
const res = await Comment.insert(context, {
...param.body,
created_by: param.user?.id,
@@ -178,12 +172,8 @@ export class CommentsService {
NcError.get(context).unauthorized('Unauthorized access');
}
- const sanitizedComment = param.body.comment
- ? DOMPurify.sanitize(param.body.comment)
- : param.body.comment;
-
const res = await Comment.update(context, param.commentId, {
- comment: sanitizedComment,
+ comment: param.body.comment,
});
const model = await Model.getByIdOrName(context, {