File size: 2,447 Bytes
d2a4863
af0024b
d2a4863
af0024b
d2a4863
af0024b
d2a4863
af0024b
d2a4863
af0024b
6652512
56e3e70
6652512
af0024b
 
 
 
d2a4863
98d1f5d
d2a4863
 
 
 
 
 
98d1f5d
d2a4863
 
 
 
 
54c9eed
 
d2a4863
 
 
 
54c9eed
d2a4863
54c9eed
d2a4863
 
54c9eed
d2a4863
 
54c9eed
d2a4863
 
54c9eed
d2a4863
 
54c9eed
d2a4863
54c9eed
d2a4863
 
 
 
54c9eed
d2a4863
54c9eed
d2a4863
 
 
 
 
 
54c9eed
d2a4863
54c9eed
d2a4863
 
 
 
 
 
 
54c9eed
d2a4863
54c9eed
d2a4863
54c9eed
 
 
d2a4863
 
 
54c9eed
d2a4863
 
 
8f81467
56e3e70
 
8f81467
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: Landrun Sandbox + Browser Automation
emoji: 🔒
colorFrom: purple
colorTo: blue
sdk: docker
app_file: app.py
pinned: false
license: mit
---

# 🔒 Landrun Sandbox + Browser Automation

**Kernel-Level Code Execution Sandbox with Automated UI Testing**

Execute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.

## Features

### Landrun Security
- Kernel-level isolation using Linux Landlock LSM
- Zero-trust execution with restricted filesystem access
- Read-only system files - only /tmp/sandbox is writable
- Network restrictions - only HTTP/HTTPS allowed
- 10-second timeout protection

### Browser Automation
- Playwright Chromium for automated UI testing
- Screenshot capture before/after actions
- Element interaction - click, type, wait, get text
- One-shot API - execute code and test UI in single call

### Supported Languages
- Python 3.11 with stdlib + compilers
- JavaScript Node.js server-side execution
- React JSX client-side components with live preview
- HTML + CSS static pages with full styling

## API Endpoints

### POST /execute
Execute code in sandbox and get preview URL

### GET /preview/{uuid}
Get live HTML preview of executed code

### POST /browser/test
Test existing preview with browser automation

### POST /browser/execute_and_test
Execute code and test UI in single call (one-shot)

## Quick Start

Python example:
- Execute React code with browser automation
- Click buttons and capture screenshots
- Get test results with base64 screenshots

## Security

- Landrun Sandbox: Kernel-level isolation using Linux Landlock
- Read-only: /usr, /lib, /etc are read-only
- Writable: Only /tmp/sandbox is writable
- Network: TCP ports 80, 443 only
- Timeout: 10 seconds max execution
- Browser: Headless Chromium with 5s action timeout

## Technology Stack

- Landrun: Go-based Linux Landlock sandbox
- FastAPI: Modern async Python web framework
- Playwright: Browser automation framework
- Chromium: Headless browser engine
- Docker: Multi-stage container build
- Python 3.11: Runtime environment with compilers
- Node.js: JavaScript execution

## Browser Actions

Available actions: click, type, get_text, wait, screenshot

## License

MIT License

## Links

- Live Demo: https://speedofmastery-hmm.hf.space
- Landrun GitHub: https://github.com/zouuup/landrun
- Playwright Docs: https://playwright.dev