Merge pull request #4736 from zh199225/develop
修正:XSRFToken函数在特定情况下会产生多个不同Path的_xsrf同名cookie
This commit is contained in:
commit
cf00f74882
@ -58,6 +58,7 @@
|
|||||||
- Refactor: Move `BindXXX` and `XXXResp` methods to `context.Context`. [4718](https://github.com/beego/beego/pull/4718)
|
- Refactor: Move `BindXXX` and `XXXResp` methods to `context.Context`. [4718](https://github.com/beego/beego/pull/4718)
|
||||||
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
|
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
|
||||||
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
|
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
|
||||||
|
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735)
|
||||||
|
|
||||||
## Fix Sonar
|
## Fix Sonar
|
||||||
|
|
||||||
|
|||||||
@ -270,7 +270,7 @@ func (ctx *Context) XSRFToken(key string, expire int64) string {
|
|||||||
if !ok {
|
if !ok {
|
||||||
token = string(utils.RandomCreateBytes(32))
|
token = string(utils.RandomCreateBytes(32))
|
||||||
// TODO make it configurable
|
// TODO make it configurable
|
||||||
ctx.SetSecureCookie(key, "_xsrf", token, expire, "", "")
|
ctx.SetSecureCookie(key, "_xsrf", token, expire, "/", "")
|
||||||
}
|
}
|
||||||
ctx._xsrfToken = token
|
ctx._xsrfToken = token
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user