Replace harden-react-markdown with rehype-harden#170
Merged
haydenbleasel merged 6 commits intomainfrom Oct 10, 2025
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request migrates the
streamdownpackage from usingharden-react-markdownto the newer and more flexiblerehype-hardenfor markdown security hardening. This includes updating the API to accept a newhardenOptionsprop, removing the old security props, and updating dependencies, documentation, and tests accordingly.Migration to rehype-harden and API changes:
Replaced the
harden-react-markdowndependency withrehype-hardenthroughout the codebase, and removed all usage and mocking ofharden-react-markdownin tests and implementation. (packages/streamdown/index.tsx,packages/streamdown/package.json,pnpm-lock.yaml,packages/streamdown/__tests__/*) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Changed the Streamdown component API: replaced the
allowedImagePrefixes,allowedLinkPrefixes, anddefaultOriginprops with a singlehardenOptionsprop that is passed directly torehype-harden. Updated all relevant type definitions and usage. (packages/streamdown/index.tsx,apps/website/app/components/props.tsx,packages/streamdown/README.md) [1] [2] [3] [4] [5] [6] [7]Documentation updates:
harden-react-markdowntorehype-harden, including the newhardenOptionsAPI and changes in the default security plugin. (packages/streamdown/README.md) [1] [2]Testing improvements:
hardenOptionsprop, covering various scenarios and option combinations for security hardening. (packages/streamdown/__tests__/harden-options.test.tsx)hardenOptionsprop and removed tests for the old security props. (packages/streamdown/__tests__/streamdown.test.tsx)Changelog:
harden-react-markdowntorehype-harden. (.changeset/cute-deer-cut.md)