1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 19:53:19 +00:00

🐛 Session Id immutable (#1601)

Close #1585
This commit is contained in:
RW 2021-10-28 08:23:56 +02:00 committed by GitHub
parent cdbcfbec17
commit acc32db005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,7 @@ func (s *Store) Get(c *fiber.Ctx) (*Session, error) {
func (s *Store) getSessionID(c *fiber.Ctx) string {
id := c.Cookies(s.sessionName)
if len(id) > 0 {
return id
return utils.CopyString(id)
}
if s.source == SourceHeader {
@ -107,7 +107,7 @@ func (s *Store) getSessionID(c *fiber.Ctx) string {
if s.source == SourceURLQuery {
id = c.Query(s.sessionName)
if len(id) > 0 {
return id
return utils.CopyString(id)
}
}
@ -130,7 +130,7 @@ func (s *Store) responseCookies(c *fiber.Ctx) (string, error) {
value := make([]byte, len(cookie.Value()))
copy(value, cookie.Value())
id := utils.UnsafeString(value)
id := string(value)
return id, nil
}