fix: add missing checks to several handlers and models (#39839)

Several handlers and model helpers skipped checks that their siblings
already perform.

- Only match principal keys when looking up SSH certificate principals
- Return no attachments for an unsaved issue instead of every issue-less
one
- Reject issue and comment attachments when adding release attachments
- Share one permission check for editing, deleting and reacting to issue
content and for comment attachments between the web UI and the API,
refusing them on locked issues for users who can't write
- Reject issue edits, deletion and label changes in archived
repositories via the API
- Apply cross-origin protection to the repository topics endpoint
- Return 404 for the repositories tab of individual users and respect
profile visibility for the heatmap

Fixes: https://github.com/go-gitea/gitea/issues/39226
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
authored and GitHub committed 2026-10-18 06:29:49 -07:00
1 parent 1031e34987
commit ae17c14cff
28 files changed
+290 -221

No files matched your search

+18
View File
@@ -23825,6 +23825,9 @@
},
"404": {
"$ref": "#/components/responses/notFound"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Delete an issue",
@@ -23932,6 +23935,9 @@
},
"412": {
"$ref": "#/components/responses/error"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.",
@@ -25151,6 +25157,9 @@
},
"404": {
"$ref": "#/components/responses/notFound"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Remove all labels from an issue",
@@ -25254,6 +25263,9 @@
},
"404": {
"$ref": "#/components/responses/notFound"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Add a label to an issue",
@@ -25312,6 +25324,9 @@
},
"404": {
"$ref": "#/components/responses/notFound"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Replace an issue's labels",
@@ -25375,6 +25390,9 @@
},
"422": {
"$ref": "#/components/responses/validationError"
},
"423": {
"$ref": "#/components/responses/repoArchivedError"
}
},
"summary": "Remove a label from an issue",
+18
View File
@@ -11870,6 +11870,9 @@
},
"404": {
"$ref": "#/responses/notFound"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
},
@@ -11929,6 +11932,9 @@
},
"412": {
"$ref": "#/responses/error"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
}
@@ -13089,6 +13095,9 @@
},
"404": {
"$ref": "#/responses/notFound"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
},
@@ -13144,6 +13153,9 @@
},
"404": {
"$ref": "#/responses/notFound"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
},
@@ -13189,6 +13201,9 @@
},
"404": {
"$ref": "#/responses/notFound"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
}
@@ -13247,6 +13262,9 @@
},
"422": {
"$ref": "#/responses/validationError"
},
"423": {
"$ref": "#/responses/repoArchivedError"
}
}
}