# Signal fusion

> How Vectoral combines browser and account signals into one verdict.

Fusion is the core of Vectoral: one decision over **two** signal sources that cover
each other's blind spots.

* **Browser signals** answer *"is this session an automated browser?"* — rich, but
  spoofable in isolation.
* **Account signals** answer *"is this account economically abusive?"* — datacenter
  IPs, request velocity, usage patterns; spoof-resistant, but blind to client-side
  automation.

A determined attacker can beat either alone (fake the client, or rotate IPs and
accounts). Beating both at once is much harder.

## How the join works

The two sides are tied together by the browser session — joined either with a signed
`sensor_token` (recommended) or a bare `session_id`:

**1. Sensor collects**

The browser sensor POSTs to `/v1/sensor/collect` with a `sessionId`. Vectoral
scores it, stores the event keyed by `(customer, session_id)`, and returns a
**signed token** carrying the session in its claims.

**2. Backend scores**

Your server calls `/v1/score`, forwarding either the signed `sensor_token` (the
browser passes it up with the request) or the same `session_id`.

**3. Vectoral fuses**

If a recent sensor event exists for that session, its bot-score is folded into
the account score via noisy-OR:

```
fused = 1 - (1 - account_score) * (1 - browser_score)
```

The fused score is re-banded into a tier and the response sets
`signals_fused: true`.

The browser event must be recent (within a short freshness window, \~5 minutes) to be
fused — stale signals are treated as absent, and the score proceeds on account signals
alone.

## Two ways to join: token vs. session id

> [tab] sensor\_token (trusted)
>
> Forward the signed `sensor_token` the sensor received from `/v1/sensor/collect`.
> Vectoral verifies the signature, checks expiry, and confirms the token was minted
> for **your** customer before trusting the session id inside its claims. Because the
> token is signed, short-lived (\~120s), and customer-bound, an attacker can't glue a
> clean browser verdict onto a different (bot) session.
>
> If a token is supplied but **fails** verification, Vectoral skips fusion — it does
> **not** fall back to a bare `session_id` (that would re-open the swap hole).

> [tab] session\_id (legacy)
>
> Pass a bare `session_id` with no token. This is the backward-compatible path, but
> a `session_id` is a forgeable bearer string — a soft join only. Prefer the token
> whenever your sensor integration can forward it.

## What you get back

```json theme={null}
{
  "score": 0.91,
  "tier": "high",
  "reasons": ["webdriver_present", "automation_signature", "ip_rotation"],
  "signals_fused": true,
  "browser_score": 0.77,
  "browser_decision": "deny"
}
```

* `score` / `tier` — the **fused** verdict; act on this.
* `signals_fused` — whether a browser signal was folded in.
* `browser_score` / `browser_decision` — the standalone browser verdict for context.
* `reasons` — top codes from whichever side drove the verdict.

> [!NOTE]
>
> No matching browser signal is **not** treated as suspicious — fusion is additive.
> If the sensor isn't installed (or the session didn't match), you simply get the
> account score, exactly as before.

## Why not enforce on the client?

The sensor returns a soft `decision`, but you should never gate on it client-side — a
bot will just ignore your JavaScript. Enforce on the backend: require a valid score
(or a verified token) and act on the server-side verdict. The browser's job is to
*collect signals*, not to *make decisions*.
