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

[Security] Vulnerable to XSS attacks. #56

Closed
OmkarK45 opened this issue Oct 28, 2020 · 6 comments
Closed

[Security] Vulnerable to XSS attacks. #56

OmkarK45 opened this issue Oct 28, 2020 · 6 comments

Comments

@OmkarK45
Copy link

Issue : The textarea doesn't do any validation or sanitize any input to it.

What is happening : This makes editor execute inline html code.

How to reproduce ? : Simply type <img src onerror="alert('hey!')"/> in input box

@OmkarK45
Copy link
Author

Screenshot
image

@jaywcjlove
Copy link
Member

@OmkarK45 You can try to setting previewOptions?: ReactMarkdownProps;

<MDEditor
  value="Hello Markdown!"
  previewOptions={{
  
  }}
/>
  • transformLinkUri - function|null Function that gets called for each encountered link with a single argument - uri. The returned value is used in place of the original. The default link URI transformer acts as an XSS-filter, neutralizing things like javascript:, vbscript: and file: protocols. If you specify a custom function, this default filter won't be called, but you can access it as require('react-markdown').uriTransformer. If you want to disable the default transformer, pass null to this option.
  • escapeHtml - boolean Setting to false will cause HTML to be rendered (see notes below about proper HTML support). Be aware that setting this to false might cause security issues if the input is user-generated. Use at your own risk. (default: true).
  • skipHtml - boolean Setting to true will skip inlined and blocks of HTML (default: false).

@OmkarK45
Copy link
Author

Thank you for replying. I will try this ✌️

@OmkarK45
Copy link
Author

Update : Your answer fixed the issue. Thanks again. I'm closing the issue now.

@OmkarK45
Copy link
Author

OmkarK45 commented Oct 30, 2020 via email

@jaywcjlove
Copy link
Member

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

No branches or pull requests

2 participants