Skip to content

dartdoc should sanitize html #1995

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

Closed
redcrossp opened this issue Jul 30, 2019 · 5 comments
Closed

dartdoc should sanitize html #1995

redcrossp opened this issue Jul 30, 2019 · 5 comments
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@redcrossp
Copy link

redcrossp commented Jul 30, 2019

I posted the following in a now-closed issue report re: dartdoc does not escape html:

This issue should be reopened for discussion. I recently found this problem when l labeling an input parameter in a comment; something like:

/// Generates a filtered image at <name>.bmp
void generateOutlineBitmap(String name, /* etc ... */) {

The generated html includes a name tag, and this exploit could be leveraged for harmful attacks. It seems that an html-generating program should sanitize its input for this.

Originally posted by @redcrossp in #1458 (comment)

Is there a reason this isn't the current behavior? Are steps being taken to implement this?

@redcrossp
Copy link
Author

I see this relates to issues like #1529 (comment) and #1527 (comment), but why isn't simply all input escaped here?

@keertip
Copy link
Collaborator

keertip commented Jul 30, 2019

You are right, this should be escaped. Not sure why all input is not escaped, will take a look.

@jcollins-g jcollins-g added type-enhancement A request for a change that isn't a bug P2 A bug or feature request we're likely to work on and removed type-enhancement A request for a change that isn't a bug labels Sep 30, 2019
@jcollins-g jcollins-g added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Apr 24, 2020
@jcollins-g
Copy link
Contributor

Dartdoc intentionally allows some html. However, right now it allows a very broad range of HTML to be encoded and it's not documented what we allow and don't. This should be locked down further.

@jcollins-g
Copy link
Contributor

This is likely to be implemented via https://pub.dev/packages/sanitize_html.

@jcollins-g jcollins-g added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P2 A bug or feature request we're likely to work on labels Sep 21, 2021
@jcollins-g jcollins-g changed the title dartdoc should escape html. dartdoc should sanitize html Sep 21, 2021
@srawlins
Copy link
Member

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants