๐Ÿ“ฆ langgenius / dify-sandbox

A lightweight, fast, and secure code execution environment that supports multiple programming languages

โ˜… 1.1k stars โ‘‚ 287 forks ๐Ÿ‘ 1.1k watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/langgenius/dify-sandbox.git
HTTPS git clone https://github.com/langgenius/dify-sandbox.git
SSH git clone git@github.com:langgenius/dify-sandbox.git
CLI gh repo clone langgenius/dify-sandbox
wangxiaolei wangxiaolei feat: support trust host (#213) f851718 1 days ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ build
๐Ÿ“ cmd
๐Ÿ“ conf
๐Ÿ“ dependencies
๐Ÿ“ docker
๐Ÿ“ internal
๐Ÿ“ tests
๐Ÿ“„ .gitignore
๐Ÿ“„ FAQ.md
๐Ÿ“„ go.mod
๐Ÿ“„ go.sum
๐Ÿ“„ install.sh
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ workflow.png
๐Ÿ“„ README.md

Dify-Sandbox

Introduction

Dify-Sandbox offers a simple way to run untrusted code in a secure environment. It is designed to be used in a multi-tenant environment, where multiple users can submit code to be executed. The code is executed in a sandboxed environment, which restricts the resources and system calls that the code can access.

Use

Requirements

DifySandbox currently only supports Linux, as it's designed for docker containers. It requires the following dependencies:
  • libseccomp
  • pkg-config
  • gcc
  • golang 1.20.6

Steps

  • Clone the repository using git clone https://github.com/langgenius/dify-sandbox and navigate to the project directory.
  • Run ./install.sh to install the necessary dependencies.
  • Run ./build/build_[amd64|arm64].sh to build the sandbox binary.
  • Run ./main to start the server.
If you want to debug the server, firstly use build script to build the sandbox library binaries, then debug as you want with your IDE.

FAQ

Refer to the FAQ document

Workflow

workflow