getHistory can fetch transfer_history it doesn't own
pkg/admin/rest/history.go
Is missing a WHERE condition for owner=conf.GlobalConf.GatewayName
on the db.Get
//nolint:dupl // duplicated code is about a different type
func getHist(r *http.Request, db *database.DB) (*model.HistoryEntry, error) {
val := mux.Vars(r)["history"]
id, err := strconv.ParseUint(val, 10, 64) //nolint:gomnd // no need for a constant here
if err != nil || id == 0 {
return nil, notFound("'%s' is not a valid transfer ID", val)
}
var history model.HistoryEntry
if err := db.Get(&history, "id=?", id).Run(); err != nil {
if database.IsNotFound(err) {
return nil, notFound("transfer %v not found", id)
}
return nil, err
}
return &history, nil
}