Page MenuHomePhabricator

Issue "anonymous" sessions for logged-out users
ClosedPublic

Authored by epriestley on Jan 23 2014, 6:18 PM.
Tags
None
Referenced Files
F14039236: D8043.id18210.diff
Mon, Nov 11, 4:40 AM
F14035309: D8043.diff
Sun, Nov 10, 5:25 AM
F14007574: D8043.diff
Tue, Oct 29, 8:13 AM
F13990642: D8043.id18194.diff
Tue, Oct 22, 5:14 AM
F13984280: D8043.diff
Oct 20 2024, 12:12 PM
F13984125: D8043.diff
Oct 20 2024, 11:06 AM
F13976402: D8043.id.diff
Oct 18 2024, 2:06 PM
F13975218: D8043.diff
Oct 18 2024, 9:15 AM
Subscribers

Details

Summary

Ref T4339. Ref T4310. Currently, sessions look like "afad85d675fda87a4fadd54", and are only issued for logged-in users. To support logged-out CSRF and (eventually) external user sessions, I made two small changes:

  • First, sessions now have a "kind", which is indicated by a prefix, like "A/ab987asdcas7dca". This mostly allows us to issue session queries more efficiently: we don't have to issue a query at all for anonymous sessions, and can join the correct table for user and external sessions and save a query. Generally, this gives us more debugging information and more opportunity to recover from issues in a user-friendly way, as with the "invalid session" error in this diff.
  • Secondly, if you load a page and don't have a session, we give you an anonymous session. This is just a secret with no special significance.

This does not implement CSRF yet, but gives us a client secret we can use to implement it.

Test Plan
  • Logged in.
  • Logged out.
  • Browsed around.
  • Logged in again.
  • Went through link/register.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/applications/base/controller/PhabricatorController.php
39

For consistency with D8041.