I am trying to get the IP address and send it to my rails server as a parameter of a POST request. Is this action safe?
-
4more context...what is the IP address for? I dont see why it would be unsafe, if you are unsure just send it via https?– TheHiddenNov 3, 2016 at 22:37
-
it depends on what you then want to do with that address (and also what address it is), so yeah, much more details are needed– Gabor LengyelNov 3, 2016 at 22:40
-
Im sending the IP Address of a mobile device to the rails server. Not sure if it is a secure practice?– cengoNov 3, 2016 at 22:41
-
2can you elaborate what you want to achieve by this?– Out of BandNov 3, 2016 at 23:36
-
Safe against what?– MarcelNov 4, 2016 at 7:06
2 Answers
There's no utility on sending IP address of local device, on which you app is running. There're good chances that you'll get only local ip-address from the device, which is hardly useful. Moreover, in the days of dynamic public IP address assignment from ISPs, IP addresses are hardly used for monitoring or tracking purpose(As there're good chances that public IP address assigned to you by your ISP, may be assigned to some other computer, at another time).
To ensure that the data is 'safely' POSTed to your server such that it remains confidential and is not tampered with by an attacker in transit, use transport layer security (TLS).
To ensure that your application 'safely' processes the POSTed data, validate that data prior to use to ensure it is what you expect to receive i.e an IP Address.