javascript-solid-server 0.0.194 → 0.0.195

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.
@@ -0,0 +1 @@
1
+ {"sessionId":"a05da419-92b7-4056-93b8-e97b2035d4ae","pid":3932382,"procStart":"114094236","acquiredAt":1778317500161}
@@ -0,0 +1,420 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebSearch",
5
+ "WebFetch(domain:github.com)",
6
+ "WebFetch(domain:raw.githubusercontent.com)",
7
+ "Bash(cat:*)",
8
+ "WebFetch(domain:www.inrupt.com)",
9
+ "Bash(npm install:*)",
10
+ "Bash(timeout 3 node:*)",
11
+ "Bash(PORT=3030 timeout 3 node:*)",
12
+ "Bash(git commit:*)",
13
+ "Bash(pkill:*)",
14
+ "Bash(curl:*)",
15
+ "Bash(npm test:*)",
16
+ "Bash(git add:*)",
17
+ "WebFetch(domain:solid.github.io)",
18
+ "Bash(node:*)",
19
+ "WebFetch(domain:solidservers.org)",
20
+ "WebFetch(domain:solid-contrib.github.io)",
21
+ "Bash(git clone:*)",
22
+ "Bash(chmod:*)",
23
+ "Bash(JSS_PORT=4000 JSS_CONNEG=true node bin/jss.js:*)",
24
+ "Bash(find:*)",
25
+ "Bash(timeout 5 node:*)",
26
+ "Bash(npm view:*)",
27
+ "Bash(npm ls:*)",
28
+ "Bash(timeout 10 node:*)",
29
+ "Bash(npm run test:cth:*)",
30
+ "Bash(__NEW_LINE__ curl -s -X POST http://localhost:4000/.pods )",
31
+ "Bash(lsof:*)",
32
+ "Bash(xargs kill -9)",
33
+ "Bash(docker:*)",
34
+ "Bash(solidproject/conformance-test-harness )",
35
+ "Bash(timeout 30 node:*)",
36
+ "Bash(timeout 20 node:*)",
37
+ "Bash(timeout 25 node:*)",
38
+ "Bash(JSS_PORT=4000 JSS_CONNEG=true timeout 5 node:*)",
39
+ "Bash(pgrep:*)",
40
+ "Bash(python3:*)",
41
+ "Bash(ls:*)",
42
+ "Bash(timeout 15 node:*)",
43
+ "Bash(echo 'No .idp folder' echo find /home/melvin/remote/github.com/JavaScriptSolidServer/JavaScriptSolidServer/data/.idp/ -name *.json)",
44
+ "Bash(echo '=== Interactions ===' ls -la /home/melvin/remote/github.com/JavaScriptSolidServer/JavaScriptSolidServer/data/.idp/interaction/ echo echo '=== Latest interaction ===' cat /home/melvin/remote/github.com/JavaScriptSolidServer/JavaScriptSolidServer/data/.idp/interaction/*.json)",
45
+ "Bash(1 echo \"\" echo \"=== Server errors ===\" grep -E \"(error|Error)\" /tmp/jss.log)",
46
+ "Bash(echo 'Server not ready' curl -s -X POST http://localhost:4000/.pods -H 'Content-Type: application/json' -d {\"\"name\"\":\"\"alice\"\",\"\"email\"\":\"\"alice@example.com\"\",\"\"password\"\":\"\"alicepassword123\"\"})",
47
+ "Bash(head -1 curl -s -X POST http://localhost:4000/.pods -H \"Content-Type: application/json\" -d '{\"\"\"\"name\"\"\"\":\"\"\"\"bob\"\"\"\",\"\"\"\"email\"\"\"\":\"\"\"\"bob@example.com\"\"\"\",\"\"\"\"password\"\"\"\":\"\"\"\"bobpassword123\"\"\"\"}')",
48
+ "Bash(xargs:*)",
49
+ "Bash(fuser:*)",
50
+ "Bash(kill:*)",
51
+ "Bash(ACCESS_TOKEN=\"eyJhbGciOiJFUzI1NiIsImtpZCI6IjQwY2U0YzIzLWY2OWQtNDU4NS05ODg2LTE4MDQzZWIyZjU2ZCJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjQwMDAvIiwic3ViIjoiYjhlZjY5YWUtODc0ZS00MDg5LThiMDktOGQwY2QyM2VlZWY3IiwiYXVkIjoic29saWQiLCJ3ZWJpZCI6Imh0dHA6Ly9sb2NhbGhvc3Q0MDAwL2FsaWNlLyNtZSIsImlhdCI6MTc2NjgyOTQ5MiwiZXhwIjoxNzY2ODMzMDkyLCJqdGkiOiIwMWY4ODVlZS05ZjY2LTQ3M2MtYmZkNC05MWM4ZGU3NGJhZjYiLCJjbGllbnRfaWQiOiJjcmVkZW50aWFsc19jbGllbnQiLCJzY29wZSI6Im9wZW5pZCB3ZWJpZCJ9.DYTlSRkORyDN28XtXk-zbR7xNLViD97KkPqUKb6chV860BaIgwa1suif4TxHQDnK_ejvbvmZ46_n5WwwRnf_Zw\" curl -sI -X PUT http://localhost:4000/alice/cth-test/ -H \"Content-Type: text/turtle\" -H \"Authorization: Bearer $ACCESS_TOKEN\")",
52
+ "Bash(timeout 60 docker run:*)",
53
+ "Bash(rm:*)",
54
+ "Bash(mkdir:*)",
55
+ "WebFetch(domain:communitysolidserver.github.io)",
56
+ "WebFetch(domain:solidos.github.io)",
57
+ "WebFetch(domain:solidcommunity.net)",
58
+ "WebFetch(domain:www.npmjs.com)",
59
+ "Bash(pm2 list:*)",
60
+ "Bash(pm2 logs:*)",
61
+ "Bash(pm2 restart:*)",
62
+ "Bash(timeout 60 npm test:*)",
63
+ "Bash(pm2 stop:*)",
64
+ "Bash(pm2 delete:*)",
65
+ "Bash(pm2 start:*)",
66
+ "Bash(DATA_ROOT=/home/melvin/jss/data pm2 start:*)",
67
+ "Bash(pm2 save:*)",
68
+ "Bash(gh issue create:*)",
69
+ "Bash(gh issue view:*)",
70
+ "Bash(gh issue edit:*)",
71
+ "WebFetch(domain:nostrcg.github.io)",
72
+ "WebFetch(domain:melvincarvalho.github.io)",
73
+ "WebFetch(domain:dev.to)",
74
+ "WebFetch(domain:solidproject.org)",
75
+ "WebFetch(domain:www.w3.org)",
76
+ "Bash(wc:*)",
77
+ "Bash(TOKEN=\"eyJraW5kIjoyNzIzNSwidGFncyI6W1sidSIsImh0dHA6Ly9sb2NhbGhvc3Q6NDAwMC9kZW1vL25vc3RyLXpvbmUvIl0sWyJtZXRob2QiLCJHRVQiXV0sImNyZWF0ZWRfYXQiOjE3NjY5MzQ1NjksImNvbnRlbnQiOiIiLCJwdWJrZXkiOiI4OTg5OWNmOWEyNGE5ZTdlMTNmODU3MGRkMGI1MmJiOTQyMjllNDI2OGM1MGQ1OWZhNjdhMzQ0MGQ0NmFhZTdkIiwiaWQiOiJiNTUyMDUyOTVmYmQwYzhjZDYwMzk1NTgwOWYxZGM5Y2MwMjdlY2U4N2NjYmNlNzcwNWY2MjdmNmQ0ODk1MGJkIiwic2lnIjoiOWYzN2Y0NzIyZDlkNmFmZGQ5OTNkYTM0MDg2MWQ2YzQ4MmY1NzQ1MmFmZTIwZmY2YmI5OTAxNGIwOTU3NjUwMWZiNTgyZjEzNzNlZmVhNjI4ZDI5ZjlhMzhmZTgyODU0ODlmMzAzYzlmYmJjYWE0OTQxZjUyZGZlMWYxNzVkOWMifQ==\")",
78
+ "WebFetch(domain:solid-lite.org)",
79
+ "Bash(git push:*)",
80
+ "WebFetch(domain:linkedwebstorage.com)",
81
+ "WebFetch(domain:w3c.github.io)",
82
+ "WebFetch(domain:socialdocs.org)",
83
+ "WebFetch(domain:nosdav.com)",
84
+ "WebFetch(domain:sandy-mount.com)",
85
+ "WebFetch(domain:ditto.pub)",
86
+ "WebFetch(domain:blocktrails.org)",
87
+ "WebFetch(domain:microfed.org)",
88
+ "WebFetch(domain:soliddocs.org)",
89
+ "WebFetch(domain:agenticalliance.com)",
90
+ "WebFetch(domain:activitypub.rocks)",
91
+ "WebFetch(domain:nostrgit.org)",
92
+ "Bash(convert:*)",
93
+ "WebFetch(domain:instantdomainsearch.com)",
94
+ "Bash(for domain in jss.dev jss.sh jss.io jss.app solidserver.dev solid-server.dev)",
95
+ "Bash(do echo -n '$domain: ')",
96
+ "Bash(whois $domain)",
97
+ "Bash(done)",
98
+ "Bash(for domain in jss.dev jss.sh jss.io jss.app solidserver.dev)",
99
+ "Bash(host:*)",
100
+ "WebFetch(domain:nostr-components.github.io)",
101
+ "Bash(ssh melvincarvalho.com \"pm2 list && echo ''---HAPROXY---'' && cat /etc/haproxy/haproxy.cfg 2>/dev/null | grep -A5 ''melvin\\|backend\\|frontend\\|acl host''\")",
102
+ "Bash(ssh:*)",
103
+ "Bash(time curl -s --connect-timeout 10 https://melvin.solid.live/credit/count.ttl)",
104
+ "Bash(time curl -s --connect-timeout 10 https://melvin.solid.live/)",
105
+ "Bash(time curl:*)",
106
+ "Bash(time curl -s 'https://melvin.solid.live/credit/count.ttl')",
107
+ "Bash(grep:*)",
108
+ "Bash(scp:*)",
109
+ "Bash(for i in 1 2 3)",
110
+ "Bash(do echo \"Attempt $i:\")",
111
+ "Bash(for i in 1 2 3 4 5)",
112
+ "Bash(do curl -so /dev/null -w \"%{http_code} \" https://melvincarvalho.com/js/handlemutation.js)",
113
+ "Bash(for i in 1 2 3 4 5 6 7 8 9 10)",
114
+ "Bash(if [ ! -d \"jose\" ])",
115
+ "Bash(then git clone --depth 1 --branch v0.7.0 https://github.com/solid/jose.git)",
116
+ "Bash(fi)",
117
+ "Bash(timeout 45 node:*)",
118
+ "Bash(gh issue list:*)",
119
+ "Bash(DATA_ROOT=/tmp/jss-git-test JSS_PORT=4444 timeout 3 node:*)",
120
+ "Bash(pm2 show:*)",
121
+ "Bash(git config:*)",
122
+ "Bash(npm version:*)",
123
+ "Bash(git init:*)",
124
+ "Bash(gh repo create:*)",
125
+ "Bash(./bin/git-credential-nostr generate:*)",
126
+ "Bash(./bin/git-credential-nostr get:*)",
127
+ "Bash(git-credential-nostr:*)",
128
+ "Bash(git branch:*)",
129
+ "Bash(GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push:*)",
130
+ "Bash(GIT_CURL_VERBOSE=1 git push:*)",
131
+ "Bash(git reset:*)",
132
+ "Bash(echo:*)",
133
+ "Bash(unset DATA_ROOT)",
134
+ "Bash(timeout 30 npm test:*)",
135
+ "Bash(/home/melvin/remote/github.com/JavaScriptSolidServer/git-credential-nostr/bin/git-credential-nostr acl:*)",
136
+ "Bash(npm cache clean:*)",
137
+ "Bash(git checkout:*)",
138
+ "Bash(gh gist edit:*)",
139
+ "Bash(gh gist view:*)",
140
+ "Bash(./bin/git-credential-nostr acl:*)",
141
+ "Bash(DATA_ROOT=/tmp/jss-git-test/data node:*)",
142
+ "Bash(git remote set-url:*)",
143
+ "Bash(for:*)",
144
+ "Bash(if [ ! -d \"node-solid-server\" ])",
145
+ "Bash(then git clone --depth 1 https://github.com/nodeSolidServer/node-solid-server.git)",
146
+ "Bash(node test-local-nss2.js:*)",
147
+ "Bash(npm test)",
148
+ "Bash(repos.json)",
149
+ "Bash(*.log)",
150
+ "Bash(node --check:*)",
151
+ "Bash(gh repo view:*)",
152
+ "Bash(noskey --help:*)",
153
+ "Bash(npx noskey --help:*)",
154
+ "Bash(noskey:*)",
155
+ "Bash(node -e:*)",
156
+ "Bash(node src/publish.js:*)",
157
+ "Bash(git remote add:*)",
158
+ "Bash(git fetch:*)",
159
+ "Bash(git rev-parse:*)",
160
+ "Bash(f502f06c1d7553f4b7159e8d57a1e14819dc3053b59399e080882cc8e6bb62ad )",
161
+ "Bash(798715377357003683b979b41c5d99c0312e6e788d789f0d5df710465483aa3e )",
162
+ "Bash(f810e7491da3390109ddc13a74a1fff985ba3a4735024f2b714c12d213f5ea11 )",
163
+ "Bash(1 )",
164
+ "Bash(911912000 )",
165
+ "Bash(4ccef8c68cf18f8f156a0bb017dfd6e0cc7ebf1672fa2d769e02e2efc700328b 1000000 )",
166
+ "Bash(798715377357003683b979b41c5d99c0312e6e788d789f0d5df710465483aa3e 910911000 )",
167
+ "Bash(~/.gitmark/faucet.txt)",
168
+ "Bash(blocktrails --version:*)",
169
+ "Bash(blocktrails --help:*)",
170
+ "Bash(blocktrails show:*)",
171
+ "Bash(git restore:*)",
172
+ "Bash(npm show:*)",
173
+ "WebFetch(domain:gitlab.com)",
174
+ "Bash(gh repo edit:*)",
175
+ "WebFetch(domain:blocktrails.github.io)",
176
+ "Bash(jq:*)",
177
+ "Bash(SOLID_SYNC=true timeout 45 node:*)",
178
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm status)",
179
+ "Bash(SOLID_SYNC=true ANCHOR=true timeout 8 node:*)",
180
+ "Bash(SOLID_SYNC=true ANCHOR=true node:*)",
181
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm diff src/watcher.js)",
182
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add src/watcher.js)",
183
+ "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\\)\")",
184
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm push)",
185
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add demo.html src/watcher.js debug.html paywall.html transfer.html)",
186
+ "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\\)\")",
187
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add test-amm.mjs package.json)",
188
+ "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\\)\")",
189
+ "Bash(SOLID_SYNC=true node src/watcher.js:*)",
190
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add demo.html src/watcher.js)",
191
+ "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\\)\")",
192
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm add:*)",
193
+ "Bash(git -C /home/melvin/remote/github.com/blocktrails/gitmark-amm commit -m \"Use blocktrails npm package instead of local path\")",
194
+ "Bash(for addr in tb1pdypd4k38q4x0qz5x7hqavjhfpgt2n4tm0egggx587aafqn3wsnds8gm3yf tb1pqxmrkvuyea9v7vv323tmptjfle5tj9y6cpe5g8wqvlz6d5xmfhlqctx7py tb1p0fv2683x2j5htf9n7fkpmxsy4h7yuxmetelq2c6vp8u2zw9rhp2s5kha7v)",
195
+ "Bash(do echo -n \"$addr: \" curl -s \"https://mempool.space/testnet4/api/address/$addr\")",
196
+ "WebFetch(domain:webledgers.org)",
197
+ "Bash(npm pack:*)",
198
+ "Bash(npm info:*)",
199
+ "Bash(tar:*)",
200
+ "Bash(TEST_API=1 API_URL=https://api.solid.social node:*)",
201
+ "Bash(webledgers show:*)",
202
+ "Bash(webledgers set-balance:*)",
203
+ "Bash(ssh melvincarvalho.com \"pm2 list | grep jss\")",
204
+ "Bash(ssh melvincarvalho.com \"cd /home/ubuntu/jss && git pull && pm2 restart jss\")",
205
+ "WebFetch(domain:registry.npmjs.org)",
206
+ "WebFetch(domain:solid-chat.com)",
207
+ "WebFetch(domain:developer.chrome.com)",
208
+ "WebFetch(domain:css-tricks.com)",
209
+ "Bash(node bin/jss.js:*)",
210
+ "WebFetch(domain:nostr.social)",
211
+ "Bash(xargs curl -s)",
212
+ "Bash(ssh phone:*)",
213
+ "Bash(dig:*)",
214
+ "WebFetch(domain:fonstr.com)",
215
+ "Bash(node -e \"import\\(''nostr-tools''\\).then\\(m => console.log\\(Object.keys\\(m\\).join\\(''\\\\n''\\)\\)\\)\":*)",
216
+ "Bash(gh repo list:*)",
217
+ "Bash(gh search:*)",
218
+ "Bash(__NEW_LINE__ echo \"\")",
219
+ "WebFetch(domain:webfinger.net)",
220
+ "Bash(npm update:*)",
221
+ "Bash(timeout 8 node:*)",
222
+ "Bash(gh pr view:*)",
223
+ "Bash(gh pr diff:*)",
224
+ "Bash(gh pr review:*)",
225
+ "Bash(gh api:*)",
226
+ "Bash(gh pr comment:*)",
227
+ "Bash(git pull:*)",
228
+ "Bash(gh pr:*)",
229
+ "Bash(node --test:*)",
230
+ "Bash(TOKEN_SECRET=test node --test:*)",
231
+ "Bash(gh search issues:*)",
232
+ "Bash(timeout 60 bash:*)",
233
+ "Bash(timeout 90 bash -c:*)",
234
+ "Bash(git commit -m \"$\\(cat <<''EOF''\nsecurity: add ACL check on WebSocket subscription requests\n\nCheck WAC read permission before allowing subscription to prevent\ninformation leakage via notifications. Unauthorized subscriptions\nnow receive ''err <url> forbidden'' response.\n\nSecurity improvements:\n- Check ACL read access before allowing subscription\n- Validate URLs are on this server \\(prevents SSRF-like probing\\)\n- Add subscription limit and URL length validation\n\nFixes #62\nEOF\n\\)\")",
235
+ "Bash(gh repo fork:*)",
236
+ "Bash(timeout 180 npm test:*)",
237
+ "Bash(git show:*)",
238
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline -30 -- \"test/integration/acl-tls-test.mjs\" \"test-esm/integration/acl-tls-test.js\")",
239
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --follow -30 -- \"test/integration/acl-tls-test.mjs\")",
240
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 778095ad --stat)",
241
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 778095ad)",
242
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show b183c7a0)",
243
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --before=\"2019-10-29\" --after=\"2019-10-01\" -20)",
244
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 1a92a912 --stat)",
245
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --all --grep=jaxoncreed)",
246
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --author=\"jaxoncreed\" -30)",
247
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --author=\"[Dd]mitri\" -20)",
248
+ "Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --all --grep=\"oidc\" -20)",
249
+ "Bash(npm install)",
250
+ "Bash(timeout 60 npx mocha:*)",
251
+ "Bash(timeout 120 npx mocha:*)",
252
+ "Bash(timeout 30 npx mocha:*)",
253
+ "Bash(openssl x509:*)",
254
+ "Bash(gh pr checks:*)",
255
+ "Bash(gh run view:*)",
256
+ "Bash(gh pr edit:*)",
257
+ "WebFetch(domain:patch-diff.githubusercontent.com)",
258
+ "Bash(git rebase:*)",
259
+ "Bash(timeout 10 npm start)",
260
+ "Bash(node bin/jss.js start:*)",
261
+ "Bash(ssh solid.social \"cd /var/www/jss && git pull && pm2 restart jss\")",
262
+ "Bash(ssh solid.social:*)",
263
+ "Bash(git -C /tmp/lws-server log --oneline --all -20)",
264
+ "Bash(git -C /tmp/lws-server branch -a)",
265
+ "Bash(git -C /tmp/lws-server show-branch -a)",
266
+ "WebFetch(domain:web-platform-tests.org)",
267
+ "Bash(file:*)",
268
+ "WebFetch(domain:karate.apache.org)",
269
+ "WebFetch(domain:restfulapi.net)",
270
+ "Bash(npm run test:jss:*)",
271
+ "Bash(node /home/melvin/remote/github.com/JavaScriptSolidServer/JavaScriptSolidServer/bin/jss.js start:*)",
272
+ "Bash(VERBOSE=true npm run test:jss:*)",
273
+ "Bash(npm whoami:*)",
274
+ "Bash(node bin/lws-test.js:*)",
275
+ "Bash(timeout 2 node:*)",
276
+ "Bash(node index.js:*)",
277
+ "Bash(timeout 3 npx lws-server@0.0.3:*)",
278
+ "Bash(npx lws-server@0.0.3)",
279
+ "Bash(node /tmp/jssd/verify-spacing.js:*)",
280
+ "Bash(gh run list:*)",
281
+ "Bash(pm2 startup:*)",
282
+ "Bash(npm run build:*)",
283
+ "Bash(npx esbuild:*)",
284
+ "Bash(gzip:*)",
285
+ "Bash(sort:*)",
286
+ "Bash(echo __NEW_LINE_496cf3994d374e5c__ echo '1. jsonld \\(277 KB\\) - used by:' grep -r \"from ['''']jsonld\" src/ --include=*.ts --include=*.js 2)",
287
+ "Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '2. readable-stream \\(180 KB\\) - used by:' grep -r readable-stream node_modules/n3/package.json node_modules/jsonld/package.json)",
288
+ "Bash(head -3 __NEW_LINE_496cf3994d374e5c__ echo echo '3. n3 \\(156 KB\\) - used by:' grep -r \"from ['''']n3\" src/ --include=*.ts --include=*.js 2)",
289
+ "Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '4. @xmldom/xmldom \\(136 KB\\) - used by:' grep -r xmldom src/ --include=*.ts --include=*.js 2)",
290
+ "Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '5. @frogcat/ttl2jsonld \\(135 KB\\) - used by:' grep -r ttl2jsonld src/ --include=*.ts --include=*.js)",
291
+ "Bash(echo \"\" __NEW_LINE_b9f7c85f1ada8a30__ echo \"1. jsonld \\(277 KB\\):\" grep -rn \"jsonld\" src/ --include=\"*.ts\" --include=\"*.js\")",
292
+ "Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"2. n3 \\(156 KB\\):\" grep -rn \"from ''''n3''''\" src/ --include=\"*.ts\" --include=\"*.js\")",
293
+ "Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"3. @xmldom \\(136 KB\\):\" grep -rn \"xmldom\" src/ --include=\"*.ts\" --include=\"*.js\")",
294
+ "Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"4. @frogcat/ttl2jsonld \\(135 KB\\):\" grep -rn \"ttl2jsonld\" src/ --include=\"*.ts\" --include=\"*.js\")",
295
+ "Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"5. cross-fetch \\(20 KB\\):\" grep -rn \"cross-fetch\" src/ --include=\"*.ts\" --include=\"*.js\")",
296
+ "Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"6. solid-namespace \\(3 KB\\):\" grep -rn \"solid-namespace\" src/ --include=\"*.ts\" --include=\"*.js\")",
297
+ "Bash(echo __NEW_LINE_fbfd1802fc51eb60__ echo '1. jsonld \\(277 KB\\):' grep -n jsonld src/*.ts src/*.js)",
298
+ "Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '2. n3 \\(156 KB\\):' grep -n ''n3'' src/*.ts src/*.js)",
299
+ "Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '3. @xmldom \\(136 KB\\):' grep -n xmldom src/*.ts src/*.js)",
300
+ "Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '4. @frogcat/ttl2jsonld \\(135 KB\\):' grep -n ttl2jsonld src/*.ts src/*.js)",
301
+ "Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '5. cross-fetch \\(20 KB\\):' grep -n cross-fetch src/*.ts src/*.js)",
302
+ "Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '6. solid-namespace \\(3 KB\\):' grep -n solid-namespace src/*.ts src/*.js)",
303
+ "Bash(npm run build:all:*)",
304
+ "Bash(git status:*)",
305
+ "Bash(npm run lint-fix:*)",
306
+ "Bash(npm uninstall:*)",
307
+ "Bash(npm search:*)",
308
+ "Bash(npm run lint:*)",
309
+ "Bash(npm run typecheck:*)",
310
+ "Bash(du:*)",
311
+ "Bash(for pkg in activitystreams-pane chat-pane contacts-pane folder-pane issue-pane meeting-pane profile-pane source-pane pane-registry)",
312
+ "Bash(do du -sh node_modules/$pkg)",
313
+ "Bash(for pkg in solid-ui solid-logic react react-dom lodash core-js @inrupt marked dompurify)",
314
+ "Bash(npm why:*)",
315
+ "Bash(for pkg in activitystreams-pane chat-pane contacts-pane folder-pane issue-pane meeting-pane profile-pane source-pane)",
316
+ "Bash(wc -l echo 'Brings: mime-types \\(we already removed this pattern\\)' echo echo '=== profile-pane unique deps ===')",
317
+ "Bash(npm run build-prod:*)",
318
+ "Bash(ln:*)",
319
+ "WebFetch(domain:remotestorage.io)",
320
+ "Bash(gh issue create --title \"Feature: --public flag to skip WAC and allow open access\" --body \"$\\(cat << ''ENDOFFILE''\n## Summary\n\nAdd a `--public` flag that disables WAC \\(Web Access Control\\) checks, allowing unauthenticated read/write access to all resources. This enables JSS to be used as a simple file server similar to `npx serve`, but with REST write capabilities.\n\n**Difficulty**: 15/100 \n**Estimated Effort**: 2-4 hours \n**Dependencies**: None\n\n---\n\n## Motivation\n\nCurrently, JSS requires either:\n1. ACL files to grant access, or\n2. Authentication via Solid-OIDC\n\nThis makes it impossible to use JSS as a simple \"just serve this folder\" tool like `npx serve`. The `--public` flag would enable:\n\n1. **Quick local development** - No auth setup needed\n2. **Simple file sharing** - LAN file server with write support\n3. **jsserve wrapper** - Foundation for `npx jsserve` \\(see future issue\\)\n4. **WebDAV alternative** - Simple REST-based file server\n5. **Testing/demos** - Quick Solid server without auth complexity\n\n---\n\n## Proposed Implementation\n\n### CLI Flag\n\n```bash\njss start --public # Open read/write, no auth\njss start --public --read-only # Open read, no writes \\(like npx serve\\)\n```\n\n### Environment Variable\n\n```bash\nJSS_PUBLIC=true jss start\n```\n\n### Config File\n\n```json\n{\n \"public\": true\n}\n```\n\n---\n\n## Implementation Details\n\n### 1. Add flag to CLI \\(`bin/jss.js`\\)\n\n```javascript\n.option\\(''--public'', ''Allow unauthenticated access to all resources \\(disables WAC\\)''\\)\n.option\\(''--read-only'', ''Disable PUT/DELETE methods \\(read-only mode\\)''\\)\n```\n\n### 2. Add to config \\(`src/config.js`\\)\n\n```javascript\nconst DEFAULTS = {\n // ... existing ...\n public: false,\n readOnly: false,\n};\n\n// Environment variable mapping\nif \\(process.env.JSS_PUBLIC\\) {\n config.public = process.env.JSS_PUBLIC === ''true'';\n}\nif \\(process.env.JSS_READ_ONLY\\) {\n config.readOnly = process.env.JSS_READ_ONLY === ''true'';\n}\n```\n\n### 3. Skip WAC when public \\(`src/auth/middleware.js`\\)\n\n```javascript\nexport async function authorize\\(request, reply\\) {\n // Public mode - skip all auth/WAC checks\n if \\(request.config?.public\\) {\n return; // Allow request to proceed\n }\n \n // ... existing WAC logic ...\n}\n```\n\n### 4. Block writes when read-only \\(`src/handlers/resource.js`, `src/handlers/container.js`\\)\n\n```javascript\n// At start of PUT/DELETE handlers\nif \\(request.config?.readOnly\\) {\n return reply.code\\(405\\).send\\({ \n error: ''Method Not Allowed'',\n message: ''Server is in read-only mode''\n }\\);\n}\n```\n\n---\n\n## Behavior Matrix\n\n| Flag Combination | GET | PUT/DELETE | Auth Required |\n|------------------|-----|------------|---------------|\n| \\(default\\) | ACL | ACL | Yes \\(if ACL requires\\) |\n| `--public` | ✅ Allow | ✅ Allow | No |\n| `--public --read-only` | ✅ Allow | ❌ Block | No |\n| `--read-only` \\(no public\\) | ACL | ❌ Block | Yes |\n\n---\n\n## Security Considerations\n\n### Warning on Startup\n\nWhen `--public` is enabled, show a clear warning:\n\n```\n⚠️ WARNING: Server running in PUBLIC mode\n All files are readable and writable without authentication.\n Do not use in production or expose to the internet.\n```\n\n### Binding to localhost by default?\n\nConsider: When `--public` is set, should the default host be `localhost` instead of `0.0.0.0`?\n\n```javascript\nif \\(config.public && !explicitHostSet\\) {\n config.host = ''localhost''; // Safer default for public mode\n}\n```\n\nUser can override with `--public --host 0.0.0.0` if they explicitly want network access.\n\n---\n\n## Examples\n\n### Local Development\n```bash\n# Quick Solid-compatible file server for development\njss start --public --port 3000 --root ./test-data\n```\n\n### Read-Only File Sharing\n```bash\n# Share files on LAN, no writes allowed\njss start --public --read-only --host 0.0.0.0 --root ~/shared\n```\n\n### Testing Solid Apps\n```bash\n# Test app without auth complexity\njss start --public --root ./fixtures\nnpm test\n```\n\n---\n\n## Files to Modify\n\n| File | Changes |\n|------|---------|\n| `bin/jss.js` | Add `--public` and `--read-only` options \\(~5 LOC\\) |\n| `src/config.js` | Add defaults and env var mapping \\(~10 LOC\\) |\n| `src/auth/middleware.js` | Skip WAC when public \\(~5 LOC\\) |\n| `src/handlers/resource.js` | Block writes when read-only \\(~5 LOC\\) |\n| `src/handlers/container.js` | Block writes when read-only \\(~5 LOC\\) |\n| **Total** | **~30 LOC** |\n\n---\n\n## Testing\n\n```javascript\ndescribe\\(''--public flag'', \\(\\) => {\n it\\(''should allow unauthenticated GET'', async \\(\\) => {\n const server = await createServer\\({ public: true, root: tmpDir }\\);\n const res = await request\\(server\\).get\\(''/file.txt''\\);\n expect\\(res.status\\).toBe\\(200\\);\n }\\);\n\n it\\(''should allow unauthenticated PUT'', async \\(\\) => {\n const server = await createServer\\({ public: true, root: tmpDir }\\);\n const res = await request\\(server\\)\n .put\\(''/new-file.txt''\\)\n .send\\(''content''\\);\n expect\\(res.status\\).toBe\\(201\\);\n }\\);\n\n it\\(''should block PUT when read-only'', async \\(\\) => {\n const server = await createServer\\({ public: true, readOnly: true, root: tmpDir }\\);\n const res = await request\\(server\\)\n .put\\(''/new-file.txt''\\)\n .send\\(''content''\\);\n expect\\(res.status\\).toBe\\(405\\);\n }\\);\n}\\);\n```\n\n---\n\n## Related Issues\n\n- Future: `jsserve` package \\(thin wrapper using this flag\\)\n- #100 - Production Readiness \\(this is a dev/convenience feature\\)\n\n---\n\n## Open Questions\n\n1. Should `--public` default to `localhost` binding for safety?\n2. Should there be a `--public-read` \\(read-only public\\) shorthand?\n3. Should `--public` disable IdP/login UI entirely, or just make it optional?\nENDOFFILE\n\\)\")",
321
+ "Bash(npx serve --help:*)",
322
+ "Bash(npm exec serve:*)",
323
+ "Bash(npm link)",
324
+ "Bash(npm link:*)",
325
+ "Bash(git push)",
326
+ "Bash(ulimit:*)",
327
+ "Bash(gh label:*)",
328
+ "Bash(mongosh --eval \"db.runCommand\\({ ping: 1 }\\)\" 2>&1 | head -5)",
329
+ "Bash(which jss && jss --version 2>&1)",
330
+ "Bash(jss start --help 2>&1 | grep -i mongo)",
331
+ "Bash(grep -A5 '\"\"files\"\"' package.json)",
332
+ "Bash(mkdir -p /tmp/wt-check)",
333
+ "Bash(npm init:*)",
334
+ "WebFetch(domain:webtorrent.io)",
335
+ "Bash(TORRENT=/home/melvin/.claude/projects/-home-melvin-remote-github-com-JavaScriptSolidServer-JavaScriptSolidServer/a05da419-92b7-4056-93b8-e97b2035d4ae/tool-results/webfetch-1774004425803-fce7mx.bin npx -y parse-torrent $TORRENT)",
336
+ "Bash(gh issue:*)",
337
+ "Bash(sed -i 's|Settings/|settings/|g' src/server.js src/handlers/container.js src/webid/profile.js)",
338
+ "Bash(sed -i 's|// Settings folder|// settings folder|' src/handlers/container.js)",
339
+ "WebFetch(domain:www.x402.org)",
340
+ "Bash(jss start:*)",
341
+ "Read(//tmp/**)",
342
+ "Bash(sed -i 's/\"currency\": \"sats\"/\"currency\": \"tbtc4\"/g' /home/melvin/articles/solid-402.html /home/melvin/articles/solid-pay.html /home/melvin/articles/solid-balance.html)",
343
+ "Bash(sed -i 's/\"currency\":\"sats\"/\"currency\":\"tbtc4\"/g' /home/melvin/articles/solid-402.html /home/melvin/articles/solid-pay.html /home/melvin/articles/solid-balance.html)",
344
+ "WebFetch(domain:lists.w3.org)",
345
+ "Bash(git:*)",
346
+ "Bash(npm publish:*)",
347
+ "WebFetch(domain:git-mark.com)",
348
+ "WebFetch(domain:w3id.org)",
349
+ "WebFetch(domain:webledgers.github.io)",
350
+ "Bash(\\\\\"git config:*)",
351
+ "Read(//usr/local/lib/node_modules/gitmark-test/**)",
352
+ "WebFetch(domain:nip98.com)",
353
+ "WebFetch(domain:htmlpreview.github.io)",
354
+ "WebFetch(domain:timbl.solidcommunity.net)",
355
+ "Read(//home/melvin/remote/github.com/solid-helper/core/**)",
356
+ "Bash(curl -s https://www.gnu.org/licenses/agpl-3.0.txt)",
357
+ "Bash(cat LICENSE.full)",
358
+ "Bash(rm LICENSE.full)",
359
+ "Bash(awk -F: '{print $1,$2}')",
360
+ "Bash(awk -F: '{print $1}')",
361
+ "WebFetch(domain:www.gitfork.app)",
362
+ "Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 3 node bin/jss.js start --port 4581 --root /tmp/jss-103 --single-user --single-user-name alice --idp)",
363
+ "Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 2 node bin/jss.js start --port 4581 --root /tmp/jss-103 --single-user-name alice --idp)",
364
+ "Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 3 node bin/jss.js start --port 4581 --root /tmp/jss-103-sanity --single-user-name alice --single-user --idp)",
365
+ "Bash(pm2 jlist *)",
366
+ "Bash(jss --version)",
367
+ "Bash(cp -a ~/main/me ~/main/me.backup-pre-348)",
368
+ "Bash(cp -a ~/main/.idp/accounts ~/main/.idp/accounts.backup-pre-348)",
369
+ "Bash(mv ~/main/me.backup-pre-348 ~/main.backup-me-pre-348)",
370
+ "Bash(mv ~/main/.idp/accounts.backup-pre-348 ~/main.backup-accounts-pre-348)",
371
+ "Bash(shopt -s dotglob)",
372
+ "Bash(mv ~/main/me/* ~/main/)",
373
+ "Bash(shopt -u dotglob)",
374
+ "Bash(rmdir ~/main/me)",
375
+ "Bash(rm /tmp/dup-issue.md)",
376
+ "Bash(rm -rf /tmp/losos-fix)",
377
+ "Bash(terser losos/shell.js -m -c)",
378
+ "Bash(terser losos/html.js -m -c)",
379
+ "Bash(terser losos/store.js -m -c)",
380
+ "Bash(terser losos/registry.js -m -c)",
381
+ "Bash(terser losos/losos.js -m -c)",
382
+ "Bash(DATA_ROOT=/tmp/whatever node --test test/url.test.js)",
383
+ "Bash(gh run *)",
384
+ "Bash(command -v flutter)",
385
+ "Bash(flutter --version)",
386
+ "Bash(command -v adb)",
387
+ "Bash(command -v node)",
388
+ "Bash(rm -rf /tmp/jss-mobile-test)",
389
+ "Bash(mkdir -p /tmp/jss-mobile-test)",
390
+ "Bash(JSS_SINGLE_USER_PASSWORD=test1234 node bin/jss.js start --single-user --port 4444 --root /tmp/jss-mobile-test --idp)",
391
+ "Bash(./scripts/bundle-jss.sh 0.0.169)",
392
+ "Bash(JSS_SINGLE_USER_PASSWORD=test1234 node assets/nodejs-project/bin/jss.js start --single-user --port 4446 --host 127.0.0.1 --root /tmp/jss-bundle-smoke --idp)",
393
+ "Bash(flutter create *)",
394
+ "Bash(flutter pub *)",
395
+ "WebFetch(domain:pub.dev)",
396
+ "WebFetch(domain:nodejs-mobile.github.io)",
397
+ "WebFetch(domain:bare.pears.com)",
398
+ "Bash(command -v gradle)",
399
+ "Bash(gradle --version)",
400
+ "Bash(java -version)",
401
+ "Bash(./gradlew --version)",
402
+ "Bash(./gradlew :app:tasks --no-daemon --warning-mode=none)",
403
+ "Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:tasks --no-daemon)",
404
+ "Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:processDebugResources --no-daemon)",
405
+ "Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:compileDebugKotlin --no-daemon)",
406
+ "Bash(./scripts/fetch-libnode.sh v18.20.4)",
407
+ "Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:assembleDebug --no-daemon)",
408
+ "Bash(/home/melvin/Android/Sdk/platform-tools/adb devices *)",
409
+ "Bash(command -v chromium chromium-browser google-chrome firefox playwright)",
410
+ "Bash(/usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --hide-scrollbars --window-size=480,800 --screenshot=/tmp/consent-preview.png file:///tmp/consent-preview.html)",
411
+ "Bash(cp /tmp/consent-preview.html ~/consent-preview.html)",
412
+ "Read(//home/melvin/**)",
413
+ "Bash(/usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --hide-scrollbars --window-size=520,900 --screenshot=consent.png file:///home/melvin/consent-preview.html)",
414
+ "Bash(sed -i '0,/\"version\": \"0.0.181\"/{s/\"version\": \"0.0.181\"/\"version\": \"0.0.182\"/}' package-lock.json)",
415
+ "WebFetch(domain:losos.org)",
416
+ "Bash(sed -i '0,/\"version\": \"0.0.183\"/{s/\"version\": \"0.0.183\"/\"version\": \"0.0.184\"/}' package-lock.json)",
417
+ "Bash(awk '/esm.sh/' /home/melvin/remote/github.com/JavaScriptSolidServer/sso/login.js)"
418
+ ]
419
+ }
420
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.194",
3
+ "version": "0.0.195",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
- import { spawn, execSync } from 'child_process';
2
- import { existsSync, statSync, mkdirSync, writeFileSync } from 'fs';
1
+ import { spawn, spawnSync, execSync } from 'child_process';
2
+ import { existsSync, statSync, mkdirSync, readdirSync, writeFileSync } from 'fs';
3
3
  import { join, resolve, dirname } from 'path';
4
4
  import { getDataRoot } from '../utils/url.js';
5
5
 
@@ -89,6 +89,67 @@ function findGitDir(repoPath) {
89
89
  return null;
90
90
  }
91
91
 
92
+ /**
93
+ * Auto-initialize a bare git repo at repoAbs to accept a first push, but
94
+ * only when it's safe to do so. The caller must invoke this *after* the
95
+ * standard ACL Write check has passed (i.e. inside the existing
96
+ * preHandler-gated path for `git-receive-pack`), so authorization is
97
+ * already enforced.
98
+ *
99
+ * Safe iff one of:
100
+ * - the target path does not exist (we create it), or
101
+ * - the target path exists, is a directory, and is empty.
102
+ *
103
+ * Refuses (returns null) for any other state — most importantly when the
104
+ * directory contains non-`.git` files, so we don't risk corrupting a
105
+ * user-content directory (e.g. /public/apps/foo with regular files) by
106
+ * promoting it into a git repo.
107
+ *
108
+ * Uses spawnSync with an arg array (no shell interpolation). On any
109
+ * failure (missing `git`, permission denied, init exits non-zero) the
110
+ * caller falls through to the normal 404, with the underlying cause
111
+ * surfaced to the request logger so operators can diagnose.
112
+ *
113
+ * SYMLINK CAVEAT: this function relies on the caller's path-string
114
+ * containment check (isPathWithinDataRoot) which does not follow
115
+ * symlinks. If an attacker with Write ACL has placed a symlink under
116
+ * dataRoot pointing outside, statSync/readdirSync/spawnSync here will
117
+ * dereference it. That's a pre-existing weakness of the JSS handler,
118
+ * not introduced by auto-init — fixing it requires realpath
119
+ * normalisation across every write path in the handler, out of scope
120
+ * for this PR. Hardening tracked for a follow-up.
121
+ *
122
+ * @param {string} repoAbs - absolute path to the candidate repo
123
+ * @param {object} [log] - optional Fastify request logger for diagnostics
124
+ * @returns {{gitDir: string, isRegular: boolean}|null}
125
+ */
126
+ function tryAutoInitBareRepo(repoAbs, log) {
127
+ try {
128
+ if (existsSync(repoAbs)) {
129
+ if (!statSync(repoAbs).isDirectory()) return null;
130
+ if (readdirSync(repoAbs).length > 0) return null;
131
+ } else {
132
+ mkdirSync(repoAbs, { recursive: true });
133
+ }
134
+ const result = spawnSync('git', ['init', '--bare', repoAbs], {
135
+ stdio: ['ignore', 'pipe', 'pipe']
136
+ });
137
+ if (result.status !== 0) {
138
+ log?.warn?.(
139
+ { repoAbs, status: result.status, stderr: result.stderr?.toString?.().slice(0, 500) },
140
+ 'git auto-init: `git init --bare` exited non-zero'
141
+ );
142
+ return null;
143
+ }
144
+ const info = findGitDir(repoAbs);
145
+ if (info) log?.info?.({ repoAbs }, 'git auto-init: bare repo created on first push');
146
+ return info;
147
+ } catch (err) {
148
+ log?.warn?.({ err, repoAbs }, 'git auto-init: refusing to init (filesystem error)');
149
+ return null;
150
+ }
151
+ }
152
+
92
153
  // CORS headers for git responses. Single source of truth — used by the
93
154
  // success path (Fastify reply on the OPTIONS preflight, raw stream on
94
155
  // http-backend output) and by every 4xx early-return. Without these,
@@ -151,8 +212,16 @@ export async function handleGit(request, reply) {
151
212
  return reply.code(403).send({ error: 'Path traversal detected' });
152
213
  }
153
214
 
154
- // Find git directory
155
- const gitInfo = findGitDir(repoAbs);
215
+ // Find git directory. On a push (`git-receive-pack`) to a path that
216
+ // doesn't yet contain a repo, auto-init a bare one if the location is
217
+ // safe to claim — the standard preHandler has already verified ACL
218
+ // Write on this path, so authorization is enforced. See
219
+ // tryAutoInitBareRepo for the safety conditions (empty / non-existent
220
+ // path only; refuses to clobber existing files).
221
+ let gitInfo = findGitDir(repoAbs);
222
+ if (!gitInfo && isGitWriteOperation(request.url)) {
223
+ gitInfo = tryAutoInitBareRepo(repoAbs, request.log);
224
+ }
156
225
  if (!gitInfo) {
157
226
  setGitCorsHeaders(reply);
158
227
  return reply.code(404).send({ error: 'Not a git repository' });
@@ -99,12 +99,156 @@ function dataIsland(resourceUrl, jsonLdString) {
99
99
  *
100
100
  * Net effect: when JSS serves an HTML wrapper with an embedded data
101
101
  * island, the page renders with one HTTP round-trip instead of two.
102
+ *
103
+ * Extended kludges (kept here so the inline reader stays single-script
104
+ * and the HTML wrapper stays self-contained; remove these once the
105
+ * upstream bugs they work around are fixed):
106
+ *
107
+ * A. Origin rewrite — remap the data island's data-uri and embedded
108
+ * @id origins to the current page origin so the same HTML wrapper
109
+ * renders identically from any host (origin pod, GitHub Pages
110
+ * mirror, static export). No-op when origins already match.
111
+ *
112
+ * B. window.fetch interceptor with JSON-LD↔turtle conversion. JSS
113
+ * serves canonical application/ld+json data islands. Mashlib's
114
+ * fetcher would honor them via its registered JsonLdHandler —
115
+ * except solid-panes/outline/manager.js does its own fetch with
116
+ * Accept: text/turtle and parses the body as turtle
117
+ * unconditionally (the legacy mashlib container-load path).
118
+ * Patching $rdf.parse from outside the bundle does not reach
119
+ * solid-panes' import-scoped binding (webpack ESM namespace
120
+ * isolation). Shim: at the fetch boundary, when the request
121
+ * matches the data island URI, use rdflib's own $rdf.parse +
122
+ * $rdf.serialize to convert JSON-LD→turtle in flight for
123
+ * container URIs; serve raw JSON-LD for everything else.
124
+ * Generic for any RDF shape because rdflib does the conversion.
125
+ *
126
+ * C. jsonld-parser chunk preload. Mashlib's webpack publicPath is
127
+ * hardcoded to '/', so the dynamic import of the JSON-LD parser
128
+ * chunk (chunk 841 in mashlib 2.x — stable across 2.0.0→2.2.0)
129
+ * 404s on any non-root deploy (see SolidOS/mashlib#287). Inject
130
+ * a script tag that loads the chunk from `mashlibBase`; the
131
+ * chunk self-registers into `self.webpackChunkMashlib` so
132
+ * webpack's runtime never issues the broken fetch.
133
+ *
134
+ * @param {string} [mashlibBase='/'] - Base URL where mashlib's chunks
135
+ * are reachable. CDN deploys pass `https://unpkg.com/mashlib@X/dist/`;
136
+ * local deploys default to `/` (JSS serves chunks at root).
102
137
  */
103
- export function roundTripOptimizationScript() {
138
+ export function roundTripOptimizationScript(mashlibBase = '/') {
104
139
  return `<script>
105
140
  (function () {
106
141
  if (typeof window === 'undefined') return;
107
142
 
143
+ // Kludge A: origin rewrite — remap data island URIs to the current
144
+ // page origin so the wrapper renders identically from any host.
145
+ // Best-effort; skipped if globals are missing (e.g. headless test).
146
+ if (window.location && typeof document !== 'undefined'
147
+ && document.getElementById && typeof URL === 'function') {
148
+ try {
149
+ var __di_el = document.getElementById('dataisland');
150
+ if (__di_el && __di_el.getAttribute) {
151
+ var __di_uri = __di_el.getAttribute('data-uri');
152
+ if (__di_uri) {
153
+ var __di_origUrl = new URL(__di_uri);
154
+ var __di_origin = window.location.origin;
155
+ if (__di_origUrl.origin !== __di_origin && __di_el.setAttribute) {
156
+ __di_el.setAttribute('data-uri',
157
+ __di_origin + __di_origUrl.pathname
158
+ + __di_origUrl.search + __di_origUrl.hash);
159
+ if (__di_el.textContent) {
160
+ __di_el.textContent = __di_el.textContent
161
+ .split(__di_origUrl.origin).join(__di_origin);
162
+ }
163
+ }
164
+ }
165
+ }
166
+ } catch (e) { /* leave the island alone on malformed input */ }
167
+ }
168
+
169
+ // Kludge C: preload the jsonld parser chunk from the same base
170
+ // that hosts mashlib. The chunk self-registers into
171
+ // self.webpackChunkMashlib so the broken /841.mashlib.min.js
172
+ // publicPath:'/' fetch never happens. Best-effort.
173
+ try {
174
+ if (typeof document !== 'undefined' && document.createElement
175
+ && document.head && document.head.appendChild) {
176
+ var __di_chunk = document.createElement('script');
177
+ __di_chunk.src = ${JSON.stringify(mashlibBase + '841.mashlib.min.js')};
178
+ __di_chunk.async = true;
179
+ document.head.appendChild(__di_chunk);
180
+ }
181
+ } catch (e) { /* ignore */ }
182
+
183
+ // Kludge B: window.fetch interceptor with JSON-LD↔turtle conversion
184
+ // via rdflib (loaded by mashlib). Container URIs get turtle (to feed
185
+ // solid-panes' hardcoded turtle parse); everything else gets JSON-LD
186
+ // (mashlib's JsonLdHandler dispatches natively on Content-Type).
187
+ // Best-effort; skipped if window.fetch missing.
188
+ if (typeof window.fetch === 'function' && typeof document !== 'undefined'
189
+ && document.getElementById) {
190
+ var __di_convertToTurtle = function (jsonStr, baseUri) {
191
+ return new Promise(function (resolve, reject) {
192
+ var $r = window.$rdf;
193
+ if (!$r || typeof $r.parse !== 'function'
194
+ || typeof $r.serialize !== 'function'
195
+ || typeof $r.graph !== 'function') {
196
+ reject(new Error('rdflib not available'));
197
+ return;
198
+ }
199
+ try {
200
+ var __di_tempStore = $r.graph();
201
+ $r.parse(jsonStr, __di_tempStore, baseUri,
202
+ 'application/ld+json', function (pErr) {
203
+ if (pErr) { reject(pErr); return; }
204
+ try {
205
+ $r.serialize(null, __di_tempStore, baseUri, 'text/turtle',
206
+ function (sErr, ttl) {
207
+ if (sErr) { reject(sErr); return; }
208
+ resolve(ttl);
209
+ });
210
+ } catch (sx) { reject(sx); }
211
+ });
212
+ } catch (px) { reject(px); }
213
+ });
214
+ };
215
+ var __di_islandResponse = function (body, ct) {
216
+ return new Response(body, {
217
+ status: 200, statusText: 'OK',
218
+ headers: { 'content-type': ct }
219
+ });
220
+ };
221
+ var __di_origFetch = window.fetch.bind(window);
222
+ window.fetch = function (input, init) {
223
+ try {
224
+ var __di_url = (typeof input === 'string') ? input
225
+ : (input && input.url) || String(input);
226
+ var __di_el2 = document.getElementById('dataisland');
227
+ var __di_dataUri = __di_el2 && __di_el2.getAttribute
228
+ && __di_el2.getAttribute('data-uri');
229
+ var __di_norm = function (u) {
230
+ return String(u).split('#')[0].replace(/\\/$/, '');
231
+ };
232
+ if (__di_dataUri && __di_norm(__di_url) === __di_norm(__di_dataUri)) {
233
+ var __di_isContainer = /\\/(?:[?#].*)?$/.test(String(__di_url));
234
+ if (__di_isContainer) {
235
+ return __di_convertToTurtle(__di_el2.textContent, __di_dataUri)
236
+ .then(function (ttl) {
237
+ return __di_islandResponse(ttl, 'text/turtle');
238
+ })
239
+ .catch(function () {
240
+ return __di_islandResponse(__di_el2.textContent,
241
+ 'application/ld+json');
242
+ });
243
+ }
244
+ return Promise.resolve(__di_islandResponse(__di_el2.textContent,
245
+ 'application/ld+json'));
246
+ }
247
+ } catch (e) { /* fall through to network */ }
248
+ return __di_origFetch(input, init);
249
+ };
250
+ }
251
+
108
252
  // Initialize defensively: another script may have set a truthy
109
253
  // window.__dataIsland that lacks a .get function — or, worse,
110
254
  // assigned a primitive (string, number, etc.) where attaching
@@ -264,7 +408,12 @@ export function roundTripOptimizationScript() {
264
408
  */
265
409
  export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = {}) {
266
410
  const island = dataIsland(resourceUrl, opts.embedJsonLd);
267
- const reader = opts.roundTripOptimization === false ? '' : roundTripOptimizationScript();
411
+ const mashlibBase = cdnVersion
412
+ ? `https://unpkg.com/mashlib@${cdnVersion}/dist/`
413
+ : '/';
414
+ const reader = opts.roundTripOptimization === false
415
+ ? ''
416
+ : roundTripOptimizationScript(mashlibBase);
268
417
  if (cdnVersion) {
269
418
  // CDN mode - use script.onload to ensure mashlib is fully loaded before init
270
419
  // This avoids race conditions with defer + DOMContentLoaded
@@ -306,7 +455,15 @@ export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = {
306
455
  export function generateModuleDatabrowserHtml(moduleUrl, resourceUrl = '', opts = {}) {
307
456
  const cssUrl = moduleUrl.replace(/\.js$/, '.css');
308
457
  const island = dataIsland(resourceUrl, opts.embedJsonLd);
309
- const reader = opts.roundTripOptimization === false ? '' : roundTripOptimizationScript();
458
+ // Derive the chunk base from the module URL (strip the filename).
459
+ // mashlib's bundled chunks sit alongside the entry point — but if
460
+ // a host (e.g. solid.social) serves only the entry and not chunks,
461
+ // the broken /841.mashlib.min.js request 404s harmlessly and the
462
+ // page falls back to the existing inline-reader paths.
463
+ const mashlibBase = moduleUrl.replace(/[^/]*$/, '');
464
+ const reader = opts.roundTripOptimization === false
465
+ ? ''
466
+ : roundTripOptimizationScript(mashlibBase);
310
467
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"/>
311
468
  <meta name="viewport" content="width=device-width, initial-scale=1">
312
469
  <title>Solid Data Browser</title>
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Git auto-init on first push.
3
+ *
4
+ * Verifies that `git-receive-pack` requests to a path with no existing
5
+ * repo will (a) auto-init a bare repo when the path is empty or
6
+ * non-existent, and (b) refuse with the existing 404 when the path
7
+ * contains user content. ACL enforcement is exercised upstream by the
8
+ * server's preHandler; these tests run with `public: true` so the
9
+ * authorization gate is open and we can isolate the init logic.
10
+ */
11
+
12
+ import { describe, it, before, after } from 'node:test';
13
+ import assert from 'node:assert';
14
+ import { createServer } from '../src/server.js';
15
+ import { createServer as createNetServer } from 'net';
16
+ import fs from 'fs-extra';
17
+ import path from 'path';
18
+ import { existsSync, statSync, writeFileSync } from 'fs';
19
+
20
+ const TEST_HOST = 'localhost';
21
+ const DATA_DIR = './test-data-git-auto-init';
22
+
23
+ function getAvailablePort() {
24
+ return new Promise((resolve, reject) => {
25
+ const srv = createNetServer();
26
+ srv.on('error', reject);
27
+ srv.listen(0, TEST_HOST, () => {
28
+ const port = srv.address().port;
29
+ srv.close(() => resolve(port));
30
+ });
31
+ });
32
+ }
33
+
34
+ describe('Git auto-init on first push', () => {
35
+ let server;
36
+ let baseUrl;
37
+
38
+ before(async () => {
39
+ await fs.remove(DATA_DIR);
40
+ await fs.ensureDir(DATA_DIR);
41
+
42
+ const port = await getAvailablePort();
43
+ baseUrl = `http://${TEST_HOST}:${port}`;
44
+
45
+ server = createServer({
46
+ logger: false,
47
+ root: DATA_DIR,
48
+ git: true,
49
+ public: true // skip WAC so the auto-init logic runs in isolation
50
+ });
51
+ await server.listen({ port, host: TEST_HOST });
52
+ });
53
+
54
+ after(async () => {
55
+ if (server) await server.close();
56
+ await fs.remove(DATA_DIR);
57
+ });
58
+
59
+ it('auto-inits a bare repo on push-advertise to a non-existent path', async () => {
60
+ const repoPath = 'public/apps/penny';
61
+ const url = `${baseUrl}/${repoPath}/info/refs?service=git-receive-pack`;
62
+
63
+ const res = await fetch(url);
64
+ assert.strictEqual(res.status, 200, 'advertise must succeed (200) after auto-init');
65
+
66
+ const repoAbs = path.resolve(DATA_DIR, repoPath);
67
+ assert.ok(existsSync(repoAbs), 'directory must be created');
68
+ assert.ok(statSync(repoAbs).isDirectory(), 'created path must be a directory');
69
+ // Bare repo: HEAD + objects/ + refs/ live at the path itself.
70
+ assert.ok(existsSync(path.join(repoAbs, 'HEAD')), 'bare repo HEAD must exist');
71
+ assert.ok(existsSync(path.join(repoAbs, 'objects')), 'bare repo objects/ must exist');
72
+ assert.ok(existsSync(path.join(repoAbs, 'refs')), 'bare repo refs/ must exist');
73
+ });
74
+
75
+ it('auto-inits a bare repo when the target directory exists but is empty', async () => {
76
+ const repoPath = 'public/empty-dir';
77
+ await fs.ensureDir(path.resolve(DATA_DIR, repoPath));
78
+
79
+ const url = `${baseUrl}/${repoPath}/info/refs?service=git-receive-pack`;
80
+ const res = await fetch(url);
81
+ assert.strictEqual(res.status, 200);
82
+
83
+ const repoAbs = path.resolve(DATA_DIR, repoPath);
84
+ assert.ok(existsSync(path.join(repoAbs, 'HEAD')), 'bare repo HEAD must exist');
85
+ });
86
+
87
+ it('refuses to auto-init when the target directory contains user content', async () => {
88
+ const repoPath = 'public/has-files';
89
+ const repoAbs = path.resolve(DATA_DIR, repoPath);
90
+ await fs.ensureDir(repoAbs);
91
+ writeFileSync(path.join(repoAbs, 'index.html'), '<p>hi</p>');
92
+
93
+ const url = `${baseUrl}/${repoPath}/info/refs?service=git-receive-pack`;
94
+ const res = await fetch(url);
95
+ assert.strictEqual(res.status, 404, 'must return 404 when path has non-git content');
96
+
97
+ // User's file must be intact and no .git should have been created.
98
+ assert.ok(existsSync(path.join(repoAbs, 'index.html')), 'user file must survive');
99
+ assert.ok(!existsSync(path.join(repoAbs, 'HEAD')), 'no bare-repo files should appear');
100
+ assert.ok(!existsSync(path.join(repoAbs, 'objects')), 'no bare-repo objects/ should appear');
101
+ });
102
+
103
+ it('does NOT auto-init on a fetch (`git-upload-pack`)', async () => {
104
+ const repoPath = 'public/fetch-only';
105
+ const url = `${baseUrl}/${repoPath}/info/refs?service=git-upload-pack`;
106
+
107
+ const res = await fetch(url);
108
+ assert.strictEqual(res.status, 404, 'fetch on missing repo must remain a 404');
109
+
110
+ const repoAbs = path.resolve(DATA_DIR, repoPath);
111
+ assert.ok(!existsSync(repoAbs), 'no directory should be created for a fetch');
112
+ });
113
+
114
+ it('refuses auto-init when ACL Write is not granted (unauthenticated)', async () => {
115
+ // Spin up a *separate* server WITHOUT public:true so WAC actually
116
+ // gates write operations. This is the contract-level guard: if a
117
+ // future refactor of the preHandler ever lets an unauth request
118
+ // reach handleGit, auto-init would silently materialize repos. This
119
+ // test fails loudly in that scenario.
120
+ const DATA_DIR_AUTH = './test-data-git-auto-init-authcheck';
121
+ await fs.remove(DATA_DIR_AUTH);
122
+ await fs.ensureDir(DATA_DIR_AUTH);
123
+ const port = await getAvailablePort();
124
+ const authBaseUrl = `http://${TEST_HOST}:${port}`;
125
+ const authServer = createServer({
126
+ logger: false,
127
+ root: DATA_DIR_AUTH,
128
+ git: true
129
+ // NOTE: no `public: true` — WAC enforces real ACLs
130
+ });
131
+ try {
132
+ await authServer.listen({ port, host: TEST_HOST });
133
+
134
+ const repoPath = 'public/needs-auth';
135
+ const url = `${authBaseUrl}/${repoPath}/info/refs?service=git-receive-pack`;
136
+ const res = await fetch(url); // no Authorization header
137
+
138
+ assert.ok(res.status === 401 || res.status === 403,
139
+ `expected 401/403 for unauthenticated push, got ${res.status}`);
140
+
141
+ const repoAbs = path.resolve(DATA_DIR_AUTH, repoPath);
142
+ assert.ok(!existsSync(repoAbs),
143
+ 'auto-init MUST NOT create a directory for an unauthenticated request');
144
+ } finally {
145
+ await authServer.close();
146
+ await fs.remove(DATA_DIR_AUTH);
147
+ }
148
+ });
149
+
150
+ it('subsequent pushes use the existing repo (no re-init)', async () => {
151
+ const repoPath = 'public/apps/penny';
152
+ const repoAbs = path.resolve(DATA_DIR, repoPath);
153
+ // Repo was created by the first test in this suite; capture its
154
+ // initial HEAD inode/mtime to verify we don't recreate the repo.
155
+ const headPath = path.join(repoAbs, 'HEAD');
156
+ assert.ok(existsSync(headPath), 'prereq: repo from earlier test still exists');
157
+ const before = statSync(headPath);
158
+
159
+ const url = `${baseUrl}/${repoPath}/info/refs?service=git-receive-pack`;
160
+ const res = await fetch(url);
161
+ assert.strictEqual(res.status, 200);
162
+
163
+ const after = statSync(headPath);
164
+ assert.strictEqual(after.ino, before.ino, 'HEAD inode must not change (no re-init)');
165
+ });
166
+ });