Skip to content

Commit a680ec7

Browse files
fix: refuse to start when --auth is passed instead of silently ignoring it
--auth <user:pass> was defined and documented but options.auth was never read, and JSS has no basic-auth verification to forward to — so 'servejss --auth user:pass ~/sync' served PUT/DELETE-enabled files on 0.0.0.0 with no authentication while the user believed otherwise. - error out with guidance (--read-only / --solid) when --auth is given - say 'public, no auth' / 'Solid auth' in the banner Mode line, since jsserve's output filter swallows JSS's own PUBLIC MODE warning - README: drop the --auth options row, replace the WebDAV example with honest unauthenticated + --solid variants - drop stale '(requires #107)' comment; --public landed upstream
1 parent 34e5487 commit a680ec7

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ Options:
101101
--ssl-key <path> Path to SSL private key
102102
--no-port-switching Do not open a different port if specified one is taken
103103
-r, --read-only Disable PUT/DELETE methods (like npx serve)
104-
--auth <credentials> Enable basic auth (user:pass)
105104
--solid Enable full Solid protocol features
106105
-q, --quiet Suppress all output
107106
-h, --help Display help
@@ -180,10 +179,16 @@ servejss ./mock-data
180179

181180
### WebDAV Alternative
182181
```bash
183-
# Lightweight file sync server
184-
servejss --auth user:pass ~/sync
182+
# Lightweight file sync server — no auth, trusted networks only
183+
servejss ~/sync
184+
185+
# Authenticated sync (Solid-OIDC + Web Access Control)
186+
servejss --solid ~/sync
185187
```
186188

189+
> **Note:** basic auth (`--auth user:pass`) is not implemented yet; passing
190+
> `--auth` refuses to start rather than silently serving unauthenticated.
191+
187192
## License
188193

189194
MIT

bin/jsserve.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ function getNetworkAddress() {
7272
* Print the startup banner
7373
*/
7474
function printBanner(options) {
75-
const { port, host, directory, readOnly, live, networkAddress } = options;
75+
const { port, host, directory, readOnly, live, solid, networkAddress } = options;
7676

7777
const local = `http://${host === '0.0.0.0' ? 'localhost' : host}:${port}`;
7878
const network = networkAddress ? `http://${networkAddress}:${port}` : null;
7979

80-
const mode = readOnly ? 'GET only (read-only)' : 'GET/PUT/DELETE enabled';
80+
const mode = readOnly
81+
? 'GET only (read-only)'
82+
: solid
83+
? 'GET/PUT/DELETE enabled (Solid auth)'
84+
: 'GET/PUT/DELETE enabled (public, no auth)';
8185

8286
console.log();
8387
console.log(chalk.bgCyan.black(' servejss '));
@@ -128,7 +132,7 @@ program
128132
// servejss-specific options
129133
.option('-r, --read-only', 'Disable PUT/DELETE methods (like npx serve)')
130134
.option('--write', 'Enable PUT/DELETE methods (default)')
131-
.option('--auth <credentials>', 'Enable basic auth (user:pass)')
135+
.option('--auth <credentials>', 'Basic auth (user:pass) — not implemented yet, refuses to start')
132136
.option('--solid', 'Enable full Solid protocol features')
133137
.option('--live', 'Enable live reload (default: true)')
134138
.option('--no-live', 'Disable live reload')
@@ -169,6 +173,15 @@ program.parse();
169173
* Main run function
170174
*/
171175
async function run(directory, options) {
176+
// Neither jsserve nor JSS verifies user:pass credentials yet, so honoring
177+
// --auth would silently serve writable files with no auth at all
178+
if (options.auth) {
179+
throw new Error(
180+
'--auth is not implemented yet — refusing to serve without authentication.\n' +
181+
' Use --read-only to disable writes, or --solid for Solid-OIDC/WAC authentication.'
182+
);
183+
}
184+
172185
// Resolve directory
173186
const dir = resolve(directory || '.');
174187

@@ -214,7 +227,7 @@ async function run(directory, options) {
214227
'--root', dir,
215228
'--port', String(port),
216229
'--host', options.host,
217-
'--public', // Enable open access (requires #107)
230+
'--public', // Open access — skip WAC, unauthenticated read/write
218231
];
219232

220233
// Read-only mode
@@ -267,6 +280,7 @@ async function run(directory, options) {
267280
directory: dir,
268281
readOnly: options.readOnly,
269282
live: options.live !== false,
283+
solid: options.solid,
270284
networkAddress: getNetworkAddress(),
271285
});
272286
}

0 commit comments

Comments
 (0)