-
-
Notifications
You must be signed in to change notification settings - Fork 97
Conversation
I doubt it, as that is just sending an ordinary query to sagenb that one might make anyway. |
See also #252. |
The session cookie is needed. An ordinary request is not sufficient. Only a proper CSR works. But CSRF is usually exploited via XSS. The CSRF risk can be reduced by avoiding code injection. This patch points to this direction but I agree with you, I realize (#319) this doesn't solve the current XSS Notebook's problems. |
d2b075c
to
52d5349
Compare
Eyeball code review looks OK. I will try to test before the week is out. It even looks compatible with #328. |
I haven't found anything this breaks and can verify that it is compatible with #328 as well. Positive review. |
Thanks for that! I agree that nothing obviously bad sticks out. I still want to look at it carefully as well, though. @migeruhito - any sense on what you would most expect to break? |
52d5349
to
a672761
Compare
First I reverted #323, because this pull request itself fix #318. Not reverting that, could be confusing for a future collaborator. Redundant code is bad and not only for efficiency reasons.
It could break two kind of things:
|
bcfd1aa
to
63f5426
Compare
63f5426
to
f00d442
Compare
It seems to me that @gutow has partially merged this branch on
|
Since @gutow has indicated he won't be able to look at his stuff immediately anyway, I'm happy to merge this based on his review. I'll just be looking at it again over the next few days and possibly trying a bit out, but expect merge soon. Thanks! |
I'm testing this currently, expect to include in http://trac.sagemath.org/ticket/19616 |
Apparently it does.
They all look like this:
I wonder if there is an easy way to fix the doctest. Certainly the notebook itself seems to work fine. |
To be clear, I don't want to leave it untested, because untested is even more broken, but I am happy to do any quick fixes I can if @migeruhito has any pointers for me. The type of test is exactly what you suspected:
So we just need some alternate way to test that this html is generated correctly without actually launching the app. As a first very naive attempt, I did
but that fails with An alternate approach that would take more time is to create an app that doesn't actually launch anything that could be used only for testing purposes, but figuring out how to do that could take me quite a bit of time. E.g. here:
but I don't know whether that would be a good idea to try. This discussion also seems relevant. |
I think that your last approach is the way to be taken. I'm working on it. |
The doctests are fixed (I hope). |
Oh, I'm so pleased that some of my research was useful! Yes, it passes tests now. THANK you! |
I was happy otherwise and @gutow likes it, so I'm merging. I think this will be the last thing in the next point release of sagenb. |
@migeruhito - this seems to work pretty fine overall. But I am noticing that now the default "safe" mode means that certain live documentation doesn't work properly, because it uses things that are escaped. E.g. http://localhost:8080/doc/live/tutorial/tour_rings.html should have something like this as the first cell:
But of course this is escaped to
Neither is
instead of
in http://localhost:8080/doc/live/tutorial/tour_functions.html Any ideas how to get around that? I believe there should be some setting for live cells and maybe in that event we could add |
Maybe at https://github.com/sagemath/sagenb/blob/master/sagenb/data/sage/html/notebook/cell.html#L83
could have a |
I'm working on it. |
If we add
This works fine with The actual problem is the following:
It seems that a Still working. |
A worst example of the above mentioned bug:
I think that the problem is in the methods to save and load worksheets. |
See #354 for a ( |
The Jinja2 automatic autoescape has been enabled. Now the flask application adopts the Flask defaults and the Jinja2 environment is initialized by the
flask.Flask
class. Now, any externally generated html must be declared explicitly assafe
not to be escaped. This should help to make the Notebook more secure.Does that solve any problem related to #319?
This changeset include non trivial changes and should be tested intensively. Several new bugs are expected.