SQL injection possible?

Author Message

Claudia Kosny

Friday 03 November 2006 1:18:12 am

Hi there

My users can update some data on some objects using a webform. Due to technical reasons I cannot use the regular content/edit functionality so I have written an extension that takes the posted data, checks which attributes are posted for which object and then uses something like this:
$contentObjectAttribute->setAttribute('data_int', $postedAttributeContent);
for each of attribute.

This is working fine but I am wondering how much I should worry about quotation marks or sql injection in the posted data.

So are there any cleanup functions in the ez sql interface that I can use or does ez automatically check for and remove and possible problems?

Thanks for any tips or hints

Claudia

Sascha Frinken

Friday 03 November 2006 3:25:34 am

Hi Claudia,

afaik your attributes will be stored with eZPersistentObject::storeObject.
As you can see in http://pubsvn.ez.no/doxygen/ezpersistentobject_8php-source.html (line 00501 i.e) it makes use of $db->escapeString( $value ) which prevents SQL injection.

HTH

Sascha

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:18:12
Script start
Timing: Jan 18 2025 16:18:12
Module start 'layout'
Timing: Jan 18 2025 16:18:12
Module start 'content'
Timing: Jan 18 2025 16:18:13
Module end 'content'
Timing: Jan 18 2025 16:18:13
Script end

Main resources:

Total runtime1.0365 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.0234152.6250
Module start 'layout' 0.00600.0032 741.648439.4297
Module start 'content' 0.00921.0257 781.0781459.2422
Module end 'content' 1.03490.0016 1,240.32038.1875
Script end 1.0365  1,248.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3215160.0002
Check MTime0.00140.1337160.0001
Mysql Total
Database connection0.00080.081910.0008
Mysqli_queries0.993195.8148540.0184
Looping result0.00050.0515520.0000
Template Total1.003596.820.5018
Template load0.00230.223720.0012
Template processing1.001296.591120.5006
Template load and register function0.00020.021310.0002
states
state_id_array0.00070.065810.0007
state_identifier_array0.00210.200120.0010
Override
Cache load0.00190.1847170.0001
Sytem overhead
Fetch class attribute can translate value0.00100.092420.0005
Fetch class attribute name0.00140.136420.0007
XML
Image XML parsing0.00030.030120.0002
class_abstraction
Instantiating content class attribute0.00000.001020.0000
General
dbfile0.00100.0917100.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs