Conversation
There was a problem hiding this comment.
there is no danger to using html here, and the html case is clearer. We only need to be concerned about html calls where there can be variable input. Literals are not an issue.
|
Comments addressed |
There was a problem hiding this comment.
I think we can just use html, and just be more careful above about what we allow in. Only prompt_number is input, and we can verity that it's an integer, which is perfectly safe. No need for these shenanigans.
There was a problem hiding this comment.
In fact, with encodeURIComponent above, I'm not sure there is anything to change here at all.
There was a problem hiding this comment.
Yes, and it should be one of the rare injection point that is tested :-) And I think that like IO, that deal with encode/decode. Escaping should be handled as soon as things get grabbed from the .ipynb not at higher lever.
There was a problem hiding this comment.
The problem I have with using .html() in situations where we could get by with .text() is that the content we are passing to .html() today may be safe. But over time, things can creep in-the part of the code creating the content is usually far from the actual call to .html(). I think we should be very aggressive about removing uses of html and all remaining ones should have:
- A comment about why the content is absolutely always safe....or
- A call to
is_safeto verify the content is in fact safe.
There was a problem hiding this comment.
As illustrated by the patch here, this is not actually a case where we can get by with .text(). Escaping the prompt input (already done) and then building html with literals (already done) is perfectly safe.
|
I think this is a bit overzealous, and we need to be clearer about when and why
Because of this, the 'CAUTION' warnings on every |
Commented remaining calls...
Literal = safe
Literal = safe
.html() returns are safe.
|
I'll go back over this and remove the overzealous comments. I think it would be easier for me to just go through with a different PR and use the changed lines here as a reference of where I need to jump to- closing this one here. |
.html(...)calls that could be removed without rewriting lots of notebook code..html(...)TODO: SCRUBcomments before every.html(...)call that needs to be scrubbed.Closes #5034