Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove dangerouslySetInnerHTML #4181

Merged
merged 1 commit into from
Jul 7, 2023
Merged

fix: remove dangerouslySetInnerHTML #4181

merged 1 commit into from
Jul 7, 2023

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Jul 7, 2023

With using dangerouslySetInnerHTML we are often vulnerable to different injections. Lets try to avoid it until really necessary.

@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 10:43am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 10:43am

/>
const parts = children.split(regex);

const highlightedText = parts.map((part, index) =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using dangerouslySetInnerHTML, we can build the same behaviour from react fragments.

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is cool ⭐

@sjaanus sjaanus merged commit 5388eaf into main Jul 7, 2023
18 checks passed
@sjaanus sjaanus deleted the html-injection branch July 7, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants