detached ca64e93

fix(app): reject malformed daemon error replies

commit
ca64e93055b87d8219f727cd41109065d2ee128b
author
brice · · 2026-08-28 08:45 UTC
committer
brice · · 2026-08-28 14:56 UTC
parent
6632680
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +6 -3
M internal/app/run.go +4 -1
@@ -1612,7 +1612,10 @@ func runKill(ctx context.Context, name string, all, daemon bool) (retErr error)
16121612 return fmt.Errorf("vev: reading kill reply: %w", err)
16131613 }
16141614 if reply.Type == wire.MsgError {
1615- em, _ := wire.UnmarshalErrorMsg(reply.Payload)
1615+ em, err := wire.UnmarshalErrorMsg(reply.Payload)
1616+ if err != nil {
1617+ return fmt.Errorf("vev: decoding error reply: %w", err)
1618+ }
16161619 return fmt.Errorf("vev: %s", em.Text)
16171620 }
16181621 printKillSuccess(name, all, daemon)
@@ -1612,7 +1612,10 @@ func runKill(ctx context.Context, name string, all, daemon bool) (retErr error)
1612 return fmt.Errorf("vev: reading kill reply: %w", err)1612 return fmt.Errorf("vev: reading kill reply: %w", err)
1613 }1613 }
1614 if reply.Type == wire.MsgError {1614 if reply.Type == wire.MsgError {
1615- em, _ := wire.UnmarshalErrorMsg(reply.Payload)1615+ em, err := wire.UnmarshalErrorMsg(reply.Payload)
1616+ if err != nil {
1617+ return fmt.Errorf("vev: decoding error reply: %w", err)
1618+ }
1616 return fmt.Errorf("vev: %s", em.Text)1619 return fmt.Errorf("vev: %s", em.Text)
1617 }1620 }
1618 printKillSuccess(name, all, daemon)1621 printKillSuccess(name, all, daemon)
M internal/usecase/daemon/durable_recovery_test.go +2 -2
@@ -886,7 +886,7 @@ func TestRestoreCancellationTransitionsBeforeAttachCompletion(t *testing.T) {
886886
887887 attached := make(chan error, 1)
888888 go func() {
889- _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name}, nil)
889+ _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name, Size: domain.Size{Cols: 80, Rows: 24}}, nil)
890890 attached <- err
891891 }()
892892 cancelRestore()
@@ -963,7 +963,7 @@ func TestAttachRejectsDegraded(t *testing.T) {
963963 d.serveCtx, d.serveCancel = context.WithCancel(context.Background())
964964 defer d.serveCancel()
965965
966- _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name}, nil)
966+ _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name, Size: domain.Size{Cols: 80, Rows: 24}}, nil)
967967 var protocolError *protoErr
968968 require.ErrorAs(t, err, &protocolError)
969969 require.Equal(t, protocol.ErrInternal, protocolError.code)
@@ -886,7 +886,7 @@ func TestRestoreCancellationTransitionsBeforeAttachCompletion(t *testing.T) {
886 886
887 attached := make(chan error, 1)887 attached := make(chan error, 1)
888 go func() {888 go func() {
889- _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name}, nil)889+ _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name, Size: domain.Size{Cols: 80, Rows: 24}}, nil)
890 attached <- err890 attached <- err
891 }()891 }()
892 cancelRestore()892 cancelRestore()
@@ -963,7 +963,7 @@ func TestAttachRejectsDegraded(t *testing.T) {
963 d.serveCtx, d.serveCancel = context.WithCancel(context.Background())963 d.serveCtx, d.serveCancel = context.WithCancel(context.Background())
964 defer d.serveCancel()964 defer d.serveCancel()
965 965
966- _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name}, nil)966+ _, _, err := d.route(protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Name: record.Name, Size: domain.Size{Cols: 80, Rows: 24}}, nil)
967 var protocolError *protoErr967 var protocolError *protoErr
968 require.ErrorAs(t, err, &protocolError)968 require.ErrorAs(t, err, &protocolError)
969 require.Equal(t, protocol.ErrInternal, protocolError.code)969 require.Equal(t, protocol.ErrInternal, protocolError.code)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close