You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To ensure secure communication between clients and PicoD, we adopt a JWT + JWKS-based authentication model. This approach eliminates the need for pre-injecting keys into warm sandboxes, which is incompatible with the warm pool strategy used by AgentCube.
220
+
PicoD implements a secure, lightweight authentication system designed specifically for sandbox environments.
221
221
222
-
-**JWT (JSON Web Token):** Clients sign requests with a short-lived JWT using their private key.
222
+
The core approach provides an **init interface** (`POST /api/init`) that establishes authentication credentials when a sandbox is allocated to an end user. The primary protection scenario is ensuring that **user-requested sandboxes can only be accessed by the designated user** - we only need to guarantee that the sandbox allocated to a user remains exclusive to that user throughout its lifecycle.
223
223
224
-
-**JWKS (JSON Web Key Set):** PicoD validates the JWT signature against public keys published at a JWKS URL configured in each sandbox.
224
+
The authentication model balances security with operational simplicity, using client-generated tokens and one-time initialization to bind each sandbox securely to its designated end user.
225
225
226
-
-**Authorization:** Claims within the JWT (e.g., sub, aud, scope) determine which operations the client is permitted to perform.
227
-
228
-
This design ensures that pre-heated sandboxes can securely accept requests from dynamically assigned clients without requiring pre-injected secrets.
226
+
##### Authentication Architecture
229
227
230
228
```mermaid
231
229
sequenceDiagram
232
-
participant Client as AgentCube Client
233
-
participant APIServer as AgentCube API Server
234
-
participant JWKS as JWKS Endpoint
235
-
participant PicoD as PicoD (Auth Middleware)
236
-
participant Service as PicoD Services
237
-
238
-
Client->>APIServer: Authenticate with Kubernetes token
239
-
APIServer-->>Client: Issue JWT (signed with private key)
-**Pros:** Simple to implement; widely used in VM/container setups.
309
-
-**Cons:** Incompatible with warm pools (keys must be injected before sandbox assignment); insecure if environment variables are exposed; poor rotation support.
310
-
311
-
2.**Static Shared Secret (Environment Variable or Config File)**
312
-
313
-
-**Pros:** Very simple; no external dependency.
314
-
-**Cons:** Weak security; no rotation; risk of leakage; unsuitable for multi-tenant environments.
315
-
316
-
3.**Mutual TLS (mTLS)**
317
-
318
-
-**Pros:** Strong authentication; proven in production.
319
-
-**Cons:** Requires certificate distribution and management; heavy for lightweight sandboxes; not flexible for dynamic warm pools.
320
336
#### 4. Core Capabilities
321
337
PicoD provides a lightweight REST API that replaces traditional SSH‑based operations with secure, stateless HTTP endpoints. The two primary capabilities are code execution and file transfer, exposed via JSON or multipart requests.
322
338
@@ -596,31 +612,6 @@ classDiagram
596
612
597
613
```
598
614
599
-
## Security Considerations
600
-
601
-
Because PicoD runs as a daemon inside sandbox environments, security is a critical design priority. The following measures ensure that execution and file operations remain isolated, authenticated, and controlled.
602
-
603
-
**Token Management**
604
-
605
-
- JWT required for all requests
606
-
- Short-lived tokens validated via JWKS
607
-
- Stateless, no token storage
608
-
609
-
**File Access Control**
610
-
611
-
- Path sanitization prevents directory traversal
612
-
- Restricted to sandbox workspace only
613
-
- Enforced by OS-level permissions
614
-
615
-
**Logging & Auditing**
616
-
617
-
- Centralized logging and audit handled by AgentCube APIServer
0 commit comments