diff options
author | Gusted <postmaster@gusted.xyz> | 2024-10-30 16:59:48 +0100 |
---|---|---|
committer | 0ko <0ko@noreply.codeberg.org> | 2024-10-30 16:59:48 +0100 |
commit | dfe3ffc581eb2fb2137aa9f1530d1296bc6a2801 (patch) | |
tree | 1cf94462d3460e33a2e4eb2cbd50b45e7316df3a /templates | |
parent | i18n: update of translations from Codeberg Translate (#5681) (diff) | |
download | forgejo-dfe3ffc581eb2fb2137aa9f1530d1296bc6a2801.tar.xz forgejo-dfe3ffc581eb2fb2137aa9f1530d1296bc6a2801.zip |
feat: harden localization against malicious HTML (#5703)
- Add a new script that proccess the localization files and verify that
they only contain HTML according to our strictly defined rules.
- This should make adding malicious HTML near-impossible.
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5703
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/editor/commit_form.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 4 | ||||
-rw-r--r-- | templates/user/settings/applications.tmpl | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index 9f81b1d3a0..f8c1beb027 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -26,7 +26,7 @@ <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" button_text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}> <label> {{svg "octicon-git-commit"}} - {{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName}} + {{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName "branch-name"}} {{if not .CanCommitToBranch.CanCommitToBranch}} <div class="ui visible small warning message"> {{ctx.Locale.Tr "repo.editor.no_commit_to_branch"}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 78fa854dbe..fb4ceb10c1 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -549,7 +549,7 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{if .IsForcePush}} - {{ctx.Locale.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr}} + {{ctx.Locale.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr "ui sha"}} {{else}} {{ctx.Locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr}} {{end}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index f60d958a1c..f63cea1856 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -79,11 +79,11 @@ {{end}} {{else}} {{if .Issue.OriginalAuthor}} - <span id="pull-desc-display" class="pull-desc">{{.Issue.OriginalAuthor}} {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}}</span> + <span id="pull-desc-display" class="pull-desc">{{.Issue.OriginalAuthor}} {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref "branch_target"}}</span> {{else}} <span id="pull-desc-display" class="pull-desc"> <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> - {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}} + {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref "branch_target"}} </span> {{end}} {{if .MadeUsingAGit}} diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index 04d4dcdb18..5354bef4e3 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -75,7 +75,7 @@ {{ctx.Locale.Tr "settings.select_permissions"}} </summary> <p class="activity meta"> - <p>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://forgejo.org/docs/latest/user/token-scope/" target="_blank"`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "settings.access_token_desc" (printf "%s/api/swagger" AppSubUrl) "https://forgejo.org/docs/latest/user/token-scope/"}}</p> </p> <div class="scoped-access-token" data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}" |