# fix\(desktop\): keep lone-surrogate scopes in distinct browser partitions · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/1a5aa8592169f1da2a1db4aaf9472887eb70b4a9)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 1a5aa8592169f1da2a1db4aaf9472887eb70b4a9

Requested commit: 1a5aa8592169f1da2a1db4aaf9472887eb70b4a9

Commit: 1a5aa8592169f1da2a1db4aaf9472887eb70b4a9

Tree: 64e14e1a4c031ac06770dc989fe27c85797fc787

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(desktop): keep lone-surrogate scopes in distinct browser partitions

The partition digest hashed `TextEncoder().encode(scope)`, which replaces a
lone UTF-16 surrogate with U+FFFD — so two supported ids differing only by
such a unit (`"p\ud800"` vs `"p�"`) landed in the same partition and
shared every cookie and site storage. Lone surrogates are now escaped to
`\uXXXX` before hashing, with a literal backslash doubled so the escape
cannot be forged. Every well-formed scope passes through byte-for-byte
unchanged, so existing partitions — and the logins in them — stay put.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

```

## Parents

- [fe5a26f7eb73faf5202b151165b70389dde9c2ae](https://git.cafe/pingdotgg/t3code/commit/fe5a26f7eb73faf5202b151165b70389dde9c2ae?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/1a5aa8592169f1da2a1db4aaf9472887eb70b4a9?format=markdown)
