Skip to content

feat: wave 4 — team features (users, sessions, audit, bootstrap token) - #23

Merged
wra-sol merged 1 commit into
mainfrom
feat/wave-4-team-features
Jun 29, 2026
Merged

feat: wave 4 — team features (users, sessions, audit, bootstrap token)#23
wra-sol merged 1 commit into
mainfrom
feat/wave-4-team-features

Conversation

@wra-sol

@wra-sol wra-sol commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Wave 4 of the opencode manager improvement plan. Four slices, one PR. All opt-in: single-password mode is fully preserved when /data/users.json doesn't exist.

4.1 — Per-user accounts (closes #13)

UserStore manages /data/users.json with PBKDF2-HMAC-SHA256 password hashing (stdlib, portable — no bcrypt dependency). Multi-user mode activates when users.json exists; single-password mode is fully preserved when it doesn't. Roles: admin (full access) and user (read-only dashboard + proxied UI). Login form shows a username field in multi-user mode. Per-user Basic auth works for opencode attach.

4.2 — Server-side session store + revocation (closes #14)

SessionStore manages /data/sessions.jsonl with create/lookup/revoke. Multi-user mode uses opaque session IDs backed by the store; single-password mode keeps the stateless HMAC cookie. /manage/sessions lists active sessions; POST /manage/sessions/revoke and /manage/sessions/revoke-all for revocation.

4.3 — Audit log (closes #15)

AuditLog appends to /data/audit.jsonl (survives restart on volume). Records: login success/failure, restart, key rotate/revalidate, reconfigure, session revoke, user add/remove. /manage/audit endpoint with pagination + filtering (?user=, ?action=).

4.4 — Optional BOOTSTRAP_TOKEN (closes #16)

If BOOTSTRAP_TOKEN env var is set, first-run /setup requires it — prevents the public-domain race where the first visitor owns the config. If unset, first-run is open as before (zero-config template preserved).

Tests

9 new test cases: password hashing, user CRUD, session store, audit log, multi-user mode preservation, bootstrap token, management endpoints. 128 total tests pass. Lint + format clean.

@wra-sol wra-sol added enhancement New feature or request wave-4 Wave 4: team features security Security hardening labels Jun 29, 2026
Wave 4.1 — Per-user accounts (closes #13)
- UserStore manages /data/users.json with PBKDF2 password hashing
- Multi-user mode activates when users.json exists; single-password
  mode fully preserved when it doesn't (solo-safe, backward compatible)
- Roles: admin (full access) and user (read-only dashboard + proxied UI)
- /manage/users endpoint for listing; POST /manage/users/add and /remove
- Login form shows username field in multi-user mode
- Per-user Basic auth for opencode attach in multi-user mode

Wave 4.2 — Server-side session store + revocation (closes #14)
- SessionStore manages /data/sessions.jsonl with create/lookup/revoke
- Multi-user mode uses opaque session IDs backed by the store
- Single-password mode keeps the stateless HMAC cookie (backward compat)
- /manage/sessions endpoint lists active sessions
- POST /manage/sessions/revoke and /manage/sessions/revoke-all
- Session expiry and revocation properly enforced

Wave 4.3 — Audit log (closes #15)
- AuditLog appends to /data/audit.jsonl (survives restart on volume)
- Records: login success/failure, restart, key rotate/revalidate,
  reconfigure, session revoke, user add/remove
- /manage/audit endpoint with pagination + filtering (?user=, ?action=)
- All management actions now write audit entries

Wave 4.4 — Optional BOOTSTRAP_TOKEN for first-run (closes #16)
- If BOOTSTRAP_TOKEN env var is set, first-run /setup requires it
- Prevents the public-domain race where first visitor owns the config
- If unset, first-run is open as before (zero-config template preserved)
- Token field shown on the first-run form only when token is set

Tests: 9 new test cases. 128 total, all passing. Lint + format clean.
@wra-sol
wra-sol force-pushed the feat/wave-4-team-features branch from ee668cc to 0660416 Compare June 29, 2026 03:28
@wra-sol
wra-sol merged commit a4447cf into main Jun 29, 2026
3 checks passed
@wra-sol
wra-sol deleted the feat/wave-4-team-features branch June 29, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request security Security hardening wave-4 Wave 4: team features

Projects

None yet

1 participant