Sign-in
Both ways are off until they are set up, and either works alone.
Passwords
Section titled “Passwords”| Setting | Meaning |
|---|---|
FIBER_PASSWORD_SIGN_IN |
off (default) or on. Turning it off also ends the sessions it opened, until it is on again; a run already open in a browser goes on updating for up to 10 minutes. |
FIBER_ADMIN_USER |
The first admin’s name, admin by default. |
FIBER_ADMIN_PASSWORD |
A secret, 12 characters or more. The first admin is made when they first sign in with it. Not read while there is an admin with a password, disabled or not; GitHub admins do not count, so it stays a way in until then. Remove it once used, and change the password in Settings. |
A session lasts 14 days. Changing a password ends the person’s other sessions.
Ten wrong attempts for a name from one address make that address wait a minute. An address that has
signed in as that name in the last 30 days has no other limit. The rest share two: 100 wrong attempts
for a name in ten minutes, then a minute’s wait, and 300 attempts a minute for all names. So someone
with many addresses can keep a person from signing in somewhere new, but not where they usually do.
A guesser with many addresses gets about 100 tries a minute at a name: use long passwords. Each
attempt costs about 100 ms of CPU; a rate rule in front of /api/auth/login keeps a flood cheaper.
A malformed setting stops sign-in and password sessions until it is fixed. Signing out still works.
To reset a password, as an operator with access to the database:
printf %s "$NEW_PASSWORD" | pnpm -s --filter @fiber/api reset-password <username> > reset.sqlpnpm --filter @fiber/api exec wrangler d1 execute DB --remote --file "$PWD/reset.sql"It ends that person’s sessions and clears the waits. users_changed must be 1: names match exactly,
capitals included. Delete the file afterwards.
GitHub
Section titled “GitHub”Off until a client id and secret are set. packages/auth holds the flow and apps/api serves
it.
Create a GitHub OAuth app with the callback <origin>/api/auth/github/callback, and enable the
device flow for terminal sign-in. It asks for read:org, uses the token to identify the person,
and discards it.
| Setting | Meaning |
|---|---|
FIBER_GITHUB_CLIENT_ID, FIBER_GITHUB_CLIENT_SECRET |
The OAuth app. Both or neither. |
FIBER_AUTH_KEY |
32 random bytes, base64 (openssl rand -base64 32). Seals the sign-in cookies. |
FIBER_AUTH_ORIGINS |
Comma-separated origins a sign-in may return to. https, or http on localhost. Mixing the two fails startup. The page and API share the origin. |
FIBER_GITHUB_ORGS |
{"<org>": {"id": <numeric id>, "role"?: "admin"|"member"}}. Active members get in. |
FIBER_GITHUB_ACCOUNTS |
{"<login>": {"id": <numeric id>, "role"?}}. The id decides; the login is a label. |
FIBER_DEVICE_SIGN_IN |
off (default), member or full. Terminal sign-in. Someone can be talked into approving a code for a terminal that is not theirs. member withholds instance admin only: the session keeps every project role the person has, owner included. |
FIBER_LOGIN_TTL_SECONDS |
How long a session lasts, 60–86400; 28800 (8 hours) by default. Never extended. |
At least one of the two lists is required, and a malformed value fails startup. admin makes an
instance admin; project roles are granted in Fiber.
The browser comes back with #login=ok or #login_error=<code> and posts to
/api/auth/github/exchange for its session. The hand-off works once, for a minute.
A session ends as soon as nothing in the configuration could grant its role to that account. Organization membership is read at sign-in, so leaving one takes effect when the session ends.
An admin ends all of a person’s sessions with DELETE /api/users/github:<numeric id>/sessions; an
unknown one is a 404. To remove someone for good, first take away what lets them in: remove them
from FIBER_GITHUB_ACCOUNTS and from every listed organization, then end their sessions.
Removing them from an organization alone leaves open sessions running until they expire. If they were an admin, also review the
password users they made or promoted: those accounts outlive the GitHub grant.
Try it locally
Section titled “Try it locally”- Create an OAuth app with the callback
http://localhost:8787/api/auth/github/callback. - Copy
apps/api/.dev.vars.exampletoapps/api/.dev.varsand fill it in. GenerateFIBER_AUTH_KEYwithopenssl rand -base64 32. Your numeric id isidathttps://api.github.com/users/<login>. - Run
pnpm --filter @fiber/api devand open http://localhost:8787/login.