javascript-solid-server 0.0.47 → 0.0.48

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.
@@ -145,7 +145,62 @@
145
145
  "Bash(if [ ! -d \"node-solid-server\" ])",
146
146
  "Bash(then git clone --depth 1 https://github.com/nodeSolidServer/node-solid-server.git)",
147
147
  "Bash(node test-local-nss2.js:*)",
148
- "Bash(npm test)"
148
+ "Bash(npm test)",
149
+ "Bash(repos.json)",
150
+ "Bash(*.log)",
151
+ "Bash(node --check:*)",
152
+ "Bash(gh repo view:*)",
153
+ "Bash(noskey --help:*)",
154
+ "Bash(npx noskey --help:*)",
155
+ "Bash(noskey:*)",
156
+ "Bash(node -e:*)",
157
+ "Bash(node src/publish.js:*)",
158
+ "Bash(git remote add:*)",
159
+ "Bash(git fetch:*)",
160
+ "Bash(git rev-parse:*)",
161
+ "Bash(f502f06c1d7553f4b7159e8d57a1e14819dc3053b59399e080882cc8e6bb62ad )",
162
+ "Bash(798715377357003683b979b41c5d99c0312e6e788d789f0d5df710465483aa3e )",
163
+ "Bash(f810e7491da3390109ddc13a74a1fff985ba3a4735024f2b714c12d213f5ea11 )",
164
+ "Bash(1 )",
165
+ "Bash(911912000 )",
166
+ "Bash(4ccef8c68cf18f8f156a0bb017dfd6e0cc7ebf1672fa2d769e02e2efc700328b 1000000 )",
167
+ "Bash(798715377357003683b979b41c5d99c0312e6e788d789f0d5df710465483aa3e 910911000 )",
168
+ "Bash(~/.gitmark/faucet.txt)",
169
+ "Bash(blocktrails --version:*)",
170
+ "Bash(blocktrails --help:*)",
171
+ "Bash(blocktrails show:*)",
172
+ "Bash(git restore:*)",
173
+ "Bash(npm show:*)",
174
+ "WebFetch(domain:gitlab.com)",
175
+ "Bash(gh repo edit:*)",
176
+ "WebFetch(domain:blocktrails.github.io)",
177
+ "Bash(jq:*)",
178
+ "Bash(SOLID_SYNC=true timeout 45 node:*)",
179
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm status)",
180
+ "Bash(SOLID_SYNC=true ANCHOR=true timeout 8 node:*)",
181
+ "Bash(SOLID_SYNC=true ANCHOR=true node:*)",
182
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm diff src/watcher.js)",
183
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add src/watcher.js)",
184
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"$\\(cat <<''EOF''\nAdd transfer API and HTTP 402 middleware\n\n- Add POST /transfer endpoint for user-to-user token transfers\n- Add verify402Payment middleware for token-gated APIs\n- Add GET /api/quote demo endpoint \\(costs 1 GSAT\\)\n- Add GET /balance/:did and GET /state endpoints\n- Fix anchor function to use encodeBech32m for address derivation\n- Remove OP_RETURN from anchor tx \\(state hash stored in state.json\\)\nEOF\n\\)\")",
185
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm push)",
186
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add demo.html src/watcher.js debug.html paywall.html transfer.html)",
187
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"$\\(cat <<''EOF''\nAdd NIP-98 paywall, transfer, withdraw, and debug pages\n\n- Implement NIP-98 \\(kind 27235\\) for HTTP 402 authentication\n- Add paywall.html demo page showing NIP-98 flow\n- Add transfer.html for user-to-user GSAT transfers\n- Add debug.html with anchors, state, verify, withdraw, and users tabs\n- Add POST /withdraw endpoint for sats → Bitcoin address\n- Add navigation to demo.html linking all pages\nEOF\n\\)\")",
188
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add test-amm.mjs package.json)",
189
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"$\\(cat <<''EOF''\nAdd AMM tests for math, signatures, and NIP-98\n\n- AMM math tests \\(calculateGsatOut, calculateSatsOut, slippage, k invariant\\)\n- Signature verification tests \\(sell, transfer, withdraw requests\\)\n- NIP-98 event creation, verification, and encoding tests\n- Update package.json with test script\nEOF\n\\)\")",
190
+ "Bash(SOLID_SYNC=true node src/watcher.js:*)",
191
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add demo.html src/watcher.js)",
192
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"$\\(cat <<''EOF''\nAdd smart polling with manual deposit check\n\n- Change poll interval from 30s to 10 minutes\n- Add POST /check endpoint for manual deposit scan\n- Add 10-second rate limit between manual checks\n- Add \"Check Deposits\" button to demo.html\nEOF\n\\)\")",
193
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add:*)",
194
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"Use blocktrails npm package instead of local path\")",
195
+ "Bash(for addr in tb1pdypd4k38q4x0qz5x7hqavjhfpgt2n4tm0egggx587aafqn3wsnds8gm3yf tb1pqxmrkvuyea9v7vv323tmptjfle5tj9y6cpe5g8wqvlz6d5xmfhlqctx7py tb1p0fv2683x2j5htf9n7fkpmxsy4h7yuxmetelq2c6vp8u2zw9rhp2s5kha7v)",
196
+ "Bash(do echo -n \"$addr: \" curl -s \"https://mempool.space/testnet4/api/address/$addr\")",
197
+ "WebFetch(domain:webledgers.org)",
198
+ "Bash(npm pack:*)",
199
+ "Bash(npm info:*)",
200
+ "Bash(tar:*)",
201
+ "Bash(TEST_API=1 API_URL=https://api.solid.social node:*)",
202
+ "Bash(webledgers show:*)",
203
+ "Bash(webledgers set-balance:*)"
149
204
  ]
150
205
  }
151
206
  }
package/README.md CHANGED
@@ -528,6 +528,51 @@ curl -X POST https://example.com/.pods \
528
528
  | [CSS](https://github.com/CommunitySolidServer/CommunitySolidServer) | 5.8 MB | 70 | Modular, configurable |
529
529
  | [Pivot](https://github.com/solid-contrib/pivot) | ~6 MB | 70+ | Built on CSS |
530
530
 
531
+ ## Security
532
+
533
+ ### Root ACL Required
534
+
535
+ JSS uses **restrictive mode** by default: if no ACL file exists for a resource, access is denied. This prevents unauthorized writes to unprotected containers.
536
+
537
+ **You must create a root `.acl` file** in your data directory. Example (JSON-LD format):
538
+
539
+ ```json
540
+ {
541
+ "@context": {
542
+ "acl": "http://www.w3.org/ns/auth/acl#",
543
+ "foaf": "http://xmlns.com/foaf/0.1/"
544
+ },
545
+ "@graph": [
546
+ {
547
+ "@id": "#owner",
548
+ "@type": "acl:Authorization",
549
+ "acl:agent": { "@id": "https://your-domain.com/profile/card#me" },
550
+ "acl:accessTo": { "@id": "https://your-domain.com/" },
551
+ "acl:default": { "@id": "https://your-domain.com/" },
552
+ "acl:mode": [
553
+ { "@id": "acl:Read" },
554
+ { "@id": "acl:Write" },
555
+ { "@id": "acl:Control" }
556
+ ]
557
+ },
558
+ {
559
+ "@id": "#public",
560
+ "@type": "acl:Authorization",
561
+ "acl:agentClass": { "@id": "foaf:Agent" },
562
+ "acl:accessTo": { "@id": "https://your-domain.com/" },
563
+ "acl:default": { "@id": "https://your-domain.com/" },
564
+ "acl:mode": [
565
+ { "@id": "acl:Read" }
566
+ ]
567
+ }
568
+ ]
569
+ }
570
+ ```
571
+
572
+ Save this as `data/.acl` (replacing `your-domain.com` with your actual domain).
573
+
574
+ See [Issue #32](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/32) for background.
575
+
531
576
  ## Performance
532
577
 
533
578
  This server is designed for speed. Benchmark results on a typical development machine:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -70,6 +70,14 @@ function findGitDir(repoPath) {
70
70
  * @param {FastifyReply} reply
71
71
  */
72
72
  export async function handleGit(request, reply) {
73
+ // Handle CORS preflight
74
+ if (request.method === 'OPTIONS') {
75
+ reply.header('Access-Control-Allow-Origin', '*');
76
+ reply.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
77
+ reply.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
78
+ return reply.code(200).send();
79
+ }
80
+
73
81
  const urlPath = decodeURIComponent(request.url.split('?')[0]);
74
82
  const queryString = request.url.split('?')[1] || '';
75
83
 
@@ -178,6 +186,11 @@ export async function handleGit(request, reply) {
178
186
  }
179
187
  }
180
188
 
189
+ // Add CORS headers for browser git clients
190
+ reply.raw.setHeader('Access-Control-Allow-Origin', '*');
191
+ reply.raw.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
192
+ reply.raw.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
193
+
181
194
  reply.raw.writeHead(statusCode);
182
195
  headersSent = true;
183
196
  reply.raw.write(bodySection);
package/src/server.js CHANGED
@@ -74,6 +74,14 @@ export function createServer(options = {}) {
74
74
  done(null, body);
75
75
  });
76
76
 
77
+ // Git content types need explicit handling (binary data)
78
+ fastify.addContentTypeParser('application/x-git-receive-pack-request', { parseAs: 'buffer' }, (req, body, done) => {
79
+ done(null, body);
80
+ });
81
+ fastify.addContentTypeParser('application/x-git-upload-pack-request', { parseAs: 'buffer' }, (req, body, done) => {
82
+ done(null, body);
83
+ });
84
+
77
85
  // Attach server config to requests
78
86
  fastify.decorateRequest('connegEnabled', null);
79
87
  fastify.decorateRequest('notificationsEnabled', null);
@@ -28,9 +28,9 @@ export async function checkAccess({
28
28
  const aclResult = await findApplicableAcl(resourceUrl, resourcePath, isContainer);
29
29
 
30
30
  if (!aclResult) {
31
- // No ACL found - allow by default (permissive mode)
32
- // This allows resources without ACLs to be publicly accessible
33
- return { allowed: true, wacAllow: 'user="read write append control", public="read write append"' };
31
+ // No ACL found - deny by default (restrictive mode)
32
+ // Security: Require explicit ACL for any access
33
+ return { allowed: false, wacAllow: 'user="", public=""' };
34
34
  }
35
35
 
36
36
  const { authorizations, isDefault, targetUrl: aclContainerUrl } = aclResult;