mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Improve token rotation and increase logging
- avoid access denied on bad cookie, instead just nuke it - avoid marking a token unseen for first minute post rotation - log path in user auth token logs
This commit is contained in:
@ -227,13 +227,19 @@ describe UserAuthToken do
|
||||
).count).to eq(1)
|
||||
|
||||
fake_token = SecureRandom.hex
|
||||
UserAuthToken.lookup(fake_token, seen: true, user_agent: "bob", client_ip: "127.0.0.1")
|
||||
UserAuthToken.lookup(fake_token,
|
||||
seen: true,
|
||||
user_agent: "bob",
|
||||
client_ip: "127.0.0.1",
|
||||
path: "/path"
|
||||
)
|
||||
|
||||
expect(UserAuthTokenLog.where(
|
||||
action: "miss token",
|
||||
auth_token: UserAuthToken.hash_token(fake_token),
|
||||
user_agent: "bob",
|
||||
client_ip: "127.0.0.1"
|
||||
client_ip: "127.0.0.1",
|
||||
path: "/path"
|
||||
).count).to eq(1)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user