javascript-solid-server 0.0.110 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -1349
- package/docs/activitypub.md +109 -0
- package/docs/architecture.md +165 -0
- package/docs/authentication.md +157 -0
- package/docs/configuration.md +471 -0
- package/docs/mongodb.md +42 -0
- package/docs/payments.md +94 -0
- package/docs/remotestorage.md +86 -0
- package/docs/security.md +96 -0
- package/docs/webrtc.md +66 -0
- package/package.json +1 -1
package/docs/security.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
## Security
|
|
2
|
+
|
|
3
|
+
### Root ACL Required
|
|
4
|
+
|
|
5
|
+
JSS uses **restrictive mode** by default: if no ACL file exists for a resource, access is denied. This prevents unauthorized writes to unprotected containers.
|
|
6
|
+
|
|
7
|
+
**You must create a root `.acl` file** in your data directory. Example (JSON-LD format):
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"@context": {
|
|
12
|
+
"acl": "http://www.w3.org/ns/auth/acl#",
|
|
13
|
+
"foaf": "http://xmlns.com/foaf/0.1/"
|
|
14
|
+
},
|
|
15
|
+
"@graph": [
|
|
16
|
+
{
|
|
17
|
+
"@id": "#owner",
|
|
18
|
+
"@type": "acl:Authorization",
|
|
19
|
+
"acl:agent": { "@id": "https://your-domain.com/profile/card#me" },
|
|
20
|
+
"acl:accessTo": { "@id": "https://your-domain.com/" },
|
|
21
|
+
"acl:default": { "@id": "https://your-domain.com/" },
|
|
22
|
+
"acl:mode": [
|
|
23
|
+
{ "@id": "acl:Read" },
|
|
24
|
+
{ "@id": "acl:Write" },
|
|
25
|
+
{ "@id": "acl:Control" }
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"@id": "#public",
|
|
30
|
+
"@type": "acl:Authorization",
|
|
31
|
+
"acl:agentClass": { "@id": "foaf:Agent" },
|
|
32
|
+
"acl:accessTo": { "@id": "https://your-domain.com/" },
|
|
33
|
+
"acl:default": { "@id": "https://your-domain.com/" },
|
|
34
|
+
"acl:mode": [
|
|
35
|
+
{ "@id": "acl:Read" }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Save this as `data/.acl` (replacing `your-domain.com` with your actual domain).
|
|
43
|
+
|
|
44
|
+
See [Issue #32](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/32) for background.
|
|
45
|
+
|
|
46
|
+
## Subdomain Mode (XSS Protection)
|
|
47
|
+
|
|
48
|
+
By default, JSS uses **path-based pods** (`/alice/`, `/bob/`). This is simple but has a security limitation: all pods share the same origin, making cross-site scripting (XSS) attacks possible between pods.
|
|
49
|
+
|
|
50
|
+
**Subdomain mode** provides **origin isolation** - each pod gets its own subdomain (`alice.example.com`, `bob.example.com`), preventing XSS attacks between pods.
|
|
51
|
+
|
|
52
|
+
### Why Subdomain Mode?
|
|
53
|
+
|
|
54
|
+
| Mode | URL | Origin | XSS Risk |
|
|
55
|
+
|------|-----|--------|----------|
|
|
56
|
+
| Path-based | `example.com/alice/` | `example.com` | Shared origin - pods can XSS each other |
|
|
57
|
+
| Subdomain | `alice.example.com/` | `alice.example.com` | Isolated - browser's Same-Origin Policy protects |
|
|
58
|
+
|
|
59
|
+
### Enabling Subdomain Mode
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
jss start --subdomains --base-domain example.com
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or via environment variables:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
export JSS_SUBDOMAINS=true
|
|
69
|
+
export JSS_BASE_DOMAIN=example.com
|
|
70
|
+
jss start
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### DNS Configuration
|
|
74
|
+
|
|
75
|
+
You need a **wildcard DNS record** pointing to your server:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
*.example.com A <your-server-ip>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Pod URLs in Subdomain Mode
|
|
82
|
+
|
|
83
|
+
| Path Mode | Subdomain Mode |
|
|
84
|
+
|-----------|----------------|
|
|
85
|
+
| `example.com/alice/` | `alice.example.com/` |
|
|
86
|
+
| `example.com/alice/public/file.txt` | `alice.example.com/public/file.txt` |
|
|
87
|
+
| `example.com/alice/#me` | `alice.example.com/#me` |
|
|
88
|
+
|
|
89
|
+
Pod creation still uses the main domain:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
curl -X POST https://example.com/.pods \
|
|
93
|
+
-H "Content-Type: application/json" \
|
|
94
|
+
-d '{"name": "alice"}'
|
|
95
|
+
```
|
|
96
|
+
|
package/docs/webrtc.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## WebRTC Signaling
|
|
2
|
+
|
|
3
|
+
Peer-to-peer communication via WebRTC, using JSS as the signaling server. Once peers are connected, all media and data flows directly between them.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
jss start --webrtc
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
### How It Works
|
|
10
|
+
|
|
11
|
+
1. Both peers connect to `wss://your.pod/.webrtc` (WebID auth required)
|
|
12
|
+
2. Caller sends an SDP offer targeting the callee's WebID
|
|
13
|
+
3. JSS relays the offer/answer and ICE candidates between peers
|
|
14
|
+
4. Once a direct path is found, the peer-to-peer connection is established
|
|
15
|
+
5. JSS steps out — video, audio, files, and data flow directly between peers
|
|
16
|
+
|
|
17
|
+
### Protocol
|
|
18
|
+
|
|
19
|
+
Messages are JSON over WebSocket:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// Send an offer to another user
|
|
23
|
+
{ "type": "offer", "to": "https://bob.example/profile/card#me", "sdp": "..." }
|
|
24
|
+
|
|
25
|
+
// Receive an offer from another user
|
|
26
|
+
{ "type": "offer", "from": "https://alice.example/profile/card#me", "sdp": "..." }
|
|
27
|
+
|
|
28
|
+
// ICE candidate exchange
|
|
29
|
+
{ "type": "candidate", "to": "https://bob.example/profile/card#me", "candidate": {...} }
|
|
30
|
+
|
|
31
|
+
// Hang up
|
|
32
|
+
{ "type": "hangup", "to": "https://bob.example/profile/card#me" }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
On connect, peers receive a list of online users and get notified when others join or leave.
|
|
36
|
+
|
|
37
|
+
## Tunnel Proxy (Decentralized ngrok)
|
|
38
|
+
|
|
39
|
+
Expose a local dev server to the internet through your JSS pod. A tunnel client connects via WebSocket, registers a name, and receives proxied HTTP requests.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
jss start --tunnel
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### How It Works
|
|
46
|
+
|
|
47
|
+
1. Tunnel client connects to `wss://your.pod/.tunnel` (WebID auth required)
|
|
48
|
+
2. Client registers a name: `{ "type": "register", "name": "myapp" }`
|
|
49
|
+
3. Public URL becomes available at `https://your.pod/tunnel/myapp/`
|
|
50
|
+
4. HTTP requests to that URL are serialized and sent to the tunnel client over WebSocket
|
|
51
|
+
5. Tunnel client forwards to localhost, returns the response
|
|
52
|
+
|
|
53
|
+
### Tunnel Client Protocol
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
// 1. Register a tunnel
|
|
57
|
+
→ { "type": "register", "name": "myapp" }
|
|
58
|
+
← { "type": "registered", "name": "myapp", "url": "/tunnel/myapp/" }
|
|
59
|
+
|
|
60
|
+
// 2. Receive proxied HTTP requests
|
|
61
|
+
← { "type": "request", "id": "uuid", "method": "GET", "path": "/api/hello", "headers": {...} }
|
|
62
|
+
|
|
63
|
+
// 3. Return the response
|
|
64
|
+
→ { "type": "response", "id": "uuid", "status": 200, "headers": {...}, "body": "..." }
|
|
65
|
+
```
|
|
66
|
+
|