Skip to content

Commit aa3cdcf

Browse files
nevunNiels Möller
authored andcommitted
internal/witness: Enforce non-empty origin
1 parent bc819ad commit aa3cdcf

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
@@ -200,7 +200,10 @@ func (w *Witness) processAddCheckpointRequest(body []byte, bastion string) (cosi
200200
return nil, errBadRequest
201201
}
202202
}
203-
origin, _, _ := strings.Cut(string(noteBytes), "\n")
203+
origin, _, ok := strings.Cut(string(noteBytes), "\n")
204+
if !ok || origin == "" {
205+
return nil, errBadRequest
206+
}
204207
l = l.With("origin", origin)
205208
bastions, err := w.getBastions(origin)
206209
if err != nil {

0 commit comments

Comments
 (0)