Skip to content

Commit 953f3ce

Browse files
bracesproulOpenSWE Botlnhsingh
authored
Sync OpenSWE Documentation Files (#143)
This PR syncs documentation files from the OpenSWE repository. **Changes:** - Updated MDX files from `apps/docs/` - Target directory: `src/labs/swe/` - Updated images from `apps/docs/images/` - Target directory: `src/images/` - Source commit: 210c848997c94f29905ae50fbcb22048675a18bf - Synced at 2025-08-09 00:35:19 UTC **Auto-generated by:** OpenSWE Documentation Sync Workflow --------- Co-authored-by: OpenSWE Bot <[email protected]> Co-authored-by: Lauren Hirata Singh <[email protected]>
1 parent 8d1aba9 commit 953f3ce

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed

src/docs.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,12 @@
10901090
"labs/swe/setup/ci"
10911091
]
10921092
},
1093+
{
1094+
"group": "Secrets",
1095+
"pages": [
1096+
"labs/swe/secrets"
1097+
]
1098+
},
10931099
{
10941100
"group": "FAQ",
10951101
"pages": [

src/labs/swe/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ The agent can be used through a web interface or triggered automatically via Git
2121
<Card title="Setup" icon="robot" href="/labs/swe/setup/intro">
2222
How to set up Open SWE for development
2323
</Card>
24+
<Card title="FAQ" icon="question" href="/labs/swe/faq">
25+
Frequently asked questions
26+
</Card>
2427
<Card title="Examples" icon="database" href="/labs/swe/usage/examples">
2528
Examples of tasks you can try out
2629
</Card>

src/labs/swe/secrets.mdx

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: "Secrets"
3+
description: "Environment variables & secrets access in dev environments"
4+
---
5+
6+
Open-SWE securely manages your API keys and environment variables with AES-256-GCM encryption.
7+
8+
## How Your API Keys Are Protected
9+
10+
Your API keys are encrypted both in transit and at rest:
11+
12+
1. **Frontend**: Temporarily stored in browser localStorage
13+
2. **Transit**: Encrypted before sending to backend
14+
3. **Backend**: Stored encrypted in database
15+
4. **Runtime**: Decrypted only when needed
16+
17+
<Accordion title="Technical Encryption Details">
18+
- **Algorithm**: [AES-256-GCM](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf) (authenticated encryption)
19+
- **Key Derivation**: SHA-256 hash of system `SECRETS_ENCRYPTION_KEY`
20+
- **IV Generation**: Random 12-byte initialization vector per encryption
21+
- **Authentication**: 16-byte authentication tag prevents tampering
22+
</Accordion>
23+
24+
## Types of Environment Variables
25+
26+
**System Variables** (for self-hosting):
27+
- Examples: `DAYTONA_API_KEY`, `SECRETS_ENCRYPTION_KEY`, `GITHUB_APP_PRIVATE_KEY`
28+
- Access: Server-side only, never exposed to users or sandboxes
29+
30+
**User Variables** (your personal keys):
31+
- Examples: `ANTHROPIC_API_KEY`, `MY_DATABASE_URL`, `STRIPE_TEST_KEY`
32+
- Access: Controlled via settings page, encrypted storage
33+
34+
## Sandbox Access Control
35+
36+
**By default, your API keys are never exposed to sandbox environments.** They're only used for LLM initialization and system setup.
37+
38+
To enable keys in development servers (for testing LangGraph agents, Next.js apps, etc.):
39+
40+
1. Manually toggle "Include in Dev Server" for each key
41+
2. Key becomes available as environment variable in sandbox
42+
3. You control which keys are exposed
43+
44+
<Note>
45+
Use separate development API keys with limited permissions instead of production keys when enabling sandbox access.
46+
</Note>
47+
48+
## Security & Isolation
49+
50+
Each session runs in an isolated Daytona container that:
51+
- Cannot access other user sessions
52+
- Automatically deletes after 15 minutes of inactivity
53+
- Has no persistent storage across sessions
54+
55+
<Accordion title="Detailed Isolation Features">
56+
- **Container**: Separate container per user session
57+
- **File System**: No shared file systems between containers
58+
- **Process**: Sandboxed processes cannot access host system
59+
- **Network**: Containers cannot communicate with each other
60+
- **Temporal**: Fresh environment for each session
61+
</Accordion>
62+
63+
<Warning>
64+
When enabling "Include in Dev Server", the AI agent may inadvertently expose environment variables in generated code or logs. Only enable when necessary.
65+
</Warning>
66+
67+
## Best Practices
68+
69+
- Use minimum required permissions for each API key
70+
- Regularly rotate your API keys
71+
- Use separate development keys instead of production keys for sandbox access
72+
- Only enable "Include in Dev Server" when necessary
73+
- Never enable sandbox access for production database credentials
74+
- Review generated code for exposed environment variables before deploying
75+
- Monitor "Last Used" timestamps in settings

src/labs/swe/setup/authentication.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,47 @@ The Next.js application includes a proxy route (`apps/web/src/app/api/[..._path]
3535
with the LangGraph server.
3636
</Tip>
3737

38+
## Simple API Key (Bearer) Authentication
39+
40+
For local development and scripted access, the LangGraph server also supports a simple bearer token scheme. When a request includes an `Authorization: Bearer <token>` header, this path is used and the rest of the auth flow is skipped.
41+
42+
### Setup (development)
43+
44+
- **Generate a token** (32+ bytes, URL-safe):
45+
- OpenSSL: `openssl rand -hex 32`
46+
- **Add to your `.env` for the LangGraph server**:
47+
48+
```bash
49+
API_BEARER_TOKEN=<your-generated-token>
50+
```
51+
52+
- For multiple/rotation: use comma-separated tokens
53+
54+
```bash
55+
API_BEARER_TOKENS=<token1>,<token2>,<token3>
56+
```
57+
58+
Restart the LangGraph server after updating environment variables.
59+
60+
### Usage
61+
62+
```typescript
63+
import { Client } from "@langchain/langgraph-sdk";
64+
65+
const client = new Client({
66+
apiUrl: process.env.LANGGRAPH_API_URL,
67+
defaultHeaders: {
68+
authorization: `Bearer ${process.env.API_BEARER_TOKEN}`,
69+
},
70+
});
71+
```
72+
73+
### Notes
74+
75+
- **Precedence**: If the `Authorization` header is present, bearer auth is used; otherwise the existing GitHub-based flow applies.
76+
- **Rotation**: Add a new token to `API_BEARER_TOKENS`, deploy/restart, migrate clients, then remove old tokens and redeploy.
77+
- **Scope**: All bearer tokens currently map to the same internal identity and permissions. If you need per-token identities/quotas, reach out to adjust the configuration.
78+
3879
### Header Injection System
3980

4081
The proxy route automatically injects the following encrypted headers into each request:

0 commit comments

Comments
 (0)