Prevent HTTP verb tampering |
What is the proper way to prevent HTTP verb tampering in CodeIgniter 3 so that except POST and GET other HTTP methods are not allowed?
I have used Quote:if ($_SERVER['REQUEST_METHOD'] != ('POST' || 'GET')) { Or should I go for configuring the web server to allow only required HTTP methods ?
If you're served by Apache, Apache config would be your best option:
http://www.xpertdeveloper.com/2012/02/li...-htaccess/ OR http://lmgtfy.com/?q=.htaccess+limit+request+method I have to ask, why would it matter?
Thanks for your reply.
Shouldn't we prevent unauthorized HTTP methods from gaining access to our application ?
But the PUT method can be used to introduce malicious codes to the server.
Similarly the DELETE method can be used to remove important files of the application, thus causing denial of service, removal of configuration files etc. (07-06-2017, 10:45 PM)june123 Wrote: But the PUT method can be used to introduce malicious codes to the server. I don't know what kind of server you're using, but that's not standard functionality for Apache or Litespeed. If it was, it would be a major security issue. No good server operating system is going to allow that kind of behavior. Edit - I do see where people are enabling these request methods, because they're asking on stack overflow, and getting answers. Seems to me it's a pretty stupid thing to do ... But then I also think REST sucks too. Just don't enable them, and you've got nothing to worry about. (07-06-2017, 10:45 PM)june123 Wrote: But the PUT method can be used to introduce malicious codes to the server. No. PUT and DELETE are meant for you to implement when you want to create or delete resources. They don't magically do something without your permission. |
Welcome Guest, Not a member yet? Register Sign In |