Skip to content

Commit 89d9fe7

Browse files
fix: address Copilot review on PR #7
Four legitimate catches from the review: 1. `--no-auth` was a no-op against JSS. Now forwards JSS's `--public` flag so the pod actually skips WAC and accepts unauthenticated reads/writes (verified: JSS prints "PUBLIC MODE ENABLED"). 2. `JSS_SINGLE_USER_PASSWORD` env override was documented in the README but not honoured — the CLI always passed `--single-user- password me`, drowning out the env. Now the env value is read in jspod, passed to JSS via the CLI flag, AND surfaced in the banner ("Sign In (password from JSS_SINGLE_USER_PASSWORD)") so the displayed credentials match reality. 3. Loopback detection was too strict — only 127.0.0.1 / localhost / ::1 were treated as safe. Expanded to the full 127.0.0.0/8 IPv4 range (covers Ubuntu's default 127.0.1.1 in /etc/hosts) and the bracketed `[::1]` form a user might paste in by accident. 4. README First Run Guide had duplicated Step 3 / Step 4 left over from the previous version. Renumbered and removed the obsolete "Register with a passkey" step (registration is disabled in single-user mode anyway). Refs #1 #3 #6
1 parent ec27890 commit 89d9fe7

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,10 @@ Override the default password without going through the UI:
245245
JSS_SINGLE_USER_PASSWORD='your-password' npx jspod
246246
```
247247

248-
**Step 3**: Register with a passkey
249-
- Click "Register" or "Sign Up"
250-
- Use your device's biometric auth (fingerprint, Face ID, etc.)
251-
- Your WebID will be created automatically
252-
253-
**Step 4**: Start using your pod!
254-
- Upload files, create resources
255-
- Use Solid apps to connect to your pod
248+
**Step 5**: Start using your pod
249+
- Upload files, create resources from a Solid app
256250
- Your data stays on your server
251+
- Connect more apps — they all authenticate against your IDP
257252

258253
**Troubleshooting**:
259254
- **Port in use?** Run `jspod --port 5445`

index.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ const options = {
4242
// weak default sign-in so the new user is on a working pod within seconds,
4343
// with a clearly-marked path to climb (change password / add a passkey).
4444
// Safe because the default host is localhost-only (127.0.0.1).
45+
// Username is fixed by JSS for root pods (server.js:970). Password defaults
46+
// to 'me' but can be overridden via JSS_SINGLE_USER_PASSWORD so the env
47+
// override documented in the README actually takes effect (and the banner
48+
// shows the effective password, not a stale default).
4549
const RUNG_1_USERNAME = 'me';
46-
const RUNG_1_PASSWORD = 'me';
50+
const RUNG_1_PASSWORD = process.env.JSS_SINGLE_USER_PASSWORD || 'me';
51+
const RUNG_1_PASSWORD_FROM_ENV = !!process.env.JSS_SINGLE_USER_PASSWORD;
4752

4853
for (let i = 0; i < args.length; i++) {
4954
const arg = args[i];
@@ -133,7 +138,10 @@ console.log(chalk.cyan(' ├─ ') + chalk.white('Pod Root: ') + chalk.yellow
133138
console.log(chalk.cyan(' └─ ') + chalk.white('Mode: ') + (options.multiuser ? chalk.yellow('Multi-user') : chalk.yellow('Single-user')));
134139

135140
if (options.auth && !options.multiuser) {
136-
console.log('\n' + chalk.bold.white('🔑 Sign In (rung 1 of the auth ladder):\n'));
141+
const rungLabel = RUNG_1_PASSWORD_FROM_ENV
142+
? 'Sign In (password from JSS_SINGLE_USER_PASSWORD):'
143+
: 'Sign In (rung 1 of the auth ladder):';
144+
console.log('\n' + chalk.bold.white(`🔑 ${rungLabel}\n`));
137145
console.log(chalk.cyan(' ├─ ') + chalk.white('Username: ') + chalk.bold.green(RUNG_1_USERNAME));
138146
console.log(chalk.cyan(' ├─ ') + chalk.white('Password: ') + chalk.bold.green(RUNG_1_PASSWORD));
139147
console.log(chalk.cyan(' └─ ') + chalk.dim('Climb: change the password or add a passkey from account settings'));
@@ -142,10 +150,13 @@ if (options.auth && !options.multiuser) {
142150
// the local machine. See issue #6 ("auth ladder"): rung 1 is only
143151
// safe when the host is loopback-only. Any other bind exposes the
144152
// well-known me/me credentials to the LAN (or worse).
153+
// Loopback covers the full 127.0.0.0/8 IPv4 range plus IPv6 ::1
154+
// (and its bracketed form, which a user might paste in by accident).
145155
const isLoopback =
146-
options.host === '127.0.0.1' ||
147156
options.host === 'localhost' ||
148-
options.host === '::1';
157+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(options.host) ||
158+
options.host === '::1' ||
159+
options.host === '[::1]';
149160
if (!isLoopback) {
150161
console.log('\n' + chalk.bold.red('⚠ Warning: ') + chalk.yellow(
151162
`--host ${options.host} exposes the well-known me/me credentials beyond localhost.`
@@ -193,6 +204,13 @@ if (options.multiuser) {
193204
}
194205
}
195206

207+
if (!options.auth) {
208+
// JSS's `--public` is the real no-auth switch: skip WAC, open
209+
// read/write. Without it, `--no-auth` would only mean "no IDP"
210+
// — the pod would still be ACL-gated and unreachable.
211+
jssArgs.push('--public');
212+
}
213+
196214
// Start JSS with enhanced PATH to find the binary
197215
const jss = spawn('jss', jssArgs, {
198216
stdio: 'inherit',

0 commit comments

Comments
 (0)