I am using ColdFusion 9 and jQuery.
I am new pretty new to using ColdFusion CFCs via CFAJAXPROXY. I am curious as to whether my database is at risk and how I might easily patch security holes.
I put this at the top of the page:
<cfajaxproxy cfc="brands" jsclassname="jsApp">
Here's a CFC that is used after some logs in:
<!--- ADD BRAND --->
<cffunction name="addBrand" access="remote">
<cfargument name="SiteID" required="true">
<cfargument name="Brand" required="true">
<cfscript>
LOCAL.SiteID = ARGUMENTS.SiteID;
LOCAL.Brand = trim(left(ARGUMENTS.Brand, 50));
</cfscript>
<cfquery name="GetBrands">
INSERT INTO Brands(SiteID, Brand)
VALUES (<cfqueryparam cfsqltype="cf_sql_integer" value="#LOCAL.SiteID#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#LOCAL.Brand#">)
</cfquery>
<cfreturn true>
</cffunction>
Here's the jQuery that would post the data to the CFC
$("#AddBrand").click(function() {
NewBrand = $("#NewBrand").attr("value");
var jro = new jsApp();
jro.addBrand(NewBrand);
});
So, is there a big security hole here? Should access="remote" be used only for retrieving data?