Skip to content

Commit af5a4b8

Browse files
authored
Merge branch 'main' into sidebarmargin
2 parents 54b2518 + 9264811 commit af5a4b8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

modules/ssh/ssh.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"errors"
1414
"fmt"
1515
"io"
16-
"maps"
1716
"net"
1817
"os"
1918
"os/exec"
@@ -49,6 +48,10 @@ import (
4948
// Then sessionHandler should only use the "verified keyID" from the original ssh conn, but not the ctx one.
5049
// Otherwise, if a user provides 2 keys A (a correct one) and B (public key matches but no private key),
5150
// then only A succeeds to authenticate, sessionHandler will see B's keyID
51+
//
52+
// After x/crypto >= 0.31.0 (fix CVE-2024-45337), the PublicKeyCallback will be called again for the verified key,
53+
// it mitigates the misuse for most cases, it's still good for us to make sure we don't rely on that mitigation
54+
// and do not misuse the PublicKeyCallback: we should only use the verified keyID from the verified ssh conn.
5255

5356
const giteaPermissionExtensionKeyID = "gitea-perm-ext-key-id"
5457

@@ -100,8 +103,8 @@ func ptr[T any](intf any) *T {
100103
func sessionHandler(session ssh.Session) {
101104
// here can't use session.Permissions() because it only uses the value from ctx, which might not be the authenticated one.
102105
// so we must use the original ssh conn, which always contains the correct (verified) keyID.
103-
sshConn := ptr[sessionPartial](session)
104-
keyID := sshConn.conn.Permissions.Extensions[giteaPermissionExtensionKeyID]
106+
sshSession := ptr[sessionPartial](session)
107+
keyID := sshSession.conn.Permissions.Extensions[giteaPermissionExtensionKeyID]
105108

106109
command := session.RawCommand()
107110

@@ -210,10 +213,7 @@ func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {
210213

211214
// first, reset the ctx permissions (just like https://github.com/gliderlabs/ssh/pull/243 does)
212215
// it shouldn't be reused across different ssh conn (sessions), each pub key should have its own "Permissions"
213-
oldCtxPerm := ctx.Permissions().Permissions
214216
ctx.Permissions().Permissions = &gossh.Permissions{}
215-
ctx.Permissions().Permissions.CriticalOptions = maps.Clone(oldCtxPerm.CriticalOptions)
216-
217217
setPermExt := func(keyID int64) {
218218
ctx.Permissions().Permissions.Extensions = map[string]string{
219219
giteaPermissionExtensionKeyID: fmt.Sprint(keyID),

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,6 @@ issues.timetracker_timer_stop = Stop timer
16801680
issues.timetracker_timer_discard = Discard timer
16811681
issues.timetracker_timer_manually_add = Add Time
16821682
1683-
issues.time_estimate_placeholder = 1h 2m
16841683
issues.time_estimate_set = Set estimated time
16851684
issues.time_estimate_display = Estimate: %s
16861685
issues.change_time_estimate_at = changed time estimate to <b>%s</b> %s

templates/repo/issue/sidebar/stopwatch_timetracker.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<form method="post" class="ui form form-fetch-action" action="{{.Issue.Link}}/time_estimate">
4545
<div class="content">
4646
{{$.CsrfTokenHtml}}
47-
<input name="time_estimate" placeholder="{{ctx.Locale.Tr "repo.issues.time_estimate_placeholder"}}" value="{{TimeEstimateString .Issue.TimeEstimate}}">
47+
<input name="time_estimate" placeholder="1h 2m" value="{{TimeEstimateString .Issue.TimeEstimate}}">
4848
<div class="actions">
4949
<button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button>
5050
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>

0 commit comments

Comments
 (0)