π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(security): sanitize HTML in comments and v-html paths (GHSA-qxwq, GHSA-8vm4, GHSA-rcph, GHSA-wwp2)
mertmitc4fcf94c20d6
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Comments.vueindex bfc9ee33c3..4a31d41e59 100644--- a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Comments.vue+++ b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Comments.vue@@ -500,7 +500,7 @@ onBeforeUnmount(() => {<div v-else class="space-y-1 pl-9"><divclass="nc-rich-text-content !text-small !leading-18px !text-nc-content-gray"- v-html="parsedHtmlComments[commentItem.id]"+ v-dompurify-html="parsedHtmlComments[commentItem.id]"></div></div></div>diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue b/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vueindex 22ae5516bd..f5014a582c 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue+++ b/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue@@ -232,7 +232,7 @@ const urls = replaceUrlsWithLink(result)width: 'min(1256px, 100vw - 124px)',}"class="nc-long-text-expanded-textarea border-1 border-nc-border-gray-medium bg-nc-bg-gray-extralight !py-1 !px-3 !text-nc-content-gray-extreme !transition-none !cursor-text !min-h-[210px] !rounded-lg focus:border-nc-border-brand disabled:!bg-nc-bg-gray-extralight nc-longtext-scrollbar"- v-html="urls"+ v-dompurify-html="urls"></div><a-textareadiff --git a/packages/nc-gui/components/virtual-cell/Formula.vue b/packages/nc-gui/components/virtual-cell/Formula.vueindex 7c27a7a256..1767891efb 100644--- a/packages/nc-gui/components/virtual-cell/Formula.vue+++ b/packages/nc-gui/components/virtual-cell/Formula.vue@@ -119,7 +119,7 @@ const renderAsCell = computed(() => {'word-break': 'break-all',}"@click="openLongText"- v-html="urls"+ v-dompurify-html="urls"/><LazyCellClampedText v-else :value="result" :lines="rowHeight" />diff --git a/packages/nocodb/src/services/comments.service.ts b/packages/nocodb/src/services/comments.service.tsindex 459f3067ea..ec26862503 100644--- a/packages/nocodb/src/services/comments.service.ts+++ b/packages/nocodb/src/services/comments.service.ts@@ -1,5 +1,6 @@import { Injectable } from '@nestjs/common';import { AppEvents, EventType } from 'nocodb-sdk';+import DOMPurify from 'isomorphic-dompurify';import { Base, Model } from '../models';import type {CommentReqType,@@ -32,6 +33,11 @@ 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,@@ -172,8 +178,12 @@ 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: param.body.comment,+ comment: sanitizedComment,});const model = await Model.getByIdOrName(context, {