Technical overview · Security

Security.

Deliberate choices rather than configurable knobs: short sessions, robust secret hashing, global rate limiting at the start of the filter chain and strict owner isolation.

01 · Authentication

Two mutually exclusive modes.

JWTs for people, API keys for systems — never both in the same request. The two filters run above the Spring Security chain; once one authenticates, the other is bypassed.

JWT · users

Short-lived session tokens with no refresh token. Logout uses an in-process denylist bounded by token expiry. The signing secret is checked at startup.

API key · systems

Client identifier and key are sent in dedicated headers. The key is hashed in the database and shown in plain text only once, at creation. Soft revocation preserves traceability.

Password policy

Strict complexity policy and robust hashing with an adjustable work factor. Passwords are never logged or returned in errors. Initial accounts must change their password at first login.

No refresh token

A refresh token adds security work: storage, device binding, rotation and revocation. It is worthwhile for sessions lasting several days. Short sessions with explicit re-login provide the expected experience with less complexity.

Generic failure

Wrong password, disabled account, revoked API key, expired JWT or denylisted JWT all return the same INVALID_CREDENTIALS body, byte for byte. No response-size oracle and no disclosure of whether an email exists.

02 · Authorisation

Role and owner: two dimensions.

Authorisation combines two dimensions: a role (ADMIN or STANDARD for people; SYSTEM is a separate principal) and an owner (user or system). Every request passes a strict equivalence check at the service boundary.

  • Scoped administrator role. ADMIN manages accounts, API keys and rate-limit configuration, but cannot see other users' agents, conversations or documents.
  • SYSTEM has its own workspace. SYSTEM principals own agents, documents and conversations in a workspace separate from human users, with no cross-visibility by default.
  • Cross-owner access returns 404, not 403. The existence of another owner's resource is not disclosed.
An admin is not a superuser

An administrator role grants management capabilities, not visibility into other people's data. A common trade-off — admins can read everything — was rejected at design time: confidentiality matters more than troubleshooting convenience.

Linked access

An administrator can link an API key to a user. The user then gains read-only visibility into resources created by that key. Write actions still require strict owner equality. Credentials are never shared.

03 · Safeguards

Defence in depth.

Beyond authentication and authorisation, three controls limit the impact of traffic spikes, application errors and misconfiguration.

Global rate limiting

Short- and long-term buckets can be reconfigured at runtime by an administrator. The limiter runs at the start of the chain, before authentication.

Log redaction

Structured JSON logs. A Logback converter masks patterns resembling secrets or sensitive identifiers. A dedicated regression test replays the streams and fails CI if anything leaks.

Fail fast at startup

Application secrets are checked before the first request. Any missing or invalid value stops the process with a clear message.

Rate limit before authentication

Placing the limiter first also protects authentication from automated scans and credential-stuffing attempts. The front door needs protection just as much as the rest of the service.