Revision #4 has been created by qiang on Apr 6, 2011, 12:18:18 AM with the memo:
« previous (#3) next (#5) »
Changes
Title
unchanged
Understanding "Safe" Validation Rules
Category
unchanged
FAQs
Yii version
unchanged
Tags
unchanged
Forms, Validation, Safe, Massive Assignment
Content
unchanged
[...]
and perhaps others. It's rather scary to think what could happen if the bad guy were able to manipulate these with malicious input, but because they are not mentioned in any validation rule - `'safe'` or otherwise - they are protected.
Yii takes the conservative approach that attributes are assumed to be unsafe unless the developer explicitly makes them so (a "default deny" paradigm), rather than the easier but more dangerous "default allow".
It's wise to review the Rules in your model from time to time to insure that you're not allowing things you should not (especially when scenarios are in play), because it's not uncommon to wildly mark things as safe during a bout of validation problems without realizing that this actaully reduces the security of the application.