<commit_before>Jailed — flexible JS sandbox
============================

Jailed is a small JavaScript library for running untrusted code in a
sandbox.

With Jailed you can:

- Load an untrusted code into a secure sandbox;

- Export a set of external functions into the sandbox.

The untrusted code may then interract with the main application by
directly calling those functions, but the application owner decides
which functions to export, and therefore what will be allowed for the
untrusted code to perform.

The code is executed as a *plugin*, a special instance running in a
web-worker inside a sandboxed frame (in case of web-browser
environment), or as a restricted subprocess (in Node.js).

In a web-browser environment the sandbox is created in a local iframe,
so that you don't need to host it on a separate (sub)domain.


You can use Jailed to:

- Setup a safe environment for executing untrusted code, without a
  need to create a sandboxed worker / subprocess manually;

- Do that in an isomorphic way: the syntax is same both for Node.js
  and web-browser, the code works unchanged;

- Execute a code from a string or from a file;

- Initiate and interrupt the execution anytime;

- *[Demo](http://asvd.github.io/jailed/demos/web/console/)* Safely
   execute user-submitted code;

- *[Demo](http://asvd.github.io/jailed/demos/web/banner/)* Delegate to
  a 3rd-party code the precise set of functions to harmlessly operate
  on the part of your application;
  
- Export the particular set of application functions into the sandbox
  (or in the opposite direction), and let those functions be invoked
  from the other site (without a need for manual messaging) thus
  building any custom API and set of permissions.


For instance:


```js<commit_msg>readme updated<commit_after>Jailed — flexible JS sandbox
============================

Jailed is a small JavaScript library for running untrusted code in a
sandbox.

With Jailed you can:

- Load an untrusted code into a secure sandbox;

- Export a set of external functions into the sandbox.

The untrusted code may then interract with the main application by
directly calling those functions, but the application owner decides
which functions to export, and therefore what will be allowed for the
untrusted code to perform.

The code is executed as a *plugin*, a special instance running as a
restricted subprocess (in Node.js), or in a web-worker inside a
sandboxed frame (in case of web-browser environment). The iframe is
created locally, so that you don't need to host it on a separate
(sub)domain.


You can use Jailed to:

- Setup a safe environment for executing untrusted code, without a
  need to create a sandboxed worker / subprocess manually;

- Do that in an isomorphic way: the syntax is same both for Node.js
  and web-browser, the code works unchanged;

- Execute a code from a string or from a file;

- Initiate and interrupt the execution anytime;

- *[Demo](http://asvd.github.io/jailed/demos/web/console/)* Safely
   execute user-submitted code;

- *[Demo](http://asvd.github.io/jailed/demos/web/banner/)* Delegate to
  a 3rd-party code the precise set of functions to harmlessly operate
  on the part of your application;
  
- Export the particular set of application functions into the sandbox
  (or in the opposite direction), and let those functions be invoked
  from the other site (without a need for manual messaging) thus
  building any custom API and set of permissions.


For instance:


```js
{'fraction_non_alphanumeric': 0.0702408256880734, 'fraction_numerical': 0.0005733944954128441, 'mean_word_length': 4.093430656934307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2664459', 'n_tokens_mistral': 967, 'n_tokens_neox': 925, 'n_words': 503}