Skip to content

Audit .html() calls take #2#5175

Merged
ellisonbg merged 5 commits intoipython:masterfrom
jdfreder:html-take2
Feb 28, 2014
Merged

Audit .html() calls take #2#5175
ellisonbg merged 5 commits intoipython:masterfrom
jdfreder:html-take2

Conversation

@jdfreder
Copy link
Copy Markdown
Contributor

sequel to #5041
closes #5034

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

with with

@jdfreder
Copy link
Copy Markdown
Contributor Author

@minrk I moved the todos into the set_rendered methods and replaced the with with typo's (copied and pasted a couple places).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This suggests that this method should be made safe in a future fix, which I do not think is true. set_rendered ought to be treated as an unsafe method, and any user html should be cleaned before calling set_rendered.

@jdfreder
Copy link
Copy Markdown
Contributor Author

@minrk the last commit treats set_rendered as unsafe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this block should go back to calling set_rendered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a possibility that e.toString() can have use injected html? Some sort of manipulation of the input such that it throws an error with user content (should I add a TODO here?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't revert the whole change, you can still use .text here, just use set_rendered instead of rendered.append (since rendered is undefined now).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh doh! Gotcha

@jdfreder
Copy link
Copy Markdown
Contributor Author

I'm going to give this a test locally to make sure things still work.

@jdfreder
Copy link
Copy Markdown
Contributor Author

This works locally

@ellisonbg
Copy link
Copy Markdown
Member

I think this looks good. Have you gone through all the .html() calls at this point?

@jdfreder
Copy link
Copy Markdown
Contributor Author

Have you gone through all the .html() calls at this point?

Yes, there are quite a few .html('') and literals that are untouched (but don't need to be).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this missing the leading <br/> tag from above?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't need br because there are multiple divs, where there was one div with explicit br before.

@ellisonbg
Copy link
Copy Markdown
Member

A few comments, but probably ready to go.

ellisonbg added a commit that referenced this pull request Feb 28, 2014
@ellisonbg ellisonbg merged commit c8e370d into ipython:master Feb 28, 2014
@jdfreder jdfreder deleted the html-take2 branch March 10, 2014 18:42
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
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.

Audit the places where we call .html(something)

3 participants