diff options
author | Unknwon <u@gogs.io> | 2016-12-22 19:19:56 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-12-22 19:19:56 -0500 |
commit | 7ebe0a99169f2a143ccb20da5d1918a99ccaaf7d (patch) | |
tree | f5df6ce75d7651681dddd47869c87687a208c868 | |
parent | 89e93fe01e3942546b0d2cd5e031157848178916 (diff) |
Fix vulnerabilities reported in #3959
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/token.go | 9 | ||||
-rw-r--r-- | routers/api/v1/user/email.go | 1 | ||||
-rw-r--r-- | routers/user/setting.go | 7 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
6 files changed, 15 insertions, 8 deletions
@@ -3,7 +3,7 @@ Gogs - Go Git Service [ -##### Current tip version: 0.9.107 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~) +##### Current tip version: 0.9.108 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~) | Web | UI | Preview | |:-------------:|:-------:|:-------:| @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.107.1222" +const APP_VER = "0.9.108.1222" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/token.go b/models/token.go index 2c1f64ce..85600dab 100644 --- a/models/token.go +++ b/models/token.go @@ -81,8 +81,11 @@ func UpdateAccessToken(t *AccessToken) error { return err } -// DeleteAccessTokenByID deletes access token by given ID. -func DeleteAccessTokenByID(id int64) error { - _, err := x.Id(id).Delete(new(AccessToken)) +// DeleteAccessTokenByUserID deletes access token by given ID. +func DeleteAccessTokenByUserID(userID, id int64) error { + _, err := x.Delete(&AccessToken{ + ID: id, + UID: userID, + }) return err } diff --git a/routers/api/v1/user/email.go b/routers/api/v1/user/email.go index 1f615cdf..168f383a 100644 --- a/routers/api/v1/user/email.go +++ b/routers/api/v1/user/email.go @@ -69,6 +69,7 @@ func DeleteEmail(ctx *context.APIContext, form api.CreateEmailOption) { emails := make([]*models.EmailAddress, len(form.Emails)) for i := range form.Emails { emails[i] = &models.EmailAddress{ + UID: ctx.User.ID, Email: form.Emails[i], } } diff --git a/routers/user/setting.go b/routers/user/setting.go index 35bff326..9d09646c 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -280,7 +280,10 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) { } func DeleteEmail(ctx *context.Context) { - if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil { + if err := models.DeleteEmailAddress(&models.EmailAddress{ + ID: ctx.QueryInt64("id"), + UID: ctx.User.ID, + }); err != nil { ctx.Handle(500, "DeleteEmail", err) return } @@ -409,7 +412,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm } func SettingsDeleteApplication(ctx *context.Context) { - if err := models.DeleteAccessTokenByID(ctx.QueryInt64("id")); err != nil { + if err := models.DeleteAccessTokenByUserID(ctx.User.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("settings.delete_token_success")) diff --git a/templates/.VERSION b/templates/.VERSION index 1da1fccc..b946e8e6 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.107.1222
\ No newline at end of file +0.9.108.1222
\ No newline at end of file |