MM-55320 - Limit length of browser user agent version; ratelimit the /sessions endpoint (#25900)
* add ratelimit to /sessions; cap userAgent version length; tests * add MaxSessionsLimit; remove oldest session first; tests * can't use slices in 1.20; improve test * nits * add GetLRUSessions; move limiting to CreateSession; remove rate limiting * use queryBuilder * mysql needs a limit when using offset * update i18n * refactor into limitNumberOfSessions; protect createSessionForUserAccessToken * add comment to GetLRUSessions * add limit to oauth path; PR comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9a2d96073e
Коммит
17d11db395
@@ -41,6 +41,10 @@ func (ps *PlatformService) GetSessions(c request.CTX, userID string) ([]*model.S
|
||||
return ps.Store.Session().GetSessions(c, userID)
|
||||
}
|
||||
|
||||
func (ps *PlatformService) GetLRUSessions(c request.CTX, userID string, limit uint64, offset uint64) ([]*model.Session, error) {
|
||||
return ps.Store.Session().GetLRUSessions(c, userID, limit, offset)
|
||||
}
|
||||
|
||||
func (ps *PlatformService) AddSessionToCache(session *model.Session) {
|
||||
ps.sessionCache.SetWithExpiry(session.Token, session, time.Duration(int64(*ps.Config().ServiceSettings.SessionCacheInMinutes))*time.Minute)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user