Skip to content

Commit 181d15c

Browse files
committed
fine tune comment
1 parent 159fdc9 commit 181d15c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/ssh/ssh.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ import (
4747
// sessionHandler(conn)
4848
//
4949
// Then sessionHandler should only use the "verified keyID" from the original ssh conn, but not the ctx one.
50-
// Otherwise, if a user provides 2 keys A and B, if A succeeds to authenticate, sessionHandler will see B's keyID
50+
// Otherwise, if a user provides 2 keys A (a correct one) and B (public key matches but no private key),
51+
// then only A succeeds to authenticate, sessionHandler will see B's keyID
5152

5253
const giteaPermissionExtensionKeyID = "gitea-perm-ext-key-id"
5354

@@ -97,7 +98,7 @@ func ptr[T any](intf any) *T {
9798
}
9899

99100
func sessionHandler(session ssh.Session) {
100-
// it can't use session.Permissions() because it only use the value from ctx, which might not be the authenticated one.
101+
// here can't use session.Permissions() because it only uses the value from ctx, which might not be the authenticated one.
101102
// so we must use the original ssh conn, which always contains the correct (verified) keyID.
102103
sshConn := ptr[sessionPartial](session)
103104
keyID := sshConn.conn.Permissions.Extensions[giteaPermissionExtensionKeyID]

0 commit comments

Comments
 (0)