Commit Graph
8 Commits
Author SHA1 Message Date
13768039+zomby1 a69ceef4f0 docs(auth): say which requests the proxy example still redirects
The rule answers a request with a non-navigation Sec-Fetch-Mode with 401. A
client that sends no such header is redirected as before, and a WebSocket
handshake never followed the redirect.
2026-11-26 18:34:40 +01:00
13768039+zomby1 dcfa76125f docs(auth): send only page navigations to the proxy sign-in
Background requests from an open page followed the redirect to the sign-in
start, and each one replaced oauth2-proxy's CSRF cookie, so a real sign-in
could end on its CSRF error page. The example now answers them with 401 and
uses one CSRF cookie per sign-in.
2026-11-26 08:53:20 +01:00
13768039+zomby1 7e199f1fac docs(auth): trusted-proxy review points: claim trust, SameSite, hook replies
The walkthrough now says the app registration is single-tenant, that email and
preferred_username are mutable, and that a logon name with a dot needs the map.
oauth2-proxy gets cookie_samesite = lax, and its identity headers are removed on
the way to Codeman. The API reference lists the hook's plain-text replies for a
proxy sign-in and the 404 for an unknown HTML-view capability.
2026-11-25 09:38:13 +01:00
13768039+zomby1 8480bba908 feat(auth): sign in through a trusted reverse proxy in multi-user mode (experimental)
Multi-user mode only accepted Codeman passwords over HTTP Basic, so a team with an
identity provider (Entra ID, Google, Keycloak, ...) had to sign in twice, with no link
between the two identities.

With a shared secret configured (CODEMAN_TRUSTED_PROXY_SECRET_FILE, or
CODEMAN_TRUSTED_PROXY_SECRET; at least 32 printable ASCII characters), an authenticating
reverse proxy on the same host (oauth2-proxy behind Caddy or nginx, mod_auth_openidc,
Authelia) forwards X-Codeman-Proxy-Secret and X-Codeman-User, and the request signs in
as that existing, enabled account. CODEMAN_TRUSTED_PROXY_USER_HEADER renames the
username header. The feature is experimental (docs/versioning-policy.md): its settings,
headers and the viaTrustedProxy field may change until promoted.

- Accepted only from a loopback socket (isLoopbackIp, now shared with the hook-secret
  bypass) with a timing-safe secret match.
- The secret is read once at the start of WebServer.start(), before sessions are spawned
  or restored, and both variables are then removed from process.env, since every
  session inherits Codeman's environment. The secret file's resolved path stays in the
  module for the sensitive-path blocklist.
- A configured setup that cannot be used stops the start, like the first boot without
  users, with a message that says why and never contains the secret: both variables
  set; a secret file that is unreadable, empty, or readable by group or others (not
  checked on Windows); a short or non-ASCII secret; a secret with multi-user mode off;
  a rejected username header name. getTrustedProxyConfig() returns null for the same
  cases as a second layer.
- Both headers are read and deleted from every request by the first auth hook, in every
  auth mode, so no exemption or route (e.g. the web-tab relay) can forward the secret.
  The relay's drop list names them too, including a configured username header.
- Fails closed once the secret header is present, even empty: a wrong secret or a
  non-loopback source is 401; a missing username, or one with no enabled account, is a
  plain 403 with no challenge. None of these falls through to cookie or Basic. A
  username header without the secret is ignored.
- The username is matched exactly: normalizeUsername(), then the user store's username
  rule, no other transformation. A header sent twice arrives joined ("alice, bob") and
  is refused.
- The secret is compared before the failure bucket, so a correct secret always passes;
  only failures are throttled, in their own per-IP bucket.
- Checked before the session cookie; a cookie on the same request is neither used nor
  refreshed, and no cookie is minted: the proxy authorizes every new request and
  WebSocket upgrade.
- mustChangePassword does not gate a proxy sign-in, and GET /api/me reports
  mustChangePassword: false and viaTrustedProxy: true. Proxy sign-ins update the
  last-login time at most every 15 minutes.
- The username header is removed from every request, so its name is validated by shape
  (an X-... extension header or Remote-User; standard and reserved headers refused).
- With the feature configured, a /webview/ or /html-view/ request the capability
  exemptions don't let through is refused with the route's own 403/404 before the
  credential checks, by prefix on a path normalised the way a proxy's matcher sees it
  (case-insensitive, percent-decoded, dot segments resolved), whatever the token looks
  like: the proxy has to let these paths through without its sign-in, so they must not
  reach the Basic check, prompt or failure bucket. Without a proxy they keep the normal
  401.
- The configured secret file is on the isSensitivePath blocklist.
- The startup log says "Trusted-proxy sign-in enabled (experimental)".
- Single-user mode, the Host/Origin guard and the hook-secret bypass are otherwise
  unchanged.

Docs: security-architecture §10a, architecture-invariants, versioning-policy (new
experimental subsection), Settings-Reference, web-tabs and its wiki page, multi-user-plan,
the CLAUDE.md summary line, and a Caddy + oauth2-proxy walkthrough in the Multi-User Mode
wiki page (web tabs and HTML view bypass the sign-in and never get the secret; the proxy
removes its own session cookie; hook endpoints and their /api/v1 aliases are blocked;
optional username from an IdP claim; what the secret does not protect against).
Changeset included.
2026-11-24 21:41:53 +01:00
Codeman maintainer 27850af325 fix: list the two new multi-user restrictions (release review)
Adopting a tmux session is admin-only and Codex Allow network access needs a
grant. The multi-user page listed neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 08:23:43 +01:00
Codeman maintainer 973943e942 docs(multi-user): document the settings read, system operations and own picks
- docs/api-reference.md: a non-admin's GET /api/settings omits
  voiceSettings.apiKey, caseOrder and lastUsedCase; a new "System
  operations" table for the admin-only routes and the scoped
  POST /api/auth/revoke; the error-code table now lists FORBIDDEN and the
  other multi-user codes (PASSWORD_CHANGE_REQUIRED, USER_NOT_FOUND,
  USER_EXISTS, LAST_ADMIN).
- docs/wiki/Multi-User-Mode.md: what a regular user reads, that their run
  mode and respawn presets stay theirs on the device, the slow sign-in
  case, and the admin-only system operations.
- docs/multi-user-plan.md: Settings and System ops rows marked implemented.
- CLAUDE.md: the Multi-user mode paragraph names the new pieces and tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 13:13:35 +02:00
Codeman maintainer 31c03ab62d docs(multi-user): server-wide settings writes are admin-only
api-reference gains a Settings section (GET/PUT /api/settings, the model
config, the case order and PUT /api/config, with the 403 FORBIDDEN a non-admin
gets in multi-user mode). The Multi-User Mode wiki page explains what a regular
user's App Settings save does now, Settings-Reference links it, the plan's
Settings row is marked implemented, and CLAUDE.md notes the gate for the
Multi-user paragraph and for anyone adding a settings write.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 12:18:20 +02:00
Codeman maintainer f3cb7696f0 docs: publish docs/wiki as the user manual, with a sync workflow
30 pages covering install, concepts, the dashboard, the agent CLIs, unattended
runs, remote and Docker cases, security and the HTTP API, plus a sidebar and a
footer. The wiki repo has no CI and no review, so docs/wiki is the source of
truth and .github/workflows/wiki-sync.yml mirrors it on every push to master.

The workflow refuses to mirror when docs/wiki is missing or holds no pages,
because it deletes before it copies and would otherwise publish the deletion of
every page. The footer carries a {{VERSION}} placeholder stamped at publish
time rather than a hand-written version, which went stale on every release.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 16:20:43 +02:00