Skip to content

User Authentication 🟑 BETA

Verify that user identity comes from the directory service and that the token and TOTP formats match the code.

Admin guide Β· authentication runbook

When to use Before you start Steps Verify Roll back
After a login regression, during an auth audit Directory service and Vault access Inspect auth source, sign in, check token Directory-backed login, no unverified row Restore directory config from snapshot

When to use

Use this runbook when a login fails unexpectedly, when an admin session is doubted, or when an audit asks how identity is established.

Before you start

  • The directory service (Zitadel) owns users and passwords. General Bots stores no internal password table and does not verify a bare crm_contacts row.
  • /api/auth accepts the cloud JWT, verified with the SaaS secret. The chat page captures ?token= into local storage and sends it on the socket.
  • RBAC resolves a role from group membership (resolve_user_role); the user must exist in users with the directory-derived id.
  • The WebSocket handshake resolves its own identity (token first, then user id, then a new guest) and logs which path it used.
  • Only VAULT_* variables belong in .env; never log a token or query string.

Steps

# 1. Confirm the directory service is up and the auth code has no local store.
sudo incus exec directory -- pgrep -a zitadel
grep -RIn "password\|csrf\|jwt" botserver/crates/botsecurity-auth/src --include='*.rs' | head -40

# 2. Check the persisted SaaS secret before a restart.
sudo incus exec <container> -- grep -c saas_jwt_secret /opt/gbo/conf/system/directory_config.json

# 3. Sign in on the login surface only, then confirm the handshake identity
#    line in the server log matches the signed-in user.
grep -E "WS handshake: identity=|CLIENT:" botserver.log | tail -20

# 4. Probe an authenticated route with the token and without it.
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8080/api/product

Verify

Check Surface Pass condition
Directory pgrep -a zitadel directory service running
No local passwords auth source no internal password store
Token /api/auth HMAC verified with the SaaS secret
CSRF signing secret in source state-changing calls protected
Handshake WS handshake: identity= matches the signed-in identity, not a guest
Role rbac_user_groups admin resolved from group membership
Headers curl -sI six IMP-09 headers present

TOTP secret format (botsecurity-auth)

Read the TOTP secret format from botsecurity-auth itself before configuring MFA. The directory service owns the policy and the secret material; a format guessed from another product is not evidence. The implementation in botsecurity-auth is the authority for encoding and verification.

Roll back

πŸ”΄ Restore directory_config.json from a snapshot and re-run the table. A session that resolved as the wrong user is an incident: follow incident response with the handshake log line as evidence.