Giter Club home page Giter Club logo

Comments (5)

Venryx avatar Venryx commented on June 9, 2024 1

Got it working in Webpack. My problem is that I was not copying the files in node_modules/jailed/lib to the same "dist" directory as my "index.html" file. (jailed needs those files to be accessible when it's online)

Note that, for Webpack, you thus need two steps:

  1. Have the files above copied to the "dist" directory before uploading to your server.
  2. If you're using webpack-dev-server (or equivalent), then you need a way for those files to be served by your local server when developing. If you have a "Resources" folder that is already exposed by the server, then just copy the files there. (depending on your setup, this might also cause the files to automatically be copied to the "dist" directory of step 1, when compiling for production)

from jailed.

GantMan avatar GantMan commented on June 9, 2024

ok, looks like plenty more problems to come, as I'm trying to put this in a webpack react app and it looks like this is not meant for that.

from jailed.

Venryx avatar Venryx commented on June 9, 2024

According to this, it seems you can get it working with Webpack: https://github.com/asvd/jailed/pull/26/files

For context: I'm working on getting it into my own webpack/react app, though am getting a different issue: for some reason the plugin.whenConnected callback is never getting called. (am investigating)

from jailed.

doldsimo avatar doldsimo commented on June 9, 2024

@Venryx
Thanks you helped me a lot, I can now use jailed in my react app.

I have a specific react problem though, maybe you can help me.
Is there a way to render components securely inside the jailed sandbox?

I'm currently working on a project in which I import user-generated content with the help of MDX files into my react app at runtime and want to display these components in the sandbox (because MDX uses the javascript eval method internally).

Unfortunately, I have no idea how to display these components in the jailed sandbox and then display them in my React app.
How I do a calculation in the jailed sandbox works, but unfortunately I have no idea how I can render the possibly unsafe content.

Do you have any approach how I could do this?

from jailed.

Venryx avatar Venryx commented on June 9, 2024

Sorry, but I have not used jailed for a long time (working on other projects), so I don't remember the details of how the library works anymore.

If you're worried about eval being used, I suggest using a Markdown renderer that does not rely on eval or dangerouslySetInnerHTML. The one I use is this: https://github.com/remarkjs/react-markdown

from jailed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.