@@ -803,7 +803,8 @@ func NewIssue(ctx *context.Context) {
803803 body := ctx .FormString ("body" )
804804 ctx .Data ["BodyQuery" ] = body
805805
806- ctx .Data ["IsProjectsEnabled" ] = ctx .Repo .CanRead (unit .TypeProjects )
806+ isProjectsEnabled := ctx .Repo .CanRead (unit .TypeProjects )
807+ ctx .Data ["IsProjectsEnabled" ] = isProjectsEnabled
807808 ctx .Data ["IsAttachmentEnabled" ] = setting .Attachment .Enabled
808809 upload .AddUploadContext (ctx , "comment" )
809810
@@ -819,7 +820,7 @@ func NewIssue(ctx *context.Context) {
819820 }
820821
821822 projectID := ctx .FormInt64 ("project" )
822- if projectID > 0 {
823+ if projectID > 0 && isProjectsEnabled {
823824 project , err := project_model .GetProjectByID (ctx , projectID )
824825 if err != nil {
825826 log .Error ("GetProjectByID: %d: %v" , projectID , err )
@@ -1043,6 +1044,11 @@ func NewIssuePost(ctx *context.Context) {
10431044 }
10441045
10451046 if projectID > 0 {
1047+ if ! ctx .Repo .CanRead (unit .TypeProjects ) {
1048+ // User must also be able to see the project.
1049+ ctx .Error (http .StatusBadRequest , "user hasn't permissions to read projects" )
1050+ return
1051+ }
10461052 if err := issues_model .ChangeProjectAssign (issue , ctx .Doer , projectID ); err != nil {
10471053 ctx .ServerError ("ChangeProjectAssign" , err )
10481054 return
@@ -1783,6 +1789,10 @@ func getActionIssues(ctx *context.Context) []*issues_model.Issue {
17831789 issueUnitEnabled := ctx .Repo .CanRead (unit .TypeIssues )
17841790 prUnitEnabled := ctx .Repo .CanRead (unit .TypePullRequests )
17851791 for _ , issue := range issues {
1792+ if issue .RepoID != ctx .Repo .Repository .ID {
1793+ ctx .NotFound ("some issue's RepoID is incorrect" , errors .New ("some issue's RepoID is incorrect" ))
1794+ return nil
1795+ }
17861796 if issue .IsPull && ! prUnitEnabled || ! issue .IsPull && ! issueUnitEnabled {
17871797 ctx .NotFound ("IssueOrPullRequestUnitNotAllowed" , nil )
17881798 return nil
0 commit comments