H5P.JSXGraph
Submitted by alfredwassermann on Mon, 09/27/2021 - 10:45
Forums:
Herewidth, I want to contribute the new h5p content type H5P.JSXGraph and ask to consider it for sharing on H5P.org. It's purpose is to allow to include JSXGraph (see https://jsxgraph.org) constructions easily.
The github repository for H5P.JSXGraph is https://github.com/jsxgraph/H5P.JSXGraph .
Best wishes, Alfred Wassermann
otacke
Sat, 10/09/2021 - 18:49
Permalink
Hi Alfred!Glad to see that
Hi Alfred!
Glad to see that you're digging into H5P development.
One thing that immediately struck me: It's not really a JSXGraph content type, but rather a general purpose JavaScript executor. You're allowing the author to execute arbitrary JavaScript. Even though this is "only" JavaScript on the client, think of what someone could do if he/she creates malicious code and shares the content leading others - usually less tech-versatile teachers - to run it on their platform. I think the `code` value from semantics definitely needs to be sanitized properly if that's possible at all -- or you should not go that route in the first place and create an editor widget that allows the user to create JSXGraphs without writing code directly.
Best,
Oliver
alfredwassermann
Tue, 10/12/2021 - 18:23
Permalink
H5P.JSXGraph security issues
Dear Oliver,
Yes, I agree, you are completely right. I see several possibilities to overcome the security problems:
'<meta http-equiv="Content-Security-Policy" content="navigate-to \'none\'; connect-src \'none\'; worker-src \'none\'; script-src \'unsafe-inline\' \'self\';">'
This should prevent sending forms, opening pop-ups, communication via XHR, fetch, websockets.
Would this be enough? What is your opinion?
From an implmentation point of view, I'm struggling with the following problems at the moment: How can I access the data from the installation and from my file library.json in my JavaScript code which creates the iframe? Specifically, I need:
Best wishes and many thanks, Alfred
P.S: The new version is in the branch "security"
otacke
Wed, 10/13/2021 - 00:33
Permalink
Hi Alfred!I am by no means a
Hi Alfred!
I am by no means a security expert. I simply noticed that you've basically created the equivalent of `eval` and that should be a no-no for obvious reasons. I'm aware that sanititation would virtually be impossible, hence my respective hint in my previous post. And as for CSP headers and similar shenanigans: I can’t tell if those will suffice. But I assume someone from the H5P core team might be of better assistance then I can be if you plan to get you content type hosted on the H5P content type hub.
Best,
Oliver