Skip to content

Commit 8019ea2

Browse files
build(deps): bump charm.land/ssh in the go-modules group
Bumps the go-modules group with 1 update: [charm.land/ssh](https://github.com/charmbracelet/ssh). Updates `charm.land/ssh` from 0.4.2 to 0.4.3 - [Release notes](https://github.com/charmbracelet/ssh/releases) - [Commits](charmbracelet/ssh@v0.4.2...v0.4.3) --- updated-dependencies: - dependency-name: charm.land/ssh dependency-version: 0.4.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-modules ... Signed-off-by: dependabot[bot] <support@github.com>
1 parent 4236930 commit 8019ea2

6 files changed

Lines changed: 43 additions & 36 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
)
3434

3535
require (
36-
charm.land/ssh v0.4.2
36+
charm.land/ssh v0.4.3
3737
github.com/cilium/ebpf v0.22.0
3838
github.com/gokrazy/tools v0.0.0-20260703063348-3fe400c13246
3939
github.com/gokrazy/updater v0.0.0-20260620140544-0a84d8ab3878

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ charm.land/lipgloss/v2 v2.0.5 h1:kbNxgeeUOYv5J0YdpxFjfvf3dFvqH8Aci4zB6xqFtrY=
66
charm.land/lipgloss/v2 v2.0.5/go.mod h1:9oqhxt4yxIMe6q5A4kHr44DremZk7J9UNh74GlWa5nc=
77
charm.land/log/v2 v2.0.0 h1:SY3Cey7ipx86/MBXQHwsguOT6X1exT94mmJRdzTNs+s=
88
charm.land/log/v2 v2.0.0/go.mod h1:c3cZSRqm20qUVVAR1WmS/7ab8bgha3C6G7DjPcaVZz0=
9-
charm.land/ssh v0.4.2 h1:mpJW8KuCQSu5mn4L9cRtDQpVtUNa/JwbqbOHyB/H1lI=
10-
charm.land/ssh v0.4.2/go.mod h1:so/3IECPNlYZSnE7JKn7NFmcUyyxJqIAeM4TJy35qPk=
9+
charm.land/ssh v0.4.3 h1:hr5cYmlUYsP+KxyG/ug7ZMzKKN9f6VOD9yPpcGqdzzM=
10+
charm.land/ssh v0.4.3/go.mod h1:so/3IECPNlYZSnE7JKn7NFmcUyyxJqIAeM4TJy35qPk=
1111
charm.land/wish/v2 v2.0.3 h1:Xkgw31lEH9AJkPfgXYYvsgrskfDIY9ffHTxFRV4UT+4=
1212
charm.land/wish/v2 v2.0.3/go.mod h1:i8gFfXu+IyMcGpRh6D84Wa+mDGwjYCKWcA86R+IJf0c=
1313
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=

vendor/charm.land/ssh/.golangci.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,12 @@ linters:
3030
- text: '(slog|log)\.\w+'
3131
linters:
3232
- noctx
33-
- text: "var-naming"
34-
linters:
35-
- revive
36-
# This package is a thin wrapper around x/crypto/ssh and the stdlib.
37-
# Errors are passed through as-is by design; wrapping them adds no
38-
# value to the caller.
39-
- text: "error returned from (external package|interface method)"
40-
linters:
41-
- wrapcheck
42-
# Port numbers, terminal dimensions, and exit codes are all bounded
43-
# by the SSH protocol and cannot overflow in practice.
44-
- text: "G115: integer overflow conversion"
45-
linters:
46-
- gosec
47-
# net.Listen in this package is for server-side sockets, not HTTP
48-
# client requests.
49-
- text: "net.Listen must not be called"
50-
linters:
51-
- noctx
52-
# The accept loop backoff pattern matches net/http and is not
53-
# improved by further extraction.
54-
- text: "`if e != nil` has complex nested blocks"
55-
linters:
56-
- nestif
5733
generated: lax
5834
presets:
5935
- common-false-positives
36+
settings:
37+
exhaustive:
38+
default-signifies-exhaustive: true
6039
issues:
6140
max-issues-per-linter: 0
6241
max-same-issues: 0

vendor/charm.land/ssh/conn.go

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,39 @@ package ssh
33
import (
44
"context"
55
"net"
6+
"sync"
67
"time"
78
)
89

910
type serverConn struct {
1011
net.Conn
1112

12-
idleTimeout time.Duration
13+
idleTimeout time.Duration
14+
maxDeadline time.Time
15+
closeCanceler context.CancelFunc
16+
17+
// handshakeDeadline is cleared once the handshake completes, which happens
18+
// after gossh.NewServerConn has started goroutines that read it via
19+
// updateDeadline. Access it only through the accessors below.
20+
mu sync.Mutex
1321
handshakeDeadline time.Time
14-
maxDeadline time.Time
15-
closeCanceler context.CancelFunc
22+
}
23+
24+
// setHandshakeDeadline bounds how long the handshake may take.
25+
func (c *serverConn) setHandshakeDeadline(t time.Time) {
26+
c.mu.Lock()
27+
c.handshakeDeadline = t
28+
c.mu.Unlock()
29+
c.updateDeadline()
30+
}
31+
32+
// clearHandshakeDeadline drops the handshake deadline once the handshake has
33+
// completed, leaving the idle and max deadlines to govern the connection.
34+
func (c *serverConn) clearHandshakeDeadline() {
35+
c.mu.Lock()
36+
c.handshakeDeadline = time.Time{}
37+
c.mu.Unlock()
38+
c.updateDeadline()
1639
}
1740

1841
func (c *serverConn) Write(p []byte) (n int, err error) {
@@ -46,10 +69,16 @@ func (c *serverConn) Close() (err error) {
4669
}
4770

4871
func (c *serverConn) updateDeadline() {
72+
c.mu.Lock()
73+
handshakeDeadline := c.handshakeDeadline
74+
c.mu.Unlock()
75+
76+
// idleTimeout and maxDeadline are set before the handshake starts and never
77+
// mutated afterwards, so they need no locking.
4978
deadline := c.maxDeadline
5079

51-
if !c.handshakeDeadline.IsZero() && (deadline.IsZero() || c.handshakeDeadline.Before(deadline)) {
52-
deadline = c.handshakeDeadline
80+
if !handshakeDeadline.IsZero() && (deadline.IsZero() || handshakeDeadline.Before(deadline)) {
81+
deadline = handshakeDeadline
5382
}
5483

5584
if c.idleTimeout > 0 {

vendor/charm.land/ssh/server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func (srv *Server) handleConn(newConn net.Conn) {
415415
conn.maxDeadline = time.Now().Add(srv.MaxTimeout)
416416
}
417417
if srv.HandshakeTimeout > 0 {
418-
conn.handshakeDeadline = time.Now().Add(srv.HandshakeTimeout)
418+
conn.setHandshakeDeadline(time.Now().Add(srv.HandshakeTimeout))
419419
}
420420
conn.updateDeadline()
421421
defer func() { _ = conn.Close() }()
@@ -431,8 +431,7 @@ func (srv *Server) handleConn(newConn net.Conn) {
431431
}
432432
return
433433
}
434-
conn.handshakeDeadline = time.Time{}
435-
conn.updateDeadline()
434+
conn.clearHandshakeDeadline()
436435

437436
if err := extractPublicKeyFromPermissions(ctx, sshConn); err != nil {
438437
if srv.ConnectionFailedCallback != nil {

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ charm.land/lipgloss/v2
1414
# charm.land/log/v2 v2.0.0
1515
## explicit; go 1.25.8
1616
charm.land/log/v2
17-
# charm.land/ssh v0.4.2
17+
# charm.land/ssh v0.4.3
1818
## explicit; go 1.25.0
1919
charm.land/ssh
2020
# charm.land/wish/v2 v2.0.3

0 commit comments

Comments
 (0)