Replace HTTP Basic Auth with a login page and session cookie
- /login form checks DASHBOARD_USER / DASHBOARD_PASSWORD from .env in constant time; failed attempts are serialized with a 1s delay - Sessions are random tokens kept in memory for 30 days, in an HttpOnly, SameSite=Lax cookie (Secure behind HTTPS); sign out ends them server-side - Signed-out requests redirect to /login and return to the page afterwards, with redirects limited to local paths - Dashboard pages send no-store and X-Frame-Options: DENY - Tests for the login flow and redirect safety; docs updated Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f8e851fdb9
commit
0a1d6a8927
8 files changed
+299
-32
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
Simple minimal self hostable kv datastore you can use to serve dynamic read-only values to static sites.
|
||||
|
||||
- **Dashboard** (HTTP Basic Auth): create stores, edit JSON values in a code editor, create read-only API keys.
|
||||
- **Dashboard** (login page, credentials from `.env`): create stores, edit JSON values in a code editor, create read-only API keys.
|
||||
- **API** (read-only, CORS `*`): read one value or all values of a store with an API key. Keys are safe to embed in static sites.
|
||||
- Go standard library only. All data lives in one JSON file.
|
||||
|
||||
@@ -25,7 +25,9 @@ Open http://localhost:8080.
|
||||
|
||||
Real environment variables take precedence over `.env`. Back up by copying `DATA_FILE`.
|
||||
|
||||
Basic Auth sends the password with every request, so put the dashboard behind HTTPS (e.g. a reverse proxy) if it is reachable from outside your network.
|
||||
Sign in at `/login` with the credentials from `.env`. Sessions last 30 days, or until you sign out or the server restarts. Wrong passwords are slowed to about one try per second.
|
||||
|
||||
Without HTTPS, the password and session cookie travel unencrypted, so put the dashboard behind HTTPS (e.g. a reverse proxy) if it is reachable from outside your network.
|
||||
|
||||
## Deploy with Docker
|
||||
|
||||
|
||||
Reference in new issue
Block a user