Skip to content

Commit 7a260f7

Browse files
authored
Merge branch 'master' into patch-2
2 parents 5a48739 + 2995696 commit 7a260f7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/guide/security-best-practices.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ Further reading on the topic:
263263
- <https://owasp.org/www-community/SameSite>
264264

265265

266+
Avoiding arbitrary object instantiations
267+
----------------------------------------
268+
269+
Yii [configurations](concept-configurations.md) are associative arrays used by the framework to instantiate new objects through `Yii::createObject($config)`. These arrays specify the class name for instantiation, and it is important to ensure that this class name does not originate from untrusted sources. Otherwise, it can lead to Unsafe Reflection, a vulnerability that allows the execution of malicious code by exploiting the loading of specific classes. Additionally, when you need to dynamically add keys to an object derived from a framework class, such as the base `Component` class, it's essential to validate these dynamic properties using a whitelist approach. This precaution is necessary because the framework might employ `Yii::createObject($config)` within the `__set()` magic method.
270+
271+
266272
Avoiding file exposure
267273
----------------------
268274

0 commit comments

Comments
 (0)