Show table fields, could it be a security problem?
Show table fields, could it be a security problem?
Question posted here http://datatables.net/forums/discussion/comment/29613#Comment_29613) by johnadamsy.
See below:
[code]
oTable = $('#grid-jquery-datatables').dataTable( {
"aoColumns":[
{ "mDataProp": "id" , .... },
{ "mDataProp": "name", ... },
{ "mDataProp": "age", ... }
],
....
[/code]
For security reason, can be dangerous to show table attributes as in JS code?
What do you think about?
See below:
[code]
oTable = $('#grid-jquery-datatables').dataTable( {
"aoColumns":[
{ "mDataProp": "id" , .... },
{ "mDataProp": "name", ... },
{ "mDataProp": "age", ... }
],
....
[/code]
For security reason, can be dangerous to show table attributes as in JS code?
What do you think about?
This discussion has been closed.
Replies
Allan
For example, think about SQL injection.
Allan
I'm not an expert of datatables "usages", why is there no requirement to use column names?
Is there an alternative ? (I think about this now)
Thank you
[code]
[
{ "col1": 1, "col2": 2 }
]
[/code]
why not just call the fields something else?
[code]
[
{ "myFirstColumn": 1, "mySecondColumn": 2 }
]
[/code]
DataTables doesn't care what you call your db columns, it is only concerned about the names of the fields in the JSON feed, and you can easily translate the db columns names to something else if you are really worried about someone knowing what the field names are (but then, the server should be able to cope with SQL injection attacks anyway, so it shouldn't really matter!).
Allan