Spaces:
Sleeping
Sleeping
Commit Β·
98d1f5d
1
Parent(s): af0024b
Auto-commit: README.md updated
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166---------title: Landrun Sandbox + Browser Automationemoji: πtitle: Landrun Sandbox + Browser Automationtitle: Docker SandboxcolorFrom: purplecolorTo: blueemoji: ππemoji: π³sdk: dockerapp_file: app.pycolorFrom: purplecolorFrom: bluepinned: falselicense: mitcolorTo: bluecolorTo: purple---sdk: dockersdk: docker# π Landrun Sandbox + Browser Automationpinned: truepinned: false**Kernel-Level Code Execution Sandbox with Automated UI Testing**license: mitlicense: mitExecute 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# π Landrun Sandbox + Browser Automation# π³ Docker Sandbox Executor- **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**Kernel-Level Code Execution Sandbox + Automated UI Testing****Secure code execution in isolated Docker containers**### π Browser Automation- **Playwright Chromium** for automated UI testing- **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.## Features- **Element interaction** - click, type, wait, get text- **One-shot API** - execute code β test UI β get results### π Supported Languages## β¨ Featuresβ **Isolated execution** - Each code run in separate container- **Python 3.11** - with stdlib + compilers (gcc, g++)- **JavaScript (Node.js)** - server-side executionβ **Resource limits** - 256MB RAM, 50% CPU per execution- **React (JSX)** - client-side components with live preview- **HTML + CSS** - static pages with full styling### π Landrun Securityβ **Network disabled** - Maximum security## π‘ API Endpoints- **Kernel-level isolation** using Linux Landlock LSMβ **Auto-cleanup** - Containers destroyed after execution### 1. Execute Code- **Zero-trust execution** with restricted filesystem accessβ **Multiple languages** - Python, JavaScript, React, HTML```bashPOST /execute- **Read-only system files** - only `/tmp/sandbox` is writableContent-Type: application/json- **Network restrictions** - only HTTP/HTTPS allowed## Architecture{"language": "react",- **10-second timeout** protection"code": "export default function App() { return <h1>Hello!</h1>; }"}``````### π Browser Automationβββββββββββββββββββββββββββββββββββββββββββββββββββββββ### 2. Get Live Preview```bash- **Playwright Chromium** for automated UI testingβ Hugging Face Space (Docker SDK) βGET /preview/{uuid}```- **Screenshot capture** before/after actionsβ β### 3. Test UI with Browser- **Element interaction** - click, type, waitβ ββββββββββββββββββββββββββββββββββββββββββββββββ β```bashPOST /browser/test- **Text extraction** from elementsβ β FastAPI Server (app_docker.py) β βContent-Type: application/json- **One-shot API** - execute code β test UI β get resultsβ β β β{"preview_url": "/preview/uuid",β β ββββββββββββββββββββββββββββββββββββββββββ β β"actions": [{"type": "click", "selector": "button"},### π Supported Languagesβ β β Docker Engine (in Space) β β β{"type": "screenshot"}]- **Python 3.11** - with stdlib + compilersβ β β β β β}```- **JavaScript (Node.js)** - server-side executionβ β β ββββββββββββββββ ββββββββββββββββ β β β### 4. Execute + Test (One-Shot)- **React (JSX)** - client-side components with live previewβ β β β Python:3.11 β β Node:18 β β β β```bashPOST /browser/execute_and_test- **HTML + CSS** - static pages with full stylingβ β β β Container β β Container β β β βContent-Type: application/jsonβ β β β β β β β β β{"language": "react",## π‘ API Endpointsβ β β β β’ 256MB RAM β β β’ 256MB RAM β β β β"code": "export default function App() { return <button>Click</button>; }","actions": [β β β β β’ 50% CPU β β β’ 50% CPU β β β β{"type": "click", "selector": "button"},{"type": "screenshot"}### POST /execute - Execute Code with Landrunβ β β β β’ No Network β β β’ No Network β β β β]}### GET /preview/{uuid} - Get Live Preview β β β ββββββββββββββββ ββββββββββββββββ β β β123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329------------title: Landrun Sandbox + Browser Automationemoji: πtitle: Landrun Sandbox + Browser AutomationcolorFrom: purplecolorTo: blueemoji: πtitle: Landrun Sandbox + Browser Automationtitle: Docker Sandboxsdk: dockerapp_file: app.pycolorFrom: purplepinned: falselicense: mitcolorTo: blueemoji: ππemoji: π³---sdk: docker# π Landrun Sandbox + Browser Automationapp_file: app.pycolorFrom: purplecolorFrom: blue**Kernel-Level Code Execution Sandbox with Automated UI Testing**pinned: falseExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.license: mitcolorTo: bluecolorTo: purple## β¨ Features---### π Landrun Securitysdk: dockersdk: docker- **Kernel-level isolation** using Linux Landlock LSM- **Zero-trust execution** with restricted filesystem access# π Landrun Sandbox + Browser Automation- **Read-only system files** - only `/tmp/sandbox` is writable- **Network restrictions** - only HTTP/HTTPS allowedpinned: truepinned: false- **10-second timeout** protection**Kernel-Level Code Execution Sandbox with Automated UI Testing**### π Browser Automationlicense: mitlicense: mit- **Playwright Chromium** for automated UI testing- **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.- **Element interaction** - click, type, wait, get text- **One-shot API** - execute code β test UI β get results------### π Supported Languages## β¨ Features- **Python 3.11** - with stdlib + compilers (gcc, g++)- **JavaScript (Node.js)** - server-side execution- **React (JSX)** - client-side components with live preview### π Landrun Security- **HTML + CSS** - static pages with full styling- **Kernel-level isolation** using Linux Landlock LSM# π Landrun Sandbox + Browser Automation# π³ Docker Sandbox Executor## π‘ API Endpoints- **Zero-trust execution** with restricted filesystem access### 1. Execute Code- **Read-only system files** - only `/tmp/sandbox` is writable```bashPOST /execute- **Network restrictions** - only HTTP/HTTPS allowedContent-Type: application/json- **10-second timeout** protection**Kernel-Level Code Execution Sandbox + Automated UI Testing****Secure code execution in isolated Docker containers**{"language": "react","code": "export default function App() { return <h1>Hello!</h1>; }"}### π Browser Automation```- **Playwright Chromium** for automated UI testing### 2. Get Live Preview- **Screenshot capture** before/after actionsExecute code with maximum security using **Landrun** (Linux Landlock kernel security) and automatically test UIs with **Playwright** browser automation.## Features```bashGET /preview/{uuid}- **Element interaction** - click, type, wait, get text```- **One-shot API** - execute code β test UI β get results### 3. Test UI with Browser```bashPOST /browser/test### π Supported Languages## β¨ Featuresβ **Isolated execution** - Each code run in separate containerContent-Type: application/json- **Python 3.11** - with stdlib + compilers (gcc, g++){"preview_url": "/preview/uuid",- **JavaScript (Node.js)** - server-side executionβ **Resource limits** - 256MB RAM, 50% CPU per execution"actions": [{"type": "click", "selector": "button"},- **React (JSX)** - client-side components with live preview{"type": "screenshot"}]- **HTML + CSS** - static pages with full styling### π Landrun Securityβ **Network disabled** - Maximum security}```### 4. Execute + Test (One-Shot)## π‘ API Endpoints- **Kernel-level isolation** using Linux Landlock LSMβ **Auto-cleanup** - Containers destroyed after execution```bashPOST /browser/execute_and_testContent-Type: application/json### 1. Execute Code- **Zero-trust execution** with restricted filesystem accessβ **Multiple languages** - Python, JavaScript, React, HTML{```bash"language": "react","code": "export default function App() { return <button>Click</button>; }",POST /execute- **Read-only system files** - only `/tmp/sandbox` is writable"actions": [{"type": "click", "selector": "button"},Content-Type: application/json{"type": "screenshot"}]- **Network restrictions** - only HTTP/HTTPS allowed## Architecture}```{## π― Quick Start "language": "react",- **10-second timeout** protection### Python Example "code": "export default function App() { return <h1>Hello!</h1>; }"```python}```import requests```response = requests.post("https://speedofmastery-hmm.hf.space/browser/execute_and_test",### π Browser Automationβββββββββββββββββββββββββββββββββββββββββββββββββββββββjson={"language": "react",### 2. Get Live Preview"code": """export default function App() {```bash- **Playwright Chromium** for automated UI testingβ Hugging Face Space (Docker SDK) βconst [count, setCount] = React.useState(0);return (GET /preview/{uuid}<div><h1>Count: {count}</h1>```- **Screenshot capture** before/after actionsβ β<button onClick={() => setCount(count + 1)}>Increment</button></div>);}### 3. Test UI with Browser- **Element interaction** - click, type, waitβ ββββββββββββββββββββββββββββββββββββββββββββββββ β""","actions": [```bash{"type": "click", "selector": "button"},{"type": "screenshot"}POST /browser/test- **Text extraction** from elementsβ β FastAPI Server (app_docker.py) β β]}Content-Type: application/json)- **One-shot API** - execute code β test UI β get resultsβ β β βresult = response.json()print(result['status']) # 'success'{```"preview_url": "/preview/uuid",β β ββββββββββββββββββββββββββββββββββββββββββ β β## π Security"actions": [- **Landrun Sandbox:** Kernel-level isolation using Linux Landlock- **Read-only:** `/usr`, `/lib`, `/etc` are read-only {"type": "click", "selector": "button"},### π Supported Languagesβ β β Docker Engine (in Space) β β β- **Writable:** Only `/tmp/sandbox` is writable- **Network:** TCP ports 80, 443 only {"type": "screenshot"}- **Timeout:** 10 seconds max execution- **Browser:** Headless Chromium with 5s action timeout ]- **Python 3.11** - with stdlib + compilersβ β β β β β## π οΈ Technology Stack}- **Landrun**: Go-based Linux Landlock sandbox```- **JavaScript (Node.js)** - server-side executionβ β β ββββββββββββββββ ββββββββββββββββ β β β- **FastAPI**: Modern async Python web framework- **Playwright**: Browser automation framework- **Chromium**: Headless browser engine- **Docker**: Multi-stage container build### 4. Execute + Test (One-Shot)- **React (JSX)** - client-side components with live previewβ β β β Python:3.11 β β Node:18 β β β β- **Python 3.11**: Runtime environment with compilers- **Node.js**: JavaScript execution```bash## π Browser ActionsPOST /browser/execute_and_test- **HTML + CSS** - static pages with full stylingβ β β β Container β β Container β β β β| Action | Description |Content-Type: application/json|--------|-------------|| `click` | Click element by selector |β β β β β β β β β β| `type` | Type text into input field || `get_text` | Extract text from element |{| `wait` | Wait for element to appear || `screenshot` | Capture screenshot (base64) | "language": "react",## π‘ API Endpointsβ β β β β’ 256MB RAM β β β’ 256MB RAM β β β β## π License "code": "export default function App() { return <button>Click</button>; }",MIT License - Free to use and modify "actions": [β β β β β’ 50% CPU β β β’ 50% CPU β β β β## π Links {"type": "click", "selector": "button"},- **Live Demo:** [speedofmastery-hmm.hf.space](https://speedofmastery-hmm.hf.space) {"type": "screenshot"}### POST /execute - Execute Code with Landrunβ β β β β’ No Network β β β’ No Network β β β β- **Landrun GitHub:** [github.com/zouuup/landrun](https://github.com/zouuup/landrun)- **Playwright Docs:** [playwright.dev](https://playwright.dev) ]}### GET /preview/{uuid} - Get Live Preview β β β ββββββββββββββββ ββββββββββββββββ β β β
README.md+213-50