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

How secure is this? #418

Closed
ncovercash opened this issue Aug 16, 2016 · 10 comments
Closed

How secure is this? #418

ncovercash opened this issue Aug 16, 2016 · 10 comments
Labels

Comments

@ncovercash
Copy link

What potential exploits are there? Does this library sanitize input?

@cebe
Copy link
Contributor

cebe commented Aug 19, 2016

Does this library sanitize input?

It does not, HTML is allowed to be part of markdown, if you need to sanitize the output you need to pass it through a filter like for example HTML Purifier.

@ncovercash
Copy link
Author

Alright, thankd

@adaur
Copy link

adaur commented Aug 27, 2016

What's the point of setMarkupEscaped then?

@whimsicaldreamer
Copy link

setMarkupEscaped function is used to escape all the html entities for preventing XSS. But according to my issue the problem I was facing was in my DB I already had sanitized input which wasn't converting to html markup during output.
It's better to use this function instead of htmlspecialchars(which I was using) for sanitizing as this even escapes XSS in links.

@ncovercash
Copy link
Author

alright, thanks

@adaur
Copy link

adaur commented Aug 28, 2016

Applying this works great

https://github.com/erusev/parsedown/pull/276/files

@whimsicaldreamer
Copy link

@adaur you are saying to use this instead of setmarkupescaped?

@whimsicaldreamer
Copy link

Would it solve the issue at #421

@adaur
Copy link

adaur commented Aug 28, 2016

Not instead, in addition to. The new safeLinksEnabled is enabled by default using this PR.

I don't know for your issue, since I use a very simple function to replace smilies like :) to their image, after I've called the text function, like this:

function parse_message($text) {
    return $this->do_smilies($this->text($text));
}

@aidantwoods
Copy link
Collaborator

Check out ->setSafeMode(true) in the new release :) (some discussion in #495)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants