comanage-dev - [comanage-dev] Sanitizing output
Subject: COmanage Developers List
List archive
- From: Benn Oshrin <>
- To: comanage-dev <>
- Subject: [comanage-dev] Sanitizing output
- Date: Wed, 19 Oct 2011 08:29:07 -0400
One thing I'm not sure I mentioned...
Anytime you output user-generated content (whether direct from $this->data or from database retrieval), it must be sanitized using Sanitize::html() to protect against various injection attacks.
So, for example, this line in Marie's diff
+ $this->Session->setFlash(_txt('er.cou.child', array($curdata['Cou']['name'])), '', array(), 'error');
should become
+ $this->Session->setFlash(_txt('er.cou.child', array(Sanitize::html($curdata['Cou']['name']))), '', array(), 'error');
while this line
+ $this->Session->setFlash(_txt('er.cou.sameco', array($this->data['CoGroupMember']['co_group_id'])), '', array(), 'error');
doesn't need it because co_group_id is an internally managed key that end users can't manipulate.
This is one of those annoying things where you have to understand the context of the code and where data is coming from to know whether or not you need to sanitize. If in doubt, ask.
-Benn-
- [comanage-dev] Sanitizing output, Benn Oshrin, 10/19/2011
Archive powered by MHonArc 2.6.16.