When comparing an HTTP GET to an HTTP POST, what are the differences from a security perspective? Is one of the choices inherently more secure than the other? If so, why?
GET is visible to anyone (even the one on your shoulder now) and is saved on cache, so is less secure of using post, btw post without some cryptographics routine is not sure, for a bit of security you've to use SSL (https)
Disclaimer: Following points are only applicable for API calls and not the website URLs.
Security over the network: You must use HTTPS. GET and POST are equally safe in this case.
Browser History: For front-end applications like, Angular JS, React JS etc API calls are AJAX calls made by front-end. These does not become part of browser history. Hence, POST and GET are equally secure.
Server side logs: With using write set of data-masking and access logs format it is possible to hide all or only sensitive data from request-URL.
Data visibility in browser console: For someone with mallicious intent, it's almost the same efforts to view POST data as much as GET.
Hence, with right logging practices, GET API is as secure as POST API. Following POST everywhere, forces poor API definitions and should be avoided.
Even POST accepts GET requests. Assume you have a form having inputs like user.name and user.passwd, those are supposed to support user name and password. If we simply add a ?user.name="my user&user.passwd="my password", then request will be accepted by "bypassing the logon page".
A solution for this is to implement filters (java filters as an e) on server side and detect no string queries are passed as GET arguments.
Post is the most secured along with SSL installed because its transmitted in the message body.
But all of these methods are insecure because the 7 bit protocol it uses underneath it is hack-able with escapement. Even through a level 4 web application firewall.
Sockets are no guarantee either... Even though its more secure in certain ways.
Neither one magically confers security on a request, however GET implies some side effects that generally prevent it from being secure.
GET URLs show up in browser history and webserver logs. For this reason, they should never be used for things like login forms and credit card numbers.
However, just POSTing that data doesn't make it secure, either. For that you want SSL. Both GET and POST send data in plaintext over the wire when used over HTTP.
There are other good reasons to POST data, too - like the ability to submit unlimited amounts of data, or hide parameters from casual users.
The downside is that users can't bookmark the results of a query sent via POST. For that, you need GET.
The difference is that GET sends data open and POST hidden (in the http-header).
So get is better for non-secure data, like query strings in Google. Auth-data shall never be send via GET - so use POST here. Of course the whole theme is a little more complicated. If you want to read more, read this article (in German).