mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
fix(sec): permission check for project issue
- Do an access check when loading issues for a project column, currently this is not done and exposes the title, labels and existence of a private issue that the viewer of the project board may not have access to. - The number of issues cannot be calculated in a efficient manner and stored in the database because their number may vary depending on the visibility of the repositories participating in the project. The previous implementation used the pre-calculated numbers stored in each project, which did not reflect that potential variation. - The code is derived from https://github.com/go-gitea/gitea/pull/22865
This commit is contained in:
parent
94845020e8
commit
b1b635c1d9
7 changed files with 83 additions and 43 deletions
|
@ -125,6 +125,19 @@ func Projects(ctx *context.Context) {
|
|||
ctx.Data["IsProjectsPage"] = true
|
||||
ctx.Data["SortType"] = sortType
|
||||
|
||||
numOpenIssues, err := issues_model.NumIssuesInProjects(ctx, projects, ctx.Doer, ctx.Org.Organization, optional.Some(false))
|
||||
if err != nil {
|
||||
ctx.ServerError("NumIssuesInProjects", err)
|
||||
return
|
||||
}
|
||||
numClosedIssues, err := issues_model.NumIssuesInProjects(ctx, projects, ctx.Doer, ctx.Org.Organization, optional.Some(true))
|
||||
if err != nil {
|
||||
ctx.ServerError("NumIssuesInProjects", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["NumOpenIssuesInProject"] = numOpenIssues
|
||||
ctx.Data["NumClosedIssuesInProject"] = numClosedIssues
|
||||
|
||||
ctx.HTML(http.StatusOK, tplProjects)
|
||||
}
|
||||
|
||||
|
@ -310,7 +323,7 @@ func ViewProject(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
issuesMap, err := issues_model.LoadIssuesFromColumnList(ctx, columns)
|
||||
issuesMap, err := issues_model.LoadIssuesFromColumnList(ctx, columns, ctx.Doer, nil, optional.None[bool]())
|
||||
if err != nil {
|
||||
ctx.ServerError("LoadIssuesOfColumns", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue