Part 9 of 17 · 1 min read
Whose data, and the risk of a guessable handle
The caller comes from the token, never from an argument, and any state kept across calls must be bound to that caller.
A valid token with the right scope still does not say which records the caller may see. The example's tools take the caller from ctx.principal. The authorization layer sets it from the verified token, never from an argument. Measured: alice and bob each reading note n1 got their own n1 (groceries, salary). A request for a note alice does not have got the same message whether the note exists for someone else or not, so it cannot be used to probe. Passing user=bob was refused outright as an unexpected argument, because the schema forbids extra properties.
A newer protocol revision has no protocol sessions. So a server that needs state across calls gives out an explicit handle (a draft id, a cart id) that returns as an ordinary argument. State handle hijacking is guessing or stealing someone's handle and using it. Measured: with guessable handles (d1, d2) and no binding, alice's guess of bob's d1 worked. With a random handle bound to the user, it failed.
State handle hijacking
State handle hijacking is guessing or stealing another caller's handle for state kept across calls, and using it as if it were your own. Possession of a handle is not authentication; a handle should be random, bound to the verified user on the server, and expire.
Example: alice successfully guessing d1 is the attack in one sentence; binding the stored state to the user named in the verified token, rather than trusting whichever handle arrives, is the entire fix.