Skip to content

Sign-in

A hosted Knetik is closed by default. Three sign-in methods share one flow: a provider only proves an identity, then one place applies the allowlist, finds or creates the user, and starts a session.

Variable Meaning
KNETIK_ALLOWED_USERS Who may sign in: user@x.com, *@x.com, github:login, comma separated
KNETIK_ADMINS Same syntax. These people are always admins (bootstrap, locked in the dashboard). Everyone else is managed by an admin on the Users page: add people, choose admin, member or viewer, disable.

At least one of the two lists must be non-empty. An email entry only matches an address the provider has verified. The same verified address through magic link and Firebase is one user.

Roles are admin and member. Admins can connect integrations for the whole workspace and edit module configuration. Any signed-in user can start any run and decide any gate.

Terminal window
KNETIK_MAIL=smtp
SMTP_URL=smtps://user:pass@smtp.example.com
KNETIK_MAIL_FROM="Knetik <no-reply@example.com>"

KNETIK_MAIL=console prints links to the server log instead (trials only).

  • Links are single use and expire in 15 minutes. They are stored hashed.
  • Opening the emailed link only shows a button. The token is consumed by the form post, so mail scanners that prefetch links cannot burn it.
  • The request endpoint answers identically for allowed and disallowed addresses.
  • Limits: 5 links per address per hour and 20 per IP per 10 minutes. Behind a proxy, set KNETIK_TRUST_PROXY=1 so the IP limit sees real clients.

Create a GitHub OAuth app with callback URL ${KNETIK_BASE_URL}/auth/github/callback, then set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET. It uses the authorization code flow with a state cookie and the scopes read:user user:email. Only a verified email counts toward the allowlist, and github:<login> entries match the login.

Set FIREBASE_PROJECT_ID and FIREBASE_WEB_CONFIG (the web app config JSON). In the Firebase console, enable the Google provider and add your domain under Authorized domains.

The browser signs in with the Firebase SDK and posts the ID token. The server verifies it against Google’s public keys (RS256 only, issuer and audience pinned to your project), so there is no firebase-admin dependency.

Sessions are random 256-bit tokens stored hashed in the database. Cookies are HttpOnly and SameSite=Lax, with Secure and the __Host- prefix on https. They survive restarts, last 30 days (KNETIK_SESSION_DAYS) with a 7-day idle limit, and are revoked server-side on sign-out.

State-changing requests must carry the server’s own Origin (or Sec-Fetch-Site: same-origin), so another site cannot drive a signed-in browser. There is no CSRF token beyond that check and SameSite=Lax.

Real GitHub and real Firebase are tested against mocks that speak the real endpoints. The Google pop-up path needs a Firebase project to test. Real SMTP delivery is untested (only the console mailer is exercised).