Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 May 2010 at 22:00 UTC
Updated:
31 Aug 2014 at 14:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damien tournoud commentedHere is what the current merge query in _drupal_session_write() does:
If I understand correctly, what it *should* do is:
Comment #2
damien tournoud commentedHere is a patch that implements #1. The session tests pass under SQLite now.
Comment #3
chx commentedThis patch also passes tests and does
double cookies mean that both a secure session cookie and an insecure session cookie is present and the variable https is on too.
Also it finally allows (sid,ssid) as the primary key. This makes me feel warm and fuzzy.
There can be fun spinoffs from this patch because a) there was never a test for NULL ssid. Surely we need to do that? b) why ->condition does not do the right thing for ->condition('foo', NULL)? Edit: #813540: Comparisons involving NULL must never return true
Comment #4
damien tournoud commentedMarked #764810: Secure Session cleanup: fix session regenerate db_update, test for insecure session cookie during session init as a duplicate, some elements from the other issue will have to be carried around here. Please make sure mfb is credited.
Comment #6
damien tournoud commentedMerged both patches.
The logic in
drupal_session_regenerate()is still broken, because the code doesn't correctly distinguish "I'm in HTTPS and the user was logged using a secure cookie" and "I'm in HTTPS and the user was logged using a insecure cookie", because it usesisset(session_id())for that and this is always true.Comment #7
chx commented#6: 813492-session-remix.patch queued for re-testing.
Comment #8
rfaysubscribe
Comment #9
chx commentedMySQL does not allow NULLs in any of the fields of the compound key (boo) but oh well, empty string works too -- it wont be a problem as only (sid,ssid) needs to be unique neither sid nor ssid is mandated to be unique so they do not really need to be NULL.
Damien's problem, I let him either explain better or fix it. I don't get it.
Comment #10
chx commentedMinus debug
Comment #12
chx commentedI found this in my IRC log and while I could not ask Damien permission to post I can't imagine what I would breach by doing this so "what needs to be tested is: put something in the session as HTTP, login as HTTPS, verify that the session has been carried over, get back to the original anonymous cookie, verify that this session is now inactive". I will write that test.
Comment #13
chx commentedKeeping up w HEAD
Comment #16
chx commentedNow, now.
Comment #17
Anonymous (not verified) commentedas discussed with chx in #drupal, i've added a check in the test to make sure that the pre-login anonymous cookie has its session invalidated after login.
Comment #18
damien tournoud commentedThanks for working on this, Justin.
Great fix, great additional test coverage. I verify that it passes on both MySQL and SQLite, let's get this in.
Comment #19
dries commentedCommitted to CVS HEAD. I'm moving this to head to head.
Comment #20
damien tournoud commentedCould we please keep core issues in the core queue and open separate issues for HEAD-to-HEAD?
We can use a tag if that's useful for tracking (for example "Schema Update").
Comment #21
c960657 commentedLooks like the column descriptions in hook_schema() needs to reflect that (sid, ssid) is now a multi-column primary key. I think we should just omit the "Primary key"/"Unique key" prefix - it is redundant, and the convention is not used elsewhere in core.
Comment #22
c960657 commentedBTW, shouldn't we add an index on the ssid column?
Comment #23
chx commentedoh dang yes we should!
Comment #24
chx commentedThere is nothing to review here I have merely executed the requests of c960657
Comment #25
webchickWe're going to need to add that index too on whatever update hook adds the ssid column, no?
Comment #26
marcingy commentedThere is actually no update function that creates ssids on existing sites. This version of the patch adds an update function to create ssid column as part of the upgrade process and adds an index.
Comment #27
marcingy commentedAfter speaks to chx reworking to move the update to update.inc.
Comment #28
catchShould be "+ // Add ssid column and index.
Otherwise seems fine, a little disturbing we had this broken for so long.
Comment #29
marcingy commentedFix typo
Comment #30
chx commentedSounds a plan. I have removed a stray newline.
Comment #31
catchNeither patch fully fixes #28.
Comment #32
marcingy commentedRemove white space and fix typo (hopefully)
Comment #33
marcingy commentedFix another docs issue
Comment #34
catchComment #35
webchickCool, thanks for that!
Committed to HEAD.
Comment #37
mfbI think this patch might have re-opened #575280: Impersonation when an https session exists.? Or is it just me seeing empty string sid and ssid values in my sessions table...
Comment #38
sun#2330279: When operating in mixed mode SSL: data from anonymous non-HTTP session is still available after login discovered a bug that seems to exist since this was committed, causing a different behavior than the expected. Your feedback over there would be appreciated.