03-14-2010, 01:23 PM
If you take a look around, for example, the MyCodes forum at MyBB community, you'll probably notice a number of MyCodes posted there using the "(.*?)" expression. (note, previous statement is true at time of writing)
This particular expression allows almost any input to be placed by the user, which can be dangerous in certain circumstances by potentially allowing various injections. This is perhaps due to the fact that many such "MyCode developers" really don't know how to properly use regular expressions.
This plugin aims to make it easier for administrators to write properly sanitised MyCodes which aren't vulnerable to such injections. Instead of writing custom MyCodes in regular expression form, you just enter what you want and place appropriate tokens in the expression.
Furthermore, you can actually still use regular expressions in custom MyCodes, so no functionality is actually lost using this plugin (regular expressions need to be escaped however; more information is supplied in the AdminCP when adding/editing MyCodes).
To demonstrate an example of an injection, this is what an innocent looking MyCode for allowing custom background colours, might look like:
Expression: \[bg=(.*?)\](.*?)\[/bg\]
Replacement: <span style="background-color: $1;">$2</span>
Perhaps it looks okay, until a user enters something like this in their post:
This particular expression allows almost any input to be placed by the user, which can be dangerous in certain circumstances by potentially allowing various injections. This is perhaps due to the fact that many such "MyCode developers" really don't know how to properly use regular expressions.
This plugin aims to make it easier for administrators to write properly sanitised MyCodes which aren't vulnerable to such injections. Instead of writing custom MyCodes in regular expression form, you just enter what you want and place appropriate tokens in the expression.
Furthermore, you can actually still use regular expressions in custom MyCodes, so no functionality is actually lost using this plugin (regular expressions need to be escaped however; more information is supplied in the AdminCP when adding/editing MyCodes).
To demonstrate an example of an injection, this is what an innocent looking MyCode for allowing custom background colours, might look like:
Expression: \[bg=(.*?)\](.*?)\[/bg\]
Replacement: <span style="background-color: $1;">$2</span>
Perhaps it looks okay, until a user enters something like this in their post:
Code:
|
Using Easy MyCodes, the admin would use the following instead:
Expression: [bg={COLOR}]{ANYTHING}[/bg]
Replacement: <span style="background-color: $1;">$2</span>
And prevent the injection at the same time.