Skip to content

Commit 20f69ef

Browse files
niels-mollernevun
andauthored
internal/witness: enforce non-empty origin (#57)
Co-authored-by: Gabriel Kihlman <gk@sysctl.se>
1 parent d6aedf0 commit 20f69ef

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

internal/witness/witness.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ func (w *Witness) processAddCheckpointRequest(body []byte, bastion string) (cosi
207207
return nil, errBadRequest
208208
}
209209
}
210-
origin, _, _ := strings.Cut(string(noteBytes), "\n")
210+
origin, _, ok := strings.Cut(string(noteBytes), "\n")
211+
if !ok || origin == "" {
212+
return nil, errBadRequest
213+
}
211214
l = l.With("origin", origin)
212215
bastions, err := w.getBastions(origin)
213216
if err != nil {

0 commit comments

Comments
 (0)