[WEB-5196] chore: switch from isomorphic-dompurify to dompurify#7983
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRemoved Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
💤 Files with no reviewable changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
d95ffa8 to
b2f8c51
Compare
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
b2f8c51 to
f5ca56c
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the isomorphic-dompurify wrapper with the canonical dompurify package, simplifying dependencies since the application only runs in the browser and doesn't require server-side rendering support.
Key Changes:
- Switched from
isomorphic-dompurifytodompurifyin the shared utils package - Removed redundant
isomorphic-dompurifydependency from the web app - Updated imports to use
dompurifydirectly
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/utils/src/string.ts | Updated import statement to use dompurify instead of isomorphic-dompurify |
| packages/utils/package.json | Replaced isomorphic-dompurify dependency with dompurify |
| apps/web/package.json | Removed redundant isomorphic-dompurify dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
apps/web/package.json(0 hunks)packages/utils/package.json(1 hunks)packages/utils/src/string.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/web/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Cursor Bugbot
- GitHub Check: Build and lint web apps
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/utils/src/string.ts (1)
1-1: The import change is safe—functions using DOMPurify are internal utilities, not exported.Verification shows
sanitizeHTMLandisEmptyHtmlStringare not exported frompackages/utils/src/index.tsand are used exclusively in browser contexts (React components, localStorage operations). No server-side usage detected. The package's conditional exports (import/require) apply to other utilities, not these DOMPurify functions.
Replace isomorphic-dompurify with dompurify package in utils. This change simplifies the dependency and uses the canonical DOMPurify package directly.
f5ca56c to
e494f3d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/space/package.json (1)
34-34: Version pinning is inconsistent with project conventions.The dompurify version is pinned to
"3.2.7"without a caret, whereas most other dependencies in this file use caret ranges (e.g.,^11.11.1,^2.0.0). Pinned versions are more restrictive and can delay security patches.If pinning is intentional for dompurify, please document the rationale. Otherwise, consider aligning with the project's versioning strategy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
apps/space/package.json(2 hunks)apps/web/package.json(0 hunks)packages/utils/package.json(1 hunks)packages/utils/src/string.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/web/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/utils/package.json
- packages/utils/src/string.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-09T22:12:26.424Z
Learnt from: lifeiscontent
PR: makeplane/plane#7922
File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19
Timestamp: 2025-10-09T22:12:26.424Z
Learning: When `types/react` is installed in a TypeScript project (which is standard for React + TypeScript codebases), React types (React.FC, React.ReactNode, React.ComponentProps, etc.) are globally available by design. These type annotations can and should be used without explicitly importing the React namespace. This is a TypeScript/DefinitelyTyped feature, not codebase-specific configuration.
Applied to files:
apps/space/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build and lint web apps
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/space/package.json (1)
34-34: Dependency version alignment confirmed.The dompurify version update to
3.2.7aligns with the migration inpackages/utils/package.jsonand is a backward-compatible minor version bump from3.0.11. No functional impact is expected.
Description
This PR replaces
isomorphic-dompurifywith the canonicaldompurifypackage in shared utils:packages/utils/src/string.tsto importDOMPurifyfromdompurifywith identical sanitize options.packages/utils/package.jsontodompurify.apps/web/package.json(where applicable).pnpm-lock.yamlto a singledompurifyversion.Why:
dompurifyelsewhere for consistency.Impact:
DOMPurify.sanitize) and the allowed tags configuration is unchanged.Type of Change
Screenshots and Media (if applicable)
N/A
Test Scenarios
Functional:
sanitizeHTML,stripAndTruncateHTML, andisEmptyHtmlStringstill remove tags and trim text as before.<img src=x onerror=alert(1)>, inline event handlers, script tags) are removed consistently.Build and Type Checks:
pnpm -w ipnpm -w -r check:typespnpm -w -r check:lintpnpm -w -r buildRegression/Parity:
dompurifyversion inpnpm-lock.yaml.Optional:
pnpm why dompurifyto verify deduplication and thatisomorphic-dompurifyis no longer present.References
Summary by CodeRabbit