Skip to content

Sessions Since v0.1 ​

Session protection binds a login session to the network, the TLS fingerprint and the browser that started it. If the same session cookie arrives from a client that differs, the session was probably stolen and replayed. You choose what happens: log it, end the session, or block the request.

Before you begin ​

  • Role: operator for the application.
  • Know the application's session cookie names. The cookie inventory fills while cookie protection is on.
  • To name users in events, configure a login endpoint under Logins and behaviour. It works with bot mitigation off.

Name the session cookies ​

The first change turns session protection on. Start in detect: bindings are issued and nothing is ended or refused.

text
1. Open Applications > All applications > the application > Response checks > Sessions.
2. On the Session cookies tab, select Bind next to the login cookie, or enter names on the Binding and actions tab (prefixes such as remember_* work).
3. Set Protection mode to detect, then select Preview changes and Apply.
sh
waap sessions set -app shop -m "sessions" mode=detect cookies=sid,remember_*
yaml
# applications[].policy.sessions
sessions:
  mode: detect
  cookies: [sid, "remember_*"]

The application never sees the product's own cookies (__waap_sb, waap_bot, __waap_cs): they are removed before the upstream in every mode. Detect mode changes nothing the application sends or receives. Answers may carry the product's own cookies.

Choose what a session is bound to ​

The network (IPv4 prefix 16, IPv6 prefix 48 by default), the TLS fingerprint (JA4) and the browser (family and platform, no version downgrade). Turn a factor off or widen the network if the Mismatches tab shows normal users.

text
1. On the Binding and actions tab, change the Binding settings.
2. Select Preview changes, then Apply.
sh
waap sessions set -app shop -m "bind" bind.tls_fingerprint=false bind.ipv4_prefix=8
yaml
sessions:
  bind: {tls_fingerprint: false, ipv4_prefix: 8}

Handle existing sessions ​

Naming session cookies sets Bind existing sessions until seven days ahead. Until then sessions without a binding are bound on their next request (logged once a minute per session as session.unbound). After it they are mismatches. Change it with waap sessions set -app shop grace_until=72h.

Choose the action on a replay ​

When a session is replayed: log (default), end (the session cookie is removed before the upstream and expired, so the user logs in again) or block. Events session.hijack, session.swapped and session.unbound list the factors that differed, matched and were not compared, and the session by a short hash, never the value. Exceptions can ignore session.*, for example for an API client's paths.

See the mismatches on the Mismatches tab (window, counts by factor, newest events with client, user and action) or with waap sessions mismatches -app shop -window 7d.

Name the user in events ​

After a successful login on a configured login endpoint, events of the session show the user. The default is hashed (first character and a keyed hash). full shows the username, a warning on the page and recorded in the audit log. off names nobody. Under the application's logging mask off (the default) the username shows in full whenever attribution is on, and under pci it is hashed. Never in metrics or the access log.

Rotate the keys ​

The active node makes the first key within seconds and rotates it every Rotate the key every. Bindings sealed with an older kept key are resealed on their next request. Keys are shared with the standby, so a failover keeps every binding.

text
1. Open the Keys tab and select Rotate now.
sh
waap sessions keys list -app shop
waap sessions keys rotate -app shop

Settings reference ​

SettingWhat it doesDefaultAllowed valuesApplies in
Session protection (policy.sessions.enabled)Binds sessions and handles replays.truetrue, falseall
Protection mode (mode)detect binds and reports; block applies the action.empty (same as the application)detect, block, emptydetect wins
Session cookies (cookies)The application's session cookies.none (nothing bound)up to 8 names; end a name with * to match a prefixall
Bind to the network (bind.network)The client's network must stay the same.truetrue, falsenot compared between IPv4 and IPv6
IPv4 network size (bind.ipv4_prefix)Leading bits that make one network.168 to 32network binding on
IPv6 network size (bind.ipv6_prefix)Same, for IPv6.4816 to 128network binding on
Bind to the TLS fingerprint (bind.tls_fingerprint)The TLS stack (JA4) must stay the same.truetrue, falsenot compared over plain HTTP or between HTTP/3 and TCP
Bind to the browser (bind.browser)Browser family and platform must stay; the version must not go down.truetrue, falseall
When a session is replayed (on_mismatch)The action on a mismatch.loglog, end, blockend and block act in block mode
Sessions without a binding (unbound)Bind sessions started before protection, or only report them.bindbind, logall
Bind existing sessions until (grace_until)After this time a session without a binding is a mismatch.7 days after naming cookiesa time or duration; empty means always boundall
Name the user in events (attribution)How the user shows in events.hashedoff, hashed, fullneeds a login endpoint
Rotate the key every (keys.rotation)A new key seals new bindings.720h1h to 8760hall
Keys kept (keys.keep)How many keys open bindings.4up to 12a session idle longer than rotation times keys kept loses its binding

Limits ​

LimitValue
Session cookies8
Metricwaap_session_mismatches_total{app,factor} (network, tls, browser, session, binding)

Troubleshooting ​

Mobile users are reported as replays ​

  • Cause: their network changes between requests.
  • Fix: keep When a session is replayed at log, widen IPv4 network size, or turn off Bind to the network.