Skip to content

Conversation

lifeiscontent
Copy link
Collaborator

@lifeiscontent lifeiscontent commented Oct 18, 2025

Description

This PR replaces isomorphic-dompurify with the canonical dompurify package in shared utils:

  • Updated packages/utils/src/string.ts to import DOMPurify from dompurify with identical sanitize options.
  • Swapped the dependency in packages/utils/package.json to dompurify.
  • Removed the extra wrapper dependency from apps/web/package.json (where applicable).
  • Cleaned up and deduped pnpm-lock.yaml to a single dompurify version.

Why:

  • This is a front-end only application; we do not run code on the server. An isomorphic wrapper provides no benefit for our setup.
  • Reduce dependency surface area and avoid an extra wrapper that doesn’t add runtime value for our use-case.
  • Align with existing usage of dompurify elsewhere for consistency.
  • Slightly smaller installs/bundles due to deduplication and fewer transitive deps.

Impact:

  • No functional changes expected. The API remains the same (DOMPurify.sanitize) and the allowed tags configuration is unchanged.
  • Behavior remains browser-only, consistent with how these utils are consumed.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

N/A

Test Scenarios

Functional:

  • Verified sanitizeHTML, stripAndTruncateHTML, and isEmptyHtmlString still remove tags and trim text as before.
  • Manually tested user-generated HTML in rich text inputs (comments/descriptions) to ensure:
    • Valid content renders unchanged.
    • Malicious payloads (e.g., <img src=x onerror=alert(1)>, inline event handlers, script tags) are removed consistently.

Build and Type Checks:

  • pnpm -w i
  • pnpm -w -r check:types
  • pnpm -w -r check:lint
  • pnpm -w -r build

Regression/Parity:

  • Compared sanitized outputs before/after for representative samples to confirm parity.
  • Confirmed workspace resolves a single dompurify version in pnpm-lock.yaml.

Optional:

  • pnpm why dompurify to verify deduplication and that isomorphic-dompurify is no longer present.

References

@lifeiscontent lifeiscontent self-assigned this Oct 18, 2025
Copy link
Contributor

coderabbitai bot commented Oct 18, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/switch-dompurify-package

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Replace isomorphic-dompurify with dompurify package in utils.
This change simplifies the dependency and uses the canonical
DOMPurify package directly.
@lifeiscontent lifeiscontent force-pushed the chore/switch-dompurify-package branch from d95ffa8 to b2f8c51 Compare October 18, 2025 07:28
Copy link

makeplane bot commented Oct 18, 2025

Linked to Plane Work Item(s)

References

This comment was auto-generated by Plane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant