diff --git a/CHANGELOG.md b/CHANGELOG.md index fb2fb8898..c8180a808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ All notable changes to Gogs are documented in this file. ### Fixed +- _Security:_ Stored XSS for issue assignees. [#7145](https://github.com/gogs/gogs/issues/7145) - Unable to use LDAP authentication on ARM machines. [#6761](https://github.com/gogs/gogs/issues/6761) - Unable to choose "Lookup Avatar by mail" in user settings without deleting custom avatar. [#7267](https://github.com/gogs/gogs/pull/7267) - Mistakenly include the "data" directory under the custom directory in the Docker setup. [#7343](https://github.com/gogs/gogs/pull/7343) diff --git a/internal/db/repo.go b/internal/db/repo.go index 7e5184139..6a7107178 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -483,6 +483,11 @@ func (repo *Repository) getUsersWithAccesMode(e Engine, mode AccessMode) (_ []*U if err = e.In("id", userIDs).Find(&users); err != nil { return nil, err } + + // TODO(unknwon): Rely on AfterFind hook to sanitize user full name. + for _, u := range users { + u.FullName = markup.Sanitize(u.FullName) + } } if !repo.Owner.IsOrganization() { users = append(users, repo.Owner) diff --git a/internal/db/user.go b/internal/db/user.go index 22f25b5da..4575feb08 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -32,6 +32,7 @@ import ( "gogs.io/gogs/internal/conf" "gogs.io/gogs/internal/db/errors" "gogs.io/gogs/internal/errutil" + "gogs.io/gogs/internal/markup" "gogs.io/gogs/internal/strutil" "gogs.io/gogs/internal/tool" ) @@ -920,14 +921,18 @@ func GetUserByKeyID(keyID int64) (*User, error) { return user, nil } +// Deprecated: Use Users.GetByID instead. func getUserByID(e Engine, id int64) (*User, error) { u := new(User) has, err := e.ID(id).Get(u) if err != nil { return nil, err } else if !has { - return nil, ErrUserNotExist{args: map[string]interface{}{"userID": id}} + return nil, ErrUserNotExist{args: errutil.Args{"userID": id}} } + + // TODO(unknwon): Rely on AfterFind hook to sanitize user full name. + u.FullName = markup.Sanitize(u.FullName) return u, nil }