HTTP session and CSRF contract
This is the standard browser and HTTP client binding of API-003. The OpenAPI description describes the implemented session operations and account actions that change a user’s access. The CSRF rule also applies to the other routes that write state.
Sign in and use the session
- Call
GET /api/v1/session/csrf. The server returns JSON with acsrfTokenstring. An initial request establishes an anonymous session. Keep the session cookie and use the token with that cookie. - Send
POST /api/v1/loginwith the cookie, the token inX-CSRF-Tokenand a JSON body withusernameandpassword. A successful response is 200 with the current profile and a new session cookie. An unknown username, incorrect password or disabled account gets the same 401 response. - Fetch
GET /api/v1/session/csrfagain with the new cookie. Login rotates the session and its CSRF secret. Discard the token used for login. Use the new token for subsequent writes. - Fetch
GET /api/v1/profileto read the current user’s identity, role keys and global permissions. The cookie is sufficient for this read. A profile may reflect role changes made after login. - To end the session, send
POST /api/v1/logoutwith the cookie and its current token. A successful logout invalidates that session and returns 204 with no body. Discard both the token and the cookie.
Same-origin browser clients let the browser manage cookies. An HTTP client
with a cookie jar must keep the current cookie and explicitly set the token
header. Treat the token as session data and discard it whenever the session
changes. The server marks the token response Cache-Control: no-store.
Cookies and request checks
The signed getriebe_session cookie is host-only with Path=/api/v1,
HttpOnly and SameSite=Strict. It identifies a server-side session. Local
loopback HTTP omits Secure. In HTTPS mode the server sets Secure and
expects the trusted loopback terminator to forward the external scheme and
host. The browser speaks to the same HTTPS origin as the API. The terminator
must supply trusted forwarding headers for that origin.
Authenticated sessions have an absolute lifetime of eight hours from login. Reading the profile or refreshing the CSRF token does not extend it. Sessions are held in memory and require a fresh login after a server restart.
Every request that changes state sends X-CSRF-Token from the same session
as its cookie. This includes login, logout, administration and workflow
commands. If an Origin is present on a write, it must match the server’s
external origin. A missing or mismatched token produces a 403 Problem Details
response. A protected request with a missing or expired session returns 401. A session
revoked by an account change is rejected by the current-account authorization
check. A client can refresh the token for its current session with the
read-only CSRF endpoint. A refreshed token does not recover an expired or
revoked login.
Password and account changes
A signed-in user changes their own password through
POST /api/v1/profile/password with the current and new passwords. An
administrator resets a user’s password through
POST /api/v1/users/{userId}/password. These actions require the actor’s
current cookie and CSRF token. A successful change invalidates all existing
sessions of the affected user. A successful deactivation also invalidates
those sessions. Reactivation requires signing in again. Changing roles
affects the next protected request through the existing session.
In the account API, POST /api/v1/users and PATCH /api/v1/users/{userId}
accept a permissions array of model_manage and process_start values.
The administrator boolean controls administrative access separately. A
patch with a permissions field replaces the current set of those two
permissions. The user representation reports the effective set and includes
admin when applicable.
These rules use Problem Details for machine-readable errors.