mirror of
https://github.com/astaxie/beego.git
synced 2025-06-11 05:20:40 +00:00
Using HTMLEscapeString in adminui.go to avoid XSS attack
This commit is contained in:
@ -284,7 +284,12 @@ func (input *BeegoInput) ParamsLen() int {
|
||||
func (input *BeegoInput) Param(key string) string {
|
||||
for i, v := range input.pnames {
|
||||
if v == key && i <= len(input.pvalues) {
|
||||
return url.PathEscape(input.pvalues[i])
|
||||
// we cannot use url.PathEscape(input.pvalues[i])
|
||||
// for example, if the value is /a/b
|
||||
// after url.PathEscape(input.pvalues[i]), the value is %2Fa%2Fb
|
||||
// However, the value is used in ControllerRegister.ServeHTTP
|
||||
// and split by "/", so function crash...
|
||||
return input.pvalues[i]
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
Reference in New Issue
Block a user