Users and roles
People get org roles (owner, member, viewer) and project roles (manage, run, read); the admin token may do anything.
Signing in
People sign in through an OIDC identity provider (Okta, Entra ID, Google, Keycloak, Dex, and GitLab or Forgejo as OIDC providers) or with GitHub, through Hod's GitHub App. There are no passwords. Each provider is a [[auth.providers]] table in the config file; its redirect URI at the provider is <HOD_PUBLIC_URL>/login/<name>/callback:
Adding people
Someone who signs in for the first time gets an account with no access: "You're not a member of any org yet". To add people, an owner makes an invite link in the web UI (the org's Settings, Members): it gives a role, works for as many people and days as the owner says (1 person and 7 days unless changed, 30 days at most), and can be revoked. Whoever opens it and signs in joins with its role; someone already in the org keeps a higher role they had. The link's secret is after # in its URL, so it doesn't reach server or proxy logs; send it the way you'd send a password. Hod keeps no directory of the server's users for owners to search, so an org's owners never see who else has an account.
Role rules
An org can also give roles at every sign-in with a role rule, CEL over the sign-in's claims (the ID token's and userinfo's; for GitHub, id, login, name, email, orgs (orgs they're an active member of, not an outside collaborator, among those where the App is installed), org_roles ({"acme": "admin"}), and teams as org/slug, read only when the rule names teams):
The rule's role replaces the one it gave before; "" takes it away. A role granted by hand stays, and the person gets the higher of the two. A rule that fails (a missing claim, say) changes nothing and is logged. Before saving a rule, an owner can try it in the web UI ("Try with my sign-in", or POST /orgs/{org}/role-rule/try): it runs on the claims of their own latest sign-in, which Hod keeps with their session and nowhere else, and shows those claims and the role they'd get.
With the admin token
Users can also be created and given roles with the admin token (API and AUTH set as in Role rules):
Project roles and public projects
Members get the org's default project role, run unless changed (PATCH /orgs/default with {"default_project_role": "read"}). A project can be made public: anyone, signed in or not, may then read its runs, logs and files, but not trigger, cancel or see its settings and secrets:
Audit log
Changes are recorded in the org's audit log (GET /orgs/default/audit, or the org's Settings, Audit log), filtered by who, what kind of change, what it touched and when. Each entry records the client's IP address: the connection's, or behind a reverse proxy listed in HOD_TRUSTED_PROXIES, the one it reports (Configuration). An IP address is personal data under the GDPR; entries are kept until deleted from the database.
Disabling a user
A server admin can disable someone in the web UI (Users, in the account menu) or with PATCH /users/<id> and {"disabled": true}: they are signed out everywhere, their personal tokens stop working, their open pages close, and they can't sign in again until enabled. Their memberships stay. A server admin named in [auth] server_admins is changed in the config, not here, and nobody can disable themselves.
What each role sees
In the web UI, each person sees what their role allows: a viewer sees Rerun and Run pipeline greyed out, with the role they need; the org's Settings show only to its owners and a project's Settings only to those who manage it. Your own personal tokens, in every org, are on your account page (/account).
Personal tokens and hod login
People use the CLI with personal tokens (hod_pat_…). A token works in one org, does what its user may there but no more than its role (read, run, manage or owner), and always expires: in 30 days unless asked otherwise, and never later than the org allows (365 days unless an owner changes it with PATCH /orgs/default and {"token_max_days": 90}). It stops working when it's revoked, when its user leaves the org, and when the user is disabled.
hod login listens on 127.0.0.1 and opens the server's /cli-login page, where you approve the token; the browser then hands the CLI a one-time code it trades for the token (the RFC 8252 loopback flow, with PKCE). There's no device-code flow: it lets an attacker get a victim to approve the attacker's session. On a machine without a browser, make a token elsewhere and pipe it in with hod login <url> --with-token.
Re-authentication
Writing secrets, creating runner registration tokens, changing members or org settings, and minting a token need a sign-in less than 10 minutes old when done from the web UI: the UI sends you back through your identity provider first. OIDC providers are asked to sign you in again (prompt=login, max_age=0), and Hod checks the ID token's auth_time. GitHub can't be asked that: it shows its account picker, so a person has to click, but a browser signed in to GitHub isn't asked for a password. Tokens, and the admin token, aren't asked to re-authenticate: as with GitHub's sudo mode, they're credentials made on purpose, and only a browser session can mint one.
Token formats
Every token Hod makes has the same shape, so secret scanners can find a leaked one:
After the prefix come 43 random characters and a 6-character checksum, all letters and digits. To scan for Hod tokens with gitleaks, trufflehog or GitHub's custom patterns, use:
The last 6 characters are the CRC-32 of the 43 before them, in base62 (0-9A-Za-z), so a scanner can drop look-alikes without asking the server. The format follows GitHub's and the ASF draft standard for scannable secret tokens. If a token leaks, revoke it: hod token revoke for a personal token, hod runner tokens revoke for a registration token.