Skip to content

Commit 2c583e4

Browse files
committed
Merge branch 'release/v1.21' into blender-merged-develop
2 parents 2a74fc8 + e20023a commit 2c583e4

File tree

7 files changed

+151
-11
lines changed

7 files changed

+151
-11
lines changed

CHANGELOG.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,62 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.com).
66

7-
## [1.21.5](https://github.com/go-gitea/gitea/releases/tag/1.21.5) - 2024-01-31
7+
## [1.21.6](https://github.com/go-gitea/gitea/releases/tag/v1.21.6) - 2024-02-22
8+
9+
* SECURITY
10+
* Fix XSS vulnerabilities (#29336)
11+
* Use general token signing secret (#29205) (#29325)
12+
* API
13+
* Refactor issue template parsing and fix API endpoint (#29069) (#29140)
14+
* Fix swift packages not resolving (#29095) (#29102)
15+
* ENHANCEMENTS
16+
* Refactor git version functions and check compatibility (#29155) (#29157)
17+
* Improve user experience for outdated comments (#29050) (#29086)
18+
* Hide code links on release page if user cannot read code (#29064) (#29066)
19+
* Wrap contained tags and branches again (#29021) (#29026)
20+
* Fix incorrect button CSS usages (#29015) (#29023)
21+
* Strip trailing newline in markdown code copy (#29019) (#29022)
22+
* BUGFIXES
23+
* Remove SSH workaround (#27893) (#29332)
24+
* Only log error when tag sync fails (#29295) (#29327)
25+
* Fix SSPI user creation (#28948) (#29323)
26+
* Improve the `issue_comment` workflow trigger event (#29277) (#29322)
27+
* Discard unread data of `git cat-file` (#29297) (#29310)
28+
* Fix error display when merging PRs (#29288) (#29309)
29+
* Prevent double use of `git cat-file` session. (#29298) (#29301)
30+
* Fix missing link on outgoing new release notifications (#29079) (#29300)
31+
* Fix debian InRelease Acquire-By-Hash newline (#29204) (#29299)
32+
* Always write proc-receive hook for all git versions (#29287) (#29291)
33+
* Do not show delete button when time tracker is disabled (#29257) (#29279)
34+
* Workaround to clean up old reviews on creating a new one (#28554) (#29264)
35+
* Fix bug when the linked account was disactived and list the linked accounts (#29263)
36+
* Do not use lower tag names to find releases/tags (#29261) (#29262)
37+
* Fix missed edit issues event for actions (#29237) (#29251)
38+
* Only delete scheduled workflows when needed (#29091) (#29235)
39+
* Make submit event code work with both jQuery event and native event (#29223) (#29234)
40+
* Fix push to create with capitalize repo name (#29090) (#29206)
41+
* Use ghost user if user was not found (#29161) (#29169)
42+
* Dont load Review if Comment is CommentTypeReviewRequest (#28551) (#29160)
43+
* Refactor parseSignatureFromCommitLine (#29054) (#29108)
44+
* Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081) (#29089)
45+
* Fix gitea-origin-url with default ports (#29085) (#29088)
46+
* Fix orgmode link resolving (#29024) (#29076)
47+
* Fix: Elasticsearch: Request Entity Too Large #28117 (#29062) (#29075)
48+
* Do not render empty comments (#29039) (#29049)
49+
* Avoid sending update/delete release notice when it is draft (#29008) (#29025)
50+
* DOCS
51+
* Rm outdated docs from some languages (#27530) (#29208)
52+
* MISC
53+
* Implement some action notifier functions (#29173) (#29308)
54+
* Fix gitea-action user avatar broken on edited menu (#29190) (#29307)
55+
* Disallow merge when required checked are missing (#29143) (#29268)
56+
* Convert visibility to number (#29226) (#29244)
57+
* Load outdated comments when (un)resolving conversation on PR timeline (#29203) (#29221)
58+
* Fix incorrect link to swift doc and swift package-registry login command (#29096) (#29103)
59+
* Fix typos in the documentation (#29048) (#29056)
60+
* Explained where create issue/PR template (#29035)
61+
62+
## [1.21.5](https://github.com/go-gitea/gitea/releases/tag/v1.21.5) - 2024-01-31
863

964
* SECURITY
1065
* Prevent anonymous container access if `RequireSignInView` is enabled (#28877) (#28882)
@@ -37,7 +92,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
3792
* Warn that `DISABLE_QUERY_AUTH_TOKEN` is false only if it's explicitly defined (#28783) (#28868)
3893
* Remove duplicated checkinit on git module (#28824) (#28831)
3994

40-
## [1.21.4](https://github.com/go-gitea/gitea/releases/tag/1.21.4) - 2024-01-16
95+
## [1.21.4](https://github.com/go-gitea/gitea/releases/tag/v1.21.4) - 2024-01-16
4196

4297
* SECURITY
4398
* Update github.com/cloudflare/circl (#28789) (#28790)
@@ -91,7 +146,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com).
91146
* Concatenate error in `checkIfPRContentChanged` (#28731) (#28737)
92147
* Improve 1.21 document for Database Preparation (#28643) (#28644)
93148

94-
## [1.21.3](https://github.com/go-gitea/gitea/releases/tag/1.21.3) - 2023-12-21
149+
## [1.21.3](https://github.com/go-gitea/gitea/releases/tag/v1.21.3) - 2023-12-21
95150

96151
* SECURITY
97152
* Update golang.org/x/crypto (#28519)

templates/repo/issue/view_content/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@
615615
{{else}}
616616
{{$reviewerName = .Review.OriginalAuthor}}
617617
{{end}}
618-
{{ctx.Locale.Tr "repo.issues.review.dismissed" $reviewerName $createdStr | Safe}}
618+
<span class="dismissed-message">{{ctx.Locale.Tr "repo.issues.review.dismissed" ($reviewerName | Escape) $createdStr | Safe}}</span>
619619
</span>
620620
</div>
621621
{{if .Content}}

templates/repo/migrate/migrating.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<div class="ui stackable middle very relaxed page grid">
2222
<div class="sixteen wide center aligned centered column">
2323
<div id="repo_migrating_progress">
24-
<p>{{ctx.Locale.Tr "repo.migrate.migrating" .CloneAddr | Safe}}</p>
24+
<p>{{ctx.Locale.Tr "repo.migrate.migrating" (.CloneAddr | Escape) | Safe}}</p>
2525
<p id="repo_migrating_progress_message"></p>
2626
</div>
2727
<div id="repo_migrating_failed" class="gt-hidden">
2828
{{if .CloneAddr}}
29-
<p>{{ctx.Locale.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
29+
<p>{{ctx.Locale.Tr "repo.migrate.migrating_failed" (.CloneAddr | Escape) | Safe}}</p>
3030
{{else}}
3131
<p>{{ctx.Locale.Tr "repo.migrate.migrating_failed_no_addr" | Safe}}</p>
3232
{{end}}
@@ -58,7 +58,7 @@
5858
<div class="content">
5959
<div class="ui warning message">
6060
{{ctx.Locale.Tr "repo.settings.delete_notices_1" | Safe}}<br>
61-
{{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe}}
61+
{{ctx.Locale.Tr "repo.settings.delete_notices_2" (.Repository.FullName | Escape) | Safe}}
6262
{{if .Repository.NumForks}}<br>
6363
{{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}
6464
{{end}}

templates/repo/settings/options.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@
906906
<div class="content">
907907
<div class="ui warning message">
908908
{{ctx.Locale.Tr "repo.settings.delete_notices_1" | Safe}}<br>
909-
{{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe}}
909+
{{ctx.Locale.Tr "repo.settings.delete_notices_2" (.Repository.FullName | Escape) | Safe}}
910910
{{if .Repository.NumForks}}<br>
911911
{{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}
912912
{{end}}
@@ -941,7 +941,7 @@
941941
<div class="content">
942942
<div class="ui warning message">
943943
{{ctx.Locale.Tr "repo.settings.delete_notices_1" | Safe}}<br>
944-
{{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name | Safe}}
944+
{{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" (.Repository.Name | Escape) | Safe}}
945945
</div>
946946
<form class="ui form" action="{{.Link}}" method="post">
947947
{{.CsrfTokenHtml}}

templates/repo/wiki/revision.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{$title}}
1111
<div class="ui sub header gt-word-break">
1212
{{$timeSince := TimeSince .Author.When ctx.Locale}}
13-
{{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
13+
{{ctx.Locale.Tr "repo.wiki.last_commit_info" (.Author.Name | Escape) $timeSince | Safe}}
1414
</div>
1515
</div>
1616
</div>

templates/repo/wiki/view.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{{$title}}
4141
<div class="ui sub header">
4242
{{$timeSince := TimeSince .Author.When ctx.Locale}}
43-
{{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
43+
{{ctx.Locale.Tr "repo.wiki.last_commit_info" (.Author.Name | Escape) $timeSince | Safe}}
4444
</div>
4545
</div>
4646
<div class="eight wide right aligned column">

tests/integration/xss_test.go

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@
44
package integration
55

66
import (
7+
"context"
8+
"fmt"
79
"net/http"
10+
"net/url"
11+
"os"
12+
"path/filepath"
13+
"strings"
814
"testing"
15+
"time"
916

1017
"code.gitea.io/gitea/models/unittest"
1118
user_model "code.gitea.io/gitea/models/user"
19+
"code.gitea.io/gitea/modules/git"
1220
"code.gitea.io/gitea/tests"
1321

22+
gogit "github.com/go-git/go-git/v5"
23+
"github.com/go-git/go-git/v5/plumbing/object"
1424
"github.com/stretchr/testify/assert"
1525
)
1626

@@ -37,3 +47,78 @@ func TestXSSUserFullName(t *testing.T) {
3747
htmlDoc.doc.Find("div.content").Find(".header.text.center").Text(),
3848
)
3949
}
50+
51+
func TestXSSWikiLastCommitInfo(t *testing.T) {
52+
onGiteaRun(t, func(t *testing.T, u *url.URL) {
53+
// Prepare the environment.
54+
dstPath := t.TempDir()
55+
r := fmt.Sprintf("%suser2/repo1.wiki.git", u.String())
56+
u, err := url.Parse(r)
57+
assert.NoError(t, err)
58+
u.User = url.UserPassword("user2", userPassword)
59+
assert.NoError(t, git.CloneWithArgs(context.Background(), git.AllowLFSFiltersArgs(), u.String(), dstPath, git.CloneRepoOptions{}))
60+
61+
// Use go-git here, because using git wouldn't work, it has code to remove
62+
// `<`, `>` and `\n` in user names. Even though this is permitted and
63+
// wouldn't result in a error by a Git server.
64+
gitRepo, err := gogit.PlainOpen(dstPath)
65+
if err != nil {
66+
panic(err)
67+
}
68+
69+
w, err := gitRepo.Worktree()
70+
if err != nil {
71+
panic(err)
72+
}
73+
74+
filename := filepath.Join(dstPath, "Home.md")
75+
err = os.WriteFile(filename, []byte("Oh, a XSS attack?"), 0o644)
76+
if !assert.NoError(t, err) {
77+
t.FailNow()
78+
}
79+
80+
_, err = w.Add("Home.md")
81+
if !assert.NoError(t, err) {
82+
t.FailNow()
83+
}
84+
85+
_, err = w.Commit("Yay XSS", &gogit.CommitOptions{
86+
Author: &object.Signature{
87+
Name: `Gusted <script class="evil">alert('Oh no!');</script>`,
88+
Email: "valid@example.org",
89+
When: time.Date(2024, time.January, 31, 0, 0, 0, 0, time.UTC),
90+
},
91+
})
92+
if !assert.NoError(t, err) {
93+
t.FailNow()
94+
}
95+
96+
// Push.
97+
_, _, err = git.NewCommand(git.DefaultContext, "push").AddArguments(git.ToTrustedCmdArgs([]string{"origin", "master"})...).RunStdString(&git.RunOpts{Dir: dstPath})
98+
assert.NoError(t, err)
99+
100+
// Check on page view.
101+
t.Run("Page view", func(t *testing.T) {
102+
defer tests.PrintCurrentTest(t)()
103+
104+
req := NewRequest(t, http.MethodGet, "/user2/repo1/wiki/Home")
105+
resp := MakeRequest(t, req, http.StatusOK)
106+
htmlDoc := NewHTMLParser(t, resp.Body)
107+
108+
htmlDoc.AssertElement(t, "script.evil", false)
109+
assert.EqualValues(t, `Gusted edited this page 0001-01-01 00:00:00 +00:00`, strings.TrimSpace(htmlDoc.Find(".ui.sub.header").Text()))
110+
})
111+
112+
// Check on revisions page.
113+
t.Run("Revision page", func(t *testing.T) {
114+
defer tests.PrintCurrentTest(t)()
115+
116+
req := NewRequest(t, http.MethodGet, "/user2/repo1/wiki/Home?action=_revision")
117+
resp := MakeRequest(t, req, http.StatusOK)
118+
htmlDoc := NewHTMLParser(t, resp.Body)
119+
120+
htmlDoc.AssertElement(t, "script.evil", false)
121+
assert.EqualValues(t, `Gusted edited this page 0001-01-01 00:00:00 +00:00`, strings.TrimSpace(htmlDoc.Find(".ui.sub.header").Text()))
122+
})
123+
})
124+
}

0 commit comments

Comments
 (0)