feat(settings): add browser setup and administration (#10)
This commit is contained in:
@@ -94,3 +94,29 @@ uploads, and capture/runtime rendering without bash. The full shipped `ssh-key.m
|
||||
flow generates real keys and skips cleanly when bash or ssh-keygen is unavailable;
|
||||
it runs in CI/Linux, and also on Windows when a working bash with ssh-keygen is
|
||||
installed. No real target host is modified by these tests.
|
||||
|
||||
## Setup and settings (#10)
|
||||
|
||||
On first startup, `dataDir/setup-token` is created privately (0600). The startup
|
||||
message names its path, never the token. Read it locally and finish setup in the
|
||||
browser. GET `/api/auth/setup` returns `{required}`; POST accepts
|
||||
`{token,newPassword,confirmPassword}`, consumes the token, and returns 204 with a
|
||||
session cookie (409 once configured). Setup/login share a per-IP limiter and the
|
||||
origin check. Keep the data directory private and owned by the service user.
|
||||
|
||||
Authenticated routes: POST `/api/settings/password` accepts
|
||||
`{currentPassword,newPassword,confirmPassword}`; POST `/api/settings/sessions/revoke`
|
||||
rotates the signing key atomically. Both return 204 with a replacement cookie and
|
||||
close existing WebSockets. Passwords need 12 characters and at most 4096 bytes.
|
||||
Hash-bound session signatures invalidate cookies after CLI password changes too.
|
||||
Previously issued cookies from before this feature require a fresh login once.
|
||||
GET `/api/settings/session` returns `{lifetimeSeconds}`; GET `/api/settings/system`
|
||||
returns package version, workspace/data paths, and Node version. GET
|
||||
`/api/settings/claude` runs `claude --version` with no shell, a 3-second timeout
|
||||
and 4096-byte output limit. `loginAppearsPresent` checks existence only of the
|
||||
service user's `~/.claude/.credentials.json`; it cannot prove login validity
|
||||
(and does not inspect macOS Keychain credentials). All status responses are no-store.
|
||||
|
||||
Auth mutations are serialized within the single service process. Run one server
|
||||
per data directory. Already-running host jobs are not cancelled by revocation.
|
||||
Forward-auth access must be revoked at the upstream provider.
|
||||
|
||||
Reference in New Issue
Block a user