CVE-2023-2590 (published 2023-05-09T06:15Z)

Missing Authorization in GitHub repository answerdev/answer prior to 1.0.9.

CVSS v3 base score: 3.5, LOW (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N)

Weakness information:
cwe_id: CWE-862
cwe_name: Missing Authorization
description: The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
extended_description: 
            Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
            When access control checks are not applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
         
         

Fix information:
repo_url: https://github.com/answerdev/answer
commit_details: repo_url: https://github.com/answerdev/answer
author: LinkinStars
author_date: 2023-04-21 16:52:22+08:00
msg: fix(rank): update answer accept rank config
repository: repo_url: https://github.com/answerdev/answer
repo_name: apache/incubator-answer
description: A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
repo_language: Go
owner: answerdev
file_changes: filename: init.go
change_type: ModificationType.MODIFY
diff: @@ -270,7 +270,7 @@ func initConfigTable(engine *xorm.Engine) error {
 		{ID: 41, Key: "rank.answer.add", Value: `1`},
 		{ID: 42, Key: "rank.answer.edit", Value: `200`},
 		{ID: 43, Key: "rank.answer.delete", Value: `-1`},
-		{ID: 44, Key: "rank.answer.accept", Value: `1`},
+		{ID: 44, Key: "rank.answer.accept", Value: `-1`},
 		{ID: 45, Key: "rank.answer.vote_up", Value: `15`},
 		{ID: 46, Key: "rank.answer.vote_down", Value: `125`},
 		{ID: 47, Key: "rank.comment.add", Value: `1`},

programming_language: Go
filename: migrations.go
change_type: ModificationType.MODIFY
diff: @@ -57,6 +57,7 @@ var migrations = []Migration{
 	NewMigration("add theme and private mode", addThemeAndPrivateMode, true),
 	NewMigration("add new answer notification", addNewAnswerNotification, true),
 	NewMigration("add user pin hide features", addRolePinAndHideFeatures, true),
+	NewMigration("update accept answer rank", updateAcceptAnswerRank, true),
 }
 
 // GetCurrentDBVersion returns the current db version

programming_language: Go
filename: v3.go
change_type: ModificationType.MODIFY
diff: @@ -110,7 +110,7 @@ ON "question" (
 		{ID: 41, Key: "rank.answer.add", Value: `1`},
 		{ID: 42, Key: "rank.answer.edit", Value: `200`},
 		{ID: 43, Key: "rank.answer.delete", Value: `-1`},
-		{ID: 44, Key: "rank.answer.accept", Value: `1`},
+		{ID: 44, Key: "rank.answer.accept", Value: `-1`},
 		{ID: 45, Key: "rank.answer.vote_up", Value: `15`},
 		{ID: 46, Key: "rank.answer.vote_down", Value: `125`},
 		{ID: 47, Key: "rank.comment.add", Value: `1`},

programming_language: Go
filename: v9.go
change_type: ModificationType.ADD
diff: @@ -0,0 +1,18 @@
+package migrations
+
+import (
+	"fmt"
+
+	"github.com/answerdev/answer/internal/entity"
+	"github.com/segmentfault/pacman/log"
+	"xorm.io/xorm"
+)
+
+func updateAcceptAnswerRank(x *xorm.Engine) error {
+	c := &entity.Config{ID: 44, Key: "rank.answer.accept", Value: `-1`}
+	if _, err := x.Update(c, &entity.Config{ID: 44, Key: "rank.answer.accept"}); err != nil {
+		log.Errorf("update %+v config failed: %s", c, err)
+		return fmt.Errorf("update config failed: %w", err)
+	}
+	return nil
+}

programming_language: Go