GithubHelp home page GithubHelp logo

vktr / jails Goto Github PK

View Code? Open in Web Editor NEW
21.0 7.0 2.0 516 KB

A .NET framework for running code in sandboxed AppDomains and/or processes.

Home Page: http://jailsfx.org

License: MIT License

C# 100.00%

jails's Introduction

Jails

Jails is a framework for .NET that simplifies the task of running code in an isolated environment. It comes bundled with an AppDomain isolator which lets you sandbox code in a separate AppDomain.

Currently, it supports two ways of interacting with your sandboxed class. Either through a dynamic proxy, or a typed proxy. The typed proxy lets you specify an interface that acts as a strongly typed proxy.

It is currently in early alpha and may or may not support your specific use case. Please create an issue if you feel something is wrong or missing.

Getting started

Install the latest version of Jails from NuGet.

Install-Package Jails

Isolate external assemblies (using a dynamic proxy)

// Create the AppDomain isolator. By default it only gives the "Execute"
// permission.
var isolator = new AppDomainIsolator();

// Create an environment and register an assembly name with it.
// This will load the assembly in our jailed domain.
var environment = new DefaultEnvironment();
environment.Register(@"C:\Temp\UntrustedAssembly.dll");

using(var jail = Jail.Create(isolator, environment))
{
    // Create a real dynamic proxy which will forward any calls to the
    // internally created instance of "Some.Untrusted.Class".
    dynamic proxy = jail.Resolve("Some.Untrusted.Class");

    // Invoke the method "Run" passing two arguments. Both method name and
    // argument types must match "Some.External.Class".
    string result = proxy.Run("argument1", 2);

    Console.WriteLine(result);
}

For more information, see the wiki

FAQ

  • Why use Jails? Sandboxing code can sometimes be tricky. It doesn't have to be, but Jails try to provide a layer of abstraction on top of sandboxes built with AppDomains and processes.
  • Why strong naming? Strong naming Jails is done to be able to give it full trust in the jailed domain. I know of no other way to accomplish this.

jails's People

Contributors

vktr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jingyiliu

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.