Architecture for Compiling and Executing C# Code within a MUD Server - wwestlake/Labyrinth GitHub Wiki
Architecture for Compiling and Executing C# Code within a MUD Server
Technical Components:
- Roslyn Compiler: Utilize the Roslyn .NET Compiler Platform for dynamic C# code compilation at runtime.
- Execution Environment: Implement a secure, sandboxed environment for isolated code execution.
- Script Management API: Backend API for managing script lifecycle (upload, compile, execute, delete).
- Admin UI Integration: Connect the script management API with the Admin UI for direct interaction.
- Security and Restrictions:
- Sandboxing: Use AppDomains for code isolation.
- Code Analysis: Pre-execution analysis to block dangerous operations.
- Permission Sets: Limit accessible namespaces and classes.
Recommendations:
- Roslyn Scripting API: Use for secure, sandboxed script execution.
- Custom Whitelisting: Only allow specific namespaces/classes.
- Time and Memory Limits: Prevent resource abuse with execution limits.
- Logging and Auditing: Track script execution for auditing and debugging.
- Regular Security Reviews: Update security measures continuously.
This architecture ensures secure, maintainable C# code execution within the MUD server.