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 3007 #3028

Merged
merged 7 commits into from
Jul 27, 2019
Merged

Fix 3007 #3028

merged 7 commits into from
Jul 27, 2019

Conversation

amedora
Copy link
Contributor

@amedora amedora commented May 24, 2019

Description

Not only for mermaid, other code block like 'sequence' as below has potentially XSS problem.

```sequence
<iframe src="javascript:alert('xss');">
\```

Issue fixed

#3007

Type of changes

  • πŸ”˜ Bug fix (Change that fixed an issue)
  • βšͺ Breaking change (Change that can cause existing functionality to change)
  • βšͺ Improvement (Change that improves the code. Maybe performance or development improvement)
  • βšͺ Feature (Change that adds new functionality)
  • βšͺ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • πŸ”˜ My code follows the project code style
  • βšͺ I have written test for my code and it has been tested
  • βšͺ All existing tests have been passed
  • βšͺ I have attached a screenshot/video to visualize my change if possible

@Rokt33r Rokt33r requested review from ZeroX-DG and Rokt33r May 24, 2019 07:29
@Rokt33r Rokt33r added the awaiting review ❇️ Pull request is awaiting a review. label May 24, 2019
browser/components/MarkdownPreview.js Outdated Show resolved Hide resolved
This reverts commit 1ff179a.
@amedora
Copy link
Contributor Author

amedora commented May 28, 2019

I think that most straightforward way to fix this is passing "flowchart: { htmlLabels: false }" option to mermaidAPI.initialize().
https://github.com/BoostIO/Boostnote/blob/76335f78aca94b39841b03af4c212bec65862e5b/browser/components/render/MermaidRender.js#L29-L33
However it would be drawback for users who use HTML in mermaid charts.

@AWolf81
Copy link
Contributor

AWolf81 commented May 28, 2019

@amedora maybe we can add this as option - disabled html labels by default. With a warning at the option that there is a risk of xss. So Mermaid html label users can decide and accept the risk.

That's not perfect but it will fix xss. Maybe we can open an issue at Mermaid so we can track if there will be a fix.

@amedora
Copy link
Contributor Author

amedora commented May 29, 2019

It's now configurable in the option panel. works perfect on my end.
option

# Conflicts:
#	browser/main/lib/ConfigManager.js
@ZeroX-DG ZeroX-DG added awaiting changes πŸ–ŠοΈ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Jul 22, 2019
# Conflicts:
#	locales/da.json
#	locales/de.json
#	locales/en.json
#	locales/es-ES.json
#	locales/fa.json
#	locales/fr.json
#	locales/hu.json
#	locales/it.json
#	locales/ja.json
#	locales/ko.json
#	locales/no.json
#	locales/pl.json
#	locales/pt-BR.json
#	locales/pt-PT.json
#	locales/ru.json
#	locales/sq.json
#	locales/th.json
#	locales/tr.json
#	locales/zh-CN.json
#	locales/zh-TW.json
@ZeroX-DG ZeroX-DG added needs extra review πŸ”Ž Pull request requires review from an additional reviewer. and removed awaiting changes πŸ–ŠοΈ Pull request has been reviewed, but contributor needs to make changes. labels Jul 26, 2019
@ZeroX-DG
Copy link
Member

LGTM πŸŽ‰ But I'll need review from @Rokt33r before I can approve this.

Copy link
Member

@Rokt33r Rokt33r left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘

@Rokt33r Rokt33r added approved πŸ‘ Pull request has been approved by sufficient reviewers. and removed needs extra review πŸ”Ž Pull request requires review from an additional reviewer. labels Jul 27, 2019
@Rokt33r Rokt33r added this to the v0.13.0 milestone Jul 27, 2019
@Rokt33r Rokt33r merged commit 606be43 into BoostIO:master Jul 27, 2019
@Rokt33r Rokt33r removed the approved πŸ‘ Pull request has been approved by sufficient reviewers. label Jul 27, 2019
@amedora amedora deleted the fix-3007 branch September 3, 2019 00:29
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.

None yet

4 participants