The vulnerability is a classic stored Cross-Site Scripting (XSS) issue affecting NocoDB's comments and rich text cells. The root cause is the lack of input sanitization on the backend and improper rendering on the frontend.
My analysis of the commits between the vulnerable version (<= 0.301.2) and the patched version (0.301.3) confirms this. Specifically, commit c4fcf94c20d6097b2ff6cec1f1aae2caca2c7d0f is the primary security patch for the comments feature.
On the backend, this commit modifies packages/nocodb/src/services/comments.service.ts. The create and update methods within the CommentsService class were identified as vulnerable. They were accepting raw HTML content from users and persisting it to the database. The patch introduces the isomorphic-dompurify library to sanitize the comment content before it's passed to the Comment.insert and Comment.update model methods. These two service methods are the key server-side functions that would appear in a runtime profile during the exploitation of the vulnerability when a malicious comment is submitted.
On the frontend, the same commit, along with commit 468bdd63b8b3ddb1604131f7d25e227725bf6a55, replaces the dangerous v-html directive with v-dompurify-html in several Vue components (Comments.vue, ExpandedText.vue, Formula.vue, and TextArea.vue). This client-side change provides defense-in-depth by ensuring that even if unsanitized data exists in the database (e.g., from before the patch was applied), it is sanitized before being rendered in the user's browser.