Enables code execution within a Docker sandbox
All checks were successful
Build and Push Docker Images / build (src/LiquidCode.Tester.Gateway/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman, gateway) (push) Successful in 53s
Build and Push Docker Images / build (src/LiquidCode.Tester.Worker/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-worker-roman, worker) (push) Successful in 3m51s

Adds a Docker-based execution sandbox to enhance the security and resource management of code execution.

This change introduces:
- New execution services for C#, C++, Java, Kotlin, and Python that utilize the sandbox.
- Configuration options for enabling/disabling the sandbox and specifying Docker images for different languages.
- Batch execution support for C++ to improve the efficiency of generating answer files.
- Docker CLI installation in the worker's Dockerfile.

The sandbox provides improved isolation and resource control during code execution, preventing potential security vulnerabilities and resource exhaustion.
This commit is contained in:
2025-11-05 01:18:12 +03:00
parent 8e6c2c222e
commit 147c95a48a
19 changed files with 1023 additions and 507 deletions

View File

@@ -1,4 +1,5 @@
using LiquidCode.Tester.Worker.Services;
using LiquidCode.Tester.Worker.Services.Sandbox;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -32,6 +33,7 @@ public class ExecutionServiceFactoryTests
services.AddSingleton<KotlinExecutionService>();
services.AddSingleton<CSharpExecutionService>();
services.AddSingleton<PythonExecutionService>();
services.AddSingleton<IExecutionSandbox>(_ => Mock.Of<IExecutionSandbox>());
_serviceProvider = services.BuildServiceProvider();
_factory = new ExecutionServiceFactory(