Code Structure
The following code file structure outlines the organization of the project:Principle
The core functionality has two entry points: theHTTP service entry for DifySandbox and the dynamic link library entry. When the Sandbox runs code, it first generates a temporary code file. This file begins by calling the dynamic link library to initialize the runtime environment (the Sandbox). The user’s code is then executed within this temporary file, ensuring that the system remains protected from potentially harmful user-submitted code.
The dynamic link library uses Seccomp to restrict system calls. The static directory contains nodejs_syscall and python_syscall files, which provide system call whitelists for both ARM64 and AMD64 architectures. There are four files in total. Please do not modify these files unless absolutely necessary.
How to Contribute
For minor issues likeTypos and Bugs, feel free to submit a Pull Request. For major changes or Feature-level submissions, please open an Issue first to facilitate discussion.
To-Do List
Here are some items we’re currently considering. If you’re interested, you can choose one to contribute:- Support for additional programming languages:
- We currently support
PythonandNode.js. Consider adding support for new languages. - Remember to account for both
ARM64andAMD64architectures, and provideCItesting to ensure security for any new language.
- We currently support
- Node.js dependency management:
- We’ve implemented support for
Pythondependencies, which can be automatically installed during Sandbox initialization. However, due to the complexity ofnode_modules, we haven’t yet found a good solution forNode.js. This is an area open for improvement.
- We’ve implemented support for
- Image processing capabilities:
- As multimodality becomes increasingly important, supporting image processing in the
Sandboxwould be valuable. - Consider adding support for image processing libraries like
Pillow, and enable passing images into theSandboxfor processing inDify.
- As multimodality becomes increasingly important, supporting image processing in the
- Enhanced
CItesting:- Our current
CItesting is limited and includes only basic test cases. More comprehensive testing would be beneficial.
- Our current
- Multimodal data generation:
- Explore using the
Sandboxto generate multimodal data, such as combining text and images.
- Explore using the
Edit this page | Report an issue