Speedofmastery commited on
Commit
98d1f5d
Β·
1 Parent(s): af0024b

Auto-commit: README.md updated

Browse files
Files changed (1) hide show
  1. README.md +213 -50
README.md CHANGED
@@ -1,166 +1,329 @@
1
- ---------
2
 
3
  title: Landrun Sandbox + Browser Automation
4
 
5
- emoji: πŸ”’title: Landrun Sandbox + Browser Automationtitle: Docker Sandbox
6
 
7
  colorFrom: purple
8
 
9
- colorTo: blueemoji: πŸ”’πŸŒemoji: 🐳
10
 
11
  sdk: docker
12
 
13
- app_file: app.pycolorFrom: purplecolorFrom: blue
14
 
15
  pinned: false
16
 
17
- license: mitcolorTo: bluecolorTo: purple
18
 
19
  ---
20
 
21
- sdk: dockersdk: docker
22
 
23
  # πŸ”’ Landrun Sandbox + Browser Automation
24
 
25
- pinned: truepinned: false
26
 
27
  **Kernel-Level Code Execution Sandbox with Automated UI Testing**
28
 
29
- license: mitlicense: mit
30
 
31
  Execute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.
32
 
33
- ------
34
 
35
  ## ✨ Features
36
 
37
-
38
 
39
  ### πŸ”’ Landrun Security
40
 
41
- - **Kernel-level isolation** using Linux Landlock LSM# πŸ”’ Landrun Sandbox + Browser Automation# 🐳 Docker Sandbox Executor
42
 
43
- - **Zero-trust execution** with restricted filesystem access
44
 
45
- - **Read-only system files** - only `/tmp/sandbox` is writable
46
 
47
- - **Network restrictions** - only HTTP/HTTPS allowed
48
 
49
- - **10-second timeout** protection**Kernel-Level Code Execution Sandbox + Automated UI Testing****Secure code execution in isolated Docker containers**
50
 
 
51
 
 
52
 
53
  ### 🌐 Browser Automation
54
 
 
 
55
  - **Playwright Chromium** for automated UI testing
56
 
57
- - **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.## Features
58
 
59
  - **Element interaction** - click, type, wait, get text
60
 
61
- - **One-shot API** - execute code β†’ test UI β†’ get results
62
 
63
 
64
 
65
- ### πŸš€ Supported Languages## ✨ Featuresβœ… **Isolated execution** - Each code run in separate container
66
 
67
- - **Python 3.11** - with stdlib + compilers (gcc, g++)
68
 
69
- - **JavaScript (Node.js)** - server-side executionβœ… **Resource limits** - 256MB RAM, 50% CPU per execution
70
 
71
- - **React (JSX)** - client-side components with live preview
72
 
73
- - **HTML + CSS** - static pages with full styling### πŸ”’ Landrun Securityβœ… **Network disabled** - Maximum security
74
 
 
75
 
 
 
 
76
 
77
- ## πŸ“‘ API Endpoints- **Kernel-level isolation** using Linux Landlock LSMβœ… **Auto-cleanup** - Containers destroyed after execution
78
 
 
79
 
 
80
 
81
- ### 1. Execute Code- **Zero-trust execution** with restricted filesystem accessβœ… **Multiple languages** - Python, JavaScript, React, HTML
82
 
83
  ```bash
84
 
85
- POST /execute- **Read-only system files** - only `/tmp/sandbox` is writable
86
 
87
  Content-Type: application/json
88
 
89
- - **Network restrictions** - only HTTP/HTTPS allowed## Architecture
90
 
91
  {
92
 
93
- "language": "react",- **10-second timeout** protection
94
 
95
  "code": "export default function App() { return <h1>Hello!</h1>; }"
96
 
97
- }```
98
 
99
  ```
100
 
101
- ### 🌐 Browser Automationβ”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
102
 
103
  ### 2. Get Live Preview
104
 
105
- ```bash- **Playwright Chromium** for automated UI testingβ”‚ Hugging Face Space (Docker SDK) β”‚
106
 
107
- GET /preview/{uuid}
 
 
108
 
109
- ```- **Screenshot capture** before/after actionsβ”‚ β”‚
 
 
110
 
 
111
 
112
 
113
- ### 3. Test UI with Browser- **Element interaction** - click, type, waitβ”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
114
 
115
  ```bash
116
 
117
- POST /browser/test- **Text extraction** from elementsβ”‚ β”‚ FastAPI Server (app_docker.py) β”‚ β”‚
118
 
119
  Content-Type: application/json
120
 
121
- - **One-shot API** - execute code β†’ test UI β†’ get resultsβ”‚ β”‚ β”‚ β”‚
122
 
123
  {
124
 
125
- "preview_url": "/preview/uuid",β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
126
 
127
  "actions": [
128
 
129
- {"type": "click", "selector": "button"},### πŸš€ Supported Languagesβ”‚ β”‚ β”‚ Docker Engine (in Space) β”‚ β”‚ β”‚
130
 
131
  {"type": "screenshot"}
132
 
133
- ]- **Python 3.11** - with stdlib + compilersβ”‚ β”‚ β”‚ β”‚ β”‚ β”‚
134
 
135
  }
136
 
137
- ```- **JavaScript (Node.js)** - server-side executionβ”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
138
 
139
 
140
 
141
- ### 4. Execute + Test (One-Shot)- **React (JSX)** - client-side components with live previewβ”‚ β”‚ β”‚ β”‚ Python:3.11 β”‚ β”‚ Node:18 β”‚ β”‚ β”‚ β”‚
 
 
142
 
143
  ```bash
144
 
145
- POST /browser/execute_and_test- **HTML + CSS** - static pages with full stylingβ”‚ β”‚ β”‚ β”‚ Container β”‚ β”‚ Container β”‚ β”‚ β”‚ β”‚
146
 
147
- Content-Type: application/json
148
 
149
- β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
150
 
151
- {
152
 
153
- "language": "react",## πŸ“‘ API Endpointsβ”‚ β”‚ β”‚ β”‚ β€’ 256MB RAM β”‚ β”‚ β€’ 256MB RAM β”‚ β”‚ β”‚ β”‚
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
- "code": "export default function App() { return <button>Click</button>; }",
156
 
157
- "actions": [β”‚ β”‚ β”‚ β”‚ β€’ 50% CPU β”‚ β”‚ β€’ 50% CPU β”‚ β”‚ β”‚ β”‚
158
 
159
- {"type": "click", "selector": "button"},
160
 
161
- {"type": "screenshot"}### POST /execute - Execute Code with Landrunβ”‚ β”‚ β”‚ β”‚ β€’ No Network β”‚ β”‚ β€’ No Network β”‚ β”‚ β”‚ β”‚
162
 
163
- ]
164
 
165
  }### GET /preview/{uuid} - Get Live Preview β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
166
 
 
1
+ ------------
2
 
3
  title: Landrun Sandbox + Browser Automation
4
 
5
+ emoji: πŸ”’title: Landrun Sandbox + Browser Automation
6
 
7
  colorFrom: purple
8
 
9
+ colorTo: blueemoji: πŸ”’title: Landrun Sandbox + Browser Automationtitle: Docker Sandbox
10
 
11
  sdk: docker
12
 
13
+ app_file: app.pycolorFrom: purple
14
 
15
  pinned: false
16
 
17
+ license: mitcolorTo: blueemoji: πŸ”’πŸŒemoji: 🐳
18
 
19
  ---
20
 
21
+ sdk: docker
22
 
23
  # πŸ”’ Landrun Sandbox + Browser Automation
24
 
25
+ app_file: app.pycolorFrom: purplecolorFrom: blue
26
 
27
  **Kernel-Level Code Execution Sandbox with Automated UI Testing**
28
 
29
+ pinned: false
30
 
31
  Execute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.
32
 
33
+ license: mitcolorTo: bluecolorTo: purple
34
 
35
  ## ✨ Features
36
 
37
+ ---
38
 
39
  ### πŸ”’ Landrun Security
40
 
41
+ sdk: dockersdk: docker
42
 
43
+ - **Kernel-level isolation** using Linux Landlock LSM
44
 
45
+ - **Zero-trust execution** with restricted filesystem access# πŸ”’ Landrun Sandbox + Browser Automation
46
 
47
+ - **Read-only system files** - only `/tmp/sandbox` is writable
48
 
49
+ - **Network restrictions** - only HTTP/HTTPS allowedpinned: truepinned: false
50
 
51
+ - **10-second timeout** protection
52
 
53
+ **Kernel-Level Code Execution Sandbox with Automated UI Testing**
54
 
55
  ### 🌐 Browser Automation
56
 
57
+ license: mitlicense: mit
58
+
59
  - **Playwright Chromium** for automated UI testing
60
 
61
+ - **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.
62
 
63
  - **Element interaction** - click, type, wait, get text
64
 
65
+ - **One-shot API** - execute code β†’ test UI β†’ get results------
66
 
67
 
68
 
69
+ ### πŸš€ Supported Languages## ✨ Features
70
 
 
71
 
 
72
 
73
+ - **Python 3.11** - with stdlib + compilers (gcc, g++)
74
 
75
+ - **JavaScript (Node.js)** - server-side execution
76
 
77
+ - **React (JSX)** - client-side components with live preview### πŸ”’ Landrun Security
78
 
79
+ - **HTML + CSS** - static pages with full styling
80
+
81
+ - **Kernel-level isolation** using Linux Landlock LSM# πŸ”’ Landrun Sandbox + Browser Automation# 🐳 Docker Sandbox Executor
82
 
83
+ ## πŸ“‘ API Endpoints
84
 
85
+ - **Zero-trust execution** with restricted filesystem access
86
 
87
+ ### 1. Execute Code
88
 
89
+ - **Read-only system files** - only `/tmp/sandbox` is writable
90
 
91
  ```bash
92
 
93
+ POST /execute- **Network restrictions** - only HTTP/HTTPS allowed
94
 
95
  Content-Type: application/json
96
 
97
+ - **10-second timeout** protection**Kernel-Level Code Execution Sandbox + Automated UI Testing****Secure code execution in isolated Docker containers**
98
 
99
  {
100
 
101
+ "language": "react",
102
 
103
  "code": "export default function App() { return <h1>Hello!</h1>; }"
104
 
105
+ }### 🌐 Browser Automation
106
 
107
  ```
108
 
109
+ - **Playwright Chromium** for automated UI testing
110
 
111
  ### 2. Get Live Preview
112
 
113
+ - **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.## Features
114
 
115
+ ```bash
116
+
117
+ GET /preview/{uuid}- **Element interaction** - click, type, wait, get text
118
 
119
+ ```
120
+
121
+ - **One-shot API** - execute code β†’ test UI β†’ get results
122
 
123
+ ### 3. Test UI with Browser
124
 
125
 
 
126
 
127
  ```bash
128
 
129
+ POST /browser/test### πŸš€ Supported Languages## ✨ Featuresβœ… **Isolated execution** - Each code run in separate container
130
 
131
  Content-Type: application/json
132
 
133
+ - **Python 3.11** - with stdlib + compilers (gcc, g++)
134
 
135
  {
136
 
137
+ "preview_url": "/preview/uuid",- **JavaScript (Node.js)** - server-side executionβœ… **Resource limits** - 256MB RAM, 50% CPU per execution
138
 
139
  "actions": [
140
 
141
+ {"type": "click", "selector": "button"},- **React (JSX)** - client-side components with live preview
142
 
143
  {"type": "screenshot"}
144
 
145
+ ]- **HTML + CSS** - static pages with full styling### πŸ”’ Landrun Securityβœ… **Network disabled** - Maximum security
146
 
147
  }
148
 
149
+ ```
150
 
151
 
152
 
153
+ ### 4. Execute + Test (One-Shot)## πŸ“‘ API Endpoints- **Kernel-level isolation** using Linux Landlock LSMβœ… **Auto-cleanup** - Containers destroyed after execution
154
+
155
+
156
 
157
  ```bash
158
 
159
+ POST /browser/execute_and_test
160
 
161
+ Content-Type: application/json### 1. Execute Code- **Zero-trust execution** with restricted filesystem accessβœ… **Multiple languages** - Python, JavaScript, React, HTML
162
 
 
163
 
 
164
 
165
+ {```bash
166
+
167
+ "language": "react",
168
+
169
+ "code": "export default function App() { return <button>Click</button>; }",POST /execute- **Read-only system files** - only `/tmp/sandbox` is writable
170
+
171
+ "actions": [
172
+
173
+ {"type": "click", "selector": "button"},Content-Type: application/json
174
+
175
+ {"type": "screenshot"}
176
+
177
+ ]- **Network restrictions** - only HTTP/HTTPS allowed## Architecture
178
+
179
+ }
180
+
181
+ ```{
182
+
183
+
184
+
185
+ ## 🎯 Quick Start "language": "react",- **10-second timeout** protection
186
+
187
+
188
+
189
+ ### Python Example "code": "export default function App() { return <h1>Hello!</h1>; }"
190
+
191
+
192
+
193
+ ```python}```
194
+
195
+ import requests
196
+
197
+ ```
198
+
199
+ response = requests.post(
200
+
201
+ "https://speedofmastery-hmm.hf.space/browser/execute_and_test",### 🌐 Browser Automationβ”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
202
+
203
+ json={
204
+
205
+ "language": "react",### 2. Get Live Preview
206
+
207
+ "code": """
208
+
209
+ export default function App() {```bash- **Playwright Chromium** for automated UI testingβ”‚ Hugging Face Space (Docker SDK) β”‚
210
+
211
+ const [count, setCount] = React.useState(0);
212
+
213
+ return (GET /preview/{uuid}
214
+
215
+ <div>
216
+
217
+ <h1>Count: {count}</h1>```- **Screenshot capture** before/after actionsβ”‚ β”‚
218
+
219
+ <button onClick={() => setCount(count + 1)}>Increment</button>
220
+
221
+ </div>
222
+
223
+ );
224
+
225
+ }### 3. Test UI with Browser- **Element interaction** - click, type, waitβ”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
226
+
227
+ """,
228
+
229
+ "actions": [```bash
230
+
231
+ {"type": "click", "selector": "button"},
232
+
233
+ {"type": "screenshot"}POST /browser/test- **Text extraction** from elementsβ”‚ β”‚ FastAPI Server (app_docker.py) β”‚ β”‚
234
+
235
+ ]
236
+
237
+ }Content-Type: application/json
238
+
239
+ )
240
+
241
+ - **One-shot API** - execute code β†’ test UI β†’ get resultsβ”‚ β”‚ β”‚ β”‚
242
+
243
+ result = response.json()
244
+
245
+ print(result['status']) # 'success'{
246
+
247
+ ```
248
+
249
+ "preview_url": "/preview/uuid",β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
250
+
251
+ ## πŸ”’ Security
252
+
253
+ "actions": [
254
+
255
+ - **Landrun Sandbox:** Kernel-level isolation using Linux Landlock
256
+
257
+ - **Read-only:** `/usr`, `/lib`, `/etc` are read-only {"type": "click", "selector": "button"},### πŸš€ Supported Languagesβ”‚ β”‚ β”‚ Docker Engine (in Space) β”‚ β”‚ β”‚
258
+
259
+ - **Writable:** Only `/tmp/sandbox` is writable
260
+
261
+ - **Network:** TCP ports 80, 443 only {"type": "screenshot"}
262
+
263
+ - **Timeout:** 10 seconds max execution
264
+
265
+ - **Browser:** Headless Chromium with 5s action timeout ]- **Python 3.11** - with stdlib + compilersβ”‚ β”‚ β”‚ β”‚ β”‚ β”‚
266
+
267
+
268
+
269
+ ## πŸ› οΈ Technology Stack}
270
+
271
+
272
+
273
+ - **Landrun**: Go-based Linux Landlock sandbox```- **JavaScript (Node.js)** - server-side executionβ”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
274
+
275
+ - **FastAPI**: Modern async Python web framework
276
+
277
+ - **Playwright**: Browser automation framework
278
+
279
+ - **Chromium**: Headless browser engine
280
+
281
+ - **Docker**: Multi-stage container build### 4. Execute + Test (One-Shot)- **React (JSX)** - client-side components with live previewβ”‚ β”‚ β”‚ β”‚ Python:3.11 β”‚ β”‚ Node:18 β”‚ β”‚ β”‚ β”‚
282
+
283
+ - **Python 3.11**: Runtime environment with compilers
284
+
285
+ - **Node.js**: JavaScript execution```bash
286
+
287
+
288
+
289
+ ## πŸ“Š Browser ActionsPOST /browser/execute_and_test- **HTML + CSS** - static pages with full stylingβ”‚ β”‚ β”‚ β”‚ Container β”‚ β”‚ Container β”‚ β”‚ β”‚ β”‚
290
+
291
+
292
+
293
+ | Action | Description |Content-Type: application/json
294
+
295
+ |--------|-------------|
296
+
297
+ | `click` | Click element by selector |β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
298
+
299
+ | `type` | Type text into input field |
300
+
301
+ | `get_text` | Extract text from element |{
302
+
303
+ | `wait` | Wait for element to appear |
304
+
305
+ | `screenshot` | Capture screenshot (base64) | "language": "react",## πŸ“‘ API Endpointsβ”‚ β”‚ β”‚ β”‚ β€’ 256MB RAM β”‚ β”‚ β€’ 256MB RAM β”‚ β”‚ β”‚ β”‚
306
+
307
+
308
+
309
+ ## πŸ“„ License "code": "export default function App() { return <button>Click</button>; }",
310
+
311
+
312
+
313
+ MIT License - Free to use and modify "actions": [β”‚ β”‚ β”‚ β”‚ β€’ 50% CPU β”‚ β”‚ β€’ 50% CPU β”‚ β”‚ β”‚ β”‚
314
+
315
+
316
+
317
+ ## πŸ”— Links {"type": "click", "selector": "button"},
318
+
319
 
 
320
 
321
+ - **Live Demo:** [speedofmastery-hmm.hf.space](https://speedofmastery-hmm.hf.space) {"type": "screenshot"}### POST /execute - Execute Code with Landrunβ”‚ β”‚ β”‚ β”‚ β€’ No Network β”‚ β”‚ β€’ No Network β”‚ β”‚ β”‚ β”‚
322
 
323
+ - **Landrun GitHub:** [github.com/zouuup/landrun](https://github.com/zouuup/landrun)
324
 
325
+ - **Playwright Docs:** [playwright.dev](https://playwright.dev) ]
326
 
 
327
 
328
  }### GET /preview/{uuid} - Get Live Preview β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
329