-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Client side rendering of .ipynb has not been ported from gogs #3279
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
Comments
Gogs uses notebookjs for displaying jupyter notebooks. I still need to research whether notebookjs allows the execution of arbitrary code (like JS code), and in the case it does, it's a no-go and we should instead consider making (or finding) a parser that only displays markup and does not run any user code. |
Ok, I've uploaded a version of the notebook with javascript and style sheet injection. The quick answer is that, as configured, it does allow for execution of code. However, this doesn't constitute an audit of the code, perhaps there's a way to disable it. https://try.gitea.io/memetb/test-ipynb/src/branch/master/Untitled.ipynb Looking at nbpreview which makes use of notebookjs, I can see that it's possible to remove js. Although I'm not yet sure how it's being done. |
Yeah, it seems like code generated from notebookjs should be run through an HTML cleaner/purifier/sanitizer first. |
nbpreview is doing something to this effect. The thing works as a standalone html file, so there may be client side library parameters which allow for this. Either that or it's buggy and not behaving the way it wants to. |
Further info: This is the feature being proposed on gogs. It fails if I put javascript in the dom events. You're right, a server side javascript filter will likely be necessary.
|
It would seem jupyter themselves (c.f. page 34) advocate for the use of Google Caja. So far, from my searching, I haven't found any other library which does what Caja claims to do. It would also appear caja has a standalone js sanitizer. Let me know if you require further research. |
@memetb Could you share your config for rendering jupyter notebook files? |
@lstolcman I'm not sure what you're asking for. Do you mean standalone? I'm using a standard out of the box anaconda installation, if that's what you mean. |
is it planned yet ? It was working on gogs. I had migrated to gitea and ipynb rendering stopped working. |
It would be relatively easy to add ipynb support through an external markup renderer (e.g. using I think the right place for the caching layer is inside the custom renderer (which could be in its own docker container). To enable this, we need gitea to pass not only the file content and URLs but also the commit ID to the renderer. |
"Rendering of jupyter notebook 'rich output' is still missing some capabilities"
...
|
@HarvsG using |
Description
The client-side notebook preview functionality has not been backported from the original gogs repo.
https://try.gogs.io/niklas/ipynb-test/src/master/README.ipynb
https://try.gitea.io/memetb/test-ipynb/src/branch/master/Untitled.ipynb
Issue #3025 mentions using
RENDER_COMMAND = jupyter nbconvert --to html --stdin --stdout
however, there are multiple reasons why this can be problematic:The text was updated successfully, but these errors were encountered: