likhonsheikh commited on
Commit
2f6a76d
Β·
verified Β·
1 Parent(s): 7928d5e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +18 -5
  2. app.py +130 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,12 +1,25 @@
1
  ---
2
  title: Vortex Intercepter
3
- emoji: ⚑
4
- colorFrom: gray
5
- colorTo: pink
6
  sdk: gradio
7
- sdk_version: 6.0.2
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Vortex Intercepter
3
+ emoji: πŸŒ€
4
+ colorFrom: indigo
5
+ colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
+ license: mit
11
  ---
12
 
13
+ # Vortex Intercepter
14
+
15
+ Secure sandbox infrastructure for running AI-generated code in isolated Linux/Xfce environments.
16
+
17
+ ## Features
18
+
19
+ - gVisor kernel isolation
20
+ - JWT session authentication
21
+ - Seccomp syscall filtering
22
+ - NetworkPolicy default-deny
23
+ - Auto-expiry (15 min TTL)
24
+
25
+ See the app for full documentation and API examples.
app.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ DOCS = """
4
+ # πŸŒ€ Vortex Intercepter
5
+
6
+ **Secure sandbox infrastructure for running AI-generated code in isolated Linux/Xfce environments.**
7
+
8
+ ## Features
9
+
10
+ - πŸ›‘οΈ **gVisor RuntimeClass** - Kernel-level isolation
11
+ - πŸ” **JWT Session Auth** - Secure access via nginx proxy
12
+ - 🌐 **NetworkPolicy Default-Deny** - Controller-only ingress
13
+ - πŸ”’ **Seccomp Filtering** - Syscall whitelist
14
+ - ⚑ **Resource Limits** - 512Mi memory, 500m CPU, 150 PIDs
15
+ - ⏱️ **Auto-Expiry** - 15-minute TTL with cleanup
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
21
+ β”‚ Client │────▢│ Nginx Proxy │────▢│ Controller β”‚
22
+ β”‚ (Browser) β”‚ JWT β”‚ (JWT Valid) β”‚ β”‚ (TypeScript) β”‚
23
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
24
+ β”‚
25
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
26
+ β”‚ β”‚ β”‚
27
+ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
28
+ β”‚ Sandbox 1 β”‚ β”‚ Sandbox 2 β”‚ β”‚ Sandbox N β”‚
29
+ β”‚ (gVisor) β”‚ β”‚ (gVisor) β”‚ β”‚ (gVisor) β”‚
30
+ β”‚ Xfce+noVNC β”‚ β”‚ Xfce+noVNC β”‚ β”‚ Xfce+noVNC β”‚
31
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ git clone https://huggingface.co/spaces/vortex-intercepter/vortex-intercepter
38
+ cd vortex-intercepter
39
+
40
+ # Build and run
41
+ make up
42
+
43
+ # Create sandbox
44
+ curl -X POST http://localhost:3000/api/sandbox/create \\
45
+ -H "Content-Type: application/json" \\
46
+ -d '{"owner":"myuser"}'
47
+ ```
48
+
49
+ ## API Endpoints
50
+
51
+ | Method | Endpoint | Description |
52
+ |--------|----------|-------------|
53
+ | POST | `/api/sandbox/create` | Create new sandbox |
54
+ | GET | `/api/sandbox/list` | List all sandboxes |
55
+ | GET | `/api/sandbox/:id/info` | Get sandbox details |
56
+ | POST | `/api/sandbox/stop` | Stop a sandbox |
57
+
58
+ ## Security Layers
59
+
60
+ 1. **Container Isolation** - Each sandbox runs in isolated container
61
+ 2. **gVisor** - User-space kernel for syscall interception
62
+ 3. **Seccomp** - Block dangerous syscalls (mount, ptrace)
63
+ 4. **Capabilities** - Drop ALL, add only SETUID/SETGID
64
+ 5. **Network** - Default deny, controller-only access
65
+ 6. **Resources** - Strict CPU/memory/PID limits
66
+ 7. **TTL** - Auto-destroy after 15 minutes
67
+ """
68
+
69
+ API_EXAMPLE = '''
70
+ # Create Sandbox
71
+ curl -X POST http://localhost:3000/api/sandbox/create \\
72
+ -H "Content-Type: application/json" \\
73
+ -d '{"owner":"demo-user"}'
74
+
75
+ # Response
76
+ {
77
+ "sandbox": {
78
+ "id": "a1b2c3d4-...",
79
+ "containerId": "abc123...",
80
+ "containerIp": "172.28.0.5",
81
+ "createdAt": "2024-01-01T00:00:00Z",
82
+ "expiresAt": "2024-01-01T00:15:00Z"
83
+ },
84
+ "token": "eyJhbGciOiJIUzI1NiIs..."
85
+ }
86
+ '''
87
+
88
+ def simulate_api(owner: str) -> str:
89
+ import uuid
90
+ import json
91
+ from datetime import datetime, timedelta
92
+
93
+ sandbox_id = str(uuid.uuid4())
94
+ now = datetime.utcnow()
95
+
96
+ response = {
97
+ "sandbox": {
98
+ "id": sandbox_id,
99
+ "containerId": f"container-{sandbox_id[:12]}",
100
+ "containerIp": "172.28.0.5",
101
+ "owner": owner or "anonymous",
102
+ "createdAt": now.isoformat() + "Z",
103
+ "expiresAt": (now + timedelta(minutes=15)).isoformat() + "Z"
104
+ },
105
+ "token": f"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzYW5kYm94SWQiOiJ7sandbox_id[:8]}...\"}"
106
+ }
107
+ return json.dumps(response, indent=2)
108
+
109
+ with gr.Blocks(title="Vortex Intercepter", theme=gr.themes.Soft()) as demo:
110
+ gr.Markdown(DOCS)
111
+
112
+ with gr.Accordion("πŸ§ͺ API Simulator", open=False):
113
+ gr.Markdown("Simulate the sandbox creation API (demo only)")
114
+ owner_input = gr.Textbox(label="Owner ID", placeholder="demo-user")
115
+ simulate_btn = gr.Button("Create Sandbox (Simulated)")
116
+ output = gr.Code(label="API Response", language="json")
117
+ simulate_btn.click(simulate_api, inputs=owner_input, outputs=output)
118
+
119
+ with gr.Accordion("πŸ“ API Example", open=False):
120
+ gr.Code(API_EXAMPLE, language="bash")
121
+
122
+ gr.Markdown("""
123
+ ---
124
+ **Repository**: [GitHub](https://github.com/vortex-intercepter/vortex-intercepter) |
125
+ **License**: MIT |
126
+ **Author**: Matrix Agent
127
+ """)
128
+
129
+ if __name__ == "__main__":
130
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio>=4.0.0