Skip to content

Commit ef953b3

Browse files
committed
fix: Reject input hostname with protocol
This is quick fix. Do not accept submitted tor address with protocol since it won't work. The initial clearnet validation can be done with `net.LookupIP`, but for tor network can't be done with that method. For now, just inform to remove the http:// or https:// part to the submitter.
1 parent 76a54a0 commit ef953b3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/monero/monero.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ func (r *moneroRepo) Add(protocol string, hostname string, port uint) error {
220220

221221
ipAddr = hostIp.String()
222222
ips = ip.SliceToString(hostIps)
223+
} else {
224+
if strings.HasPrefix(hostname, "http://") || strings.HasPrefix(hostname, "https://") {
225+
return errors.New("Don't start hostname with http:// or https://, just put your hostname")
226+
}
223227
}
224228

225229
row, err := r.db.Query(`

0 commit comments

Comments
 (0)