open
https://gitlab.synchro.net/main/sbbs/-/work_items/1399
2026-11-22 13:50:00 -0800
## Summary
Let anonymous visitors browse the web file area listings (`FileVPathPrefix`, e.g. `/files/`) and see what they may access, instead of being asked for a password as soon as any library or directory has an access requirement.
## Today
In `check_access()` (`websrvr.cpp`), a request without authentication for a listing is allowed only when user #0:
- can access **every** library, for the list of libraries (`user_can_access_all_libs()`);
- can access **every** directory of the library, for a library's list of directories (`user_can_access_all_dirs()`).
Otherwise the server answers 401 and the browser shows its HTTP Basic/Digest password prompt. So a single restricted directory anywhere on the system makes the whole list of libraries ask for a password, though most of what it lists is open to everyone. This rule came with the index script hook in 8f730cc36b (doll-3-amend, 2022-03-20).
The index script (`webfileindex.ssjs`, or a sysop's own `FileIndexScript`) already filters by the current user: `file_area.lib_list` and `file_area.dir[].can_access` reflect the user the request runs as, so it can list only what an anonymous visitor may access.
## Proposal
1. **Anonymous listings of the root and of libraries are allowed** (user #0 needing access to at least one directory, perhaps), and the script lists only what that user may access. Restricted directories, and downloads from them, keep answering 401 as now.
2. **Signing in is something the visitor asks for**: a request such as `<prefix>?signin` (any listing path) gets a 401 when it is not authenticated and is otherwise served normally, so the index script can offer a "Sign in to see more" link, shown when the visitor is anonymous and something was left out (`can_access` false for any library or directory).
3. **Optionally, a guest account for anonymous visitors**: user #0 has no user record, so an access requirement such as `LEVEL 10` always fails for it. A `[Web]` setting naming a user account whose access applies to unauthenticated file-area requests (the same idea as webv4's `guest` setting and SWAPI's `webguest`) would let a sysop open browsing (and, if they wish, downloads) to visitors without opening the areas to everyone. Credits and download accounting for such requests need a decision (charged to that account, or downloads by it not allowed).
HTTP Basic/Digest cannot sign out (browsers keep the credentials until closed); #1398 (browser sessions owned by the server) would let the file listings share the site's sign-in instead.
## Related
- #1398: browser sessions owned by the server.
- The `webfileindex.ssjs` improvements issue (filed alongside this one).
- *Authored by Claude (Claude Code), on behalf of @rswindell*
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net