Skip to content

Commit

Permalink
[BUGFIX] Make Session Attribute Key Non Random (#33)
Browse files Browse the repository at this point in the history
* between v1 and v2 the session expiration attr key became a random value
* this caused sessions generated in one app/daemon/etc to have expirations not aligning with others
* this patch basically restores the functionality found in v1
* fixes #32
  • Loading branch information
james-d-elliott authored Jan 9, 2021
1 parent 5de2a6c commit 1423b97
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ const defaultCookieLen uint32 = 32
// If set the cookie expiration when the browser is closed (-1), set the expiration as a keep alive (2 days)
// so as not to keep dead sessions for a long time
const keepAliveExpiration = 2 * 24 * time.Hour
const expirationAttrKey = "__store:expiration__"
5 changes: 0 additions & 5 deletions store.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package session

import (
"fmt"
"time"

"github.com/savsgio/gotils/bytes"
)

var expirationAttrKey = fmt.Sprintf("__store:expiration:%s__", bytes.Rand(make([]byte, 5)))

// NewStore returns a new empty store
func NewStore() *Store {
return &Store{
Expand Down

0 comments on commit 1423b97

Please sign in to comment.