|
This section delineates some best practices when dealing with SQL injection attempts or just plain old URL/FORM variable manipulations, when building ColdFusion web applications.
First of all, you also need to understand what a POST, GET, DELETE, PUT are used for. The method attribute of the FORM element specifies the HTTP method used to send the form to the processing agent. This attribute may take the following values:
The GET method should be used when the form is idempotent (i.e., causes no side-effects). Many database searches have no visible side effects and make ideal applications for the GET"' method. If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the POST,PUT, or DELETE method should be used.
The most important fact is that the GET method should be used for idempotent transactions. Here is the definition for idempotent:
"Idempotent operation means that it can be repeated without causing any errors or inconsistencies if the operation is carried out once or many times".
Thanks to Roger Benningfield:
"Allowing GET requests to change the state of server resources can be a very dangerous game, without so much as a whiff of malicious behavior. An app that allows clients to change or delete data just by fetching a URI is asking for trouble in 2006."
There is a time for using GET and a time for using POST,PUT,DELETE and ALL OF THEM should not trust the client data.
As for security, FORM variables are just as easy to modify as URL variables. However, there are several ways to protect from attacks, SQL injection or plain mischief:
Never ever ever trust the incoming data. It is YOUR responsibility to protect your code.
Categories: