Hi. Thanks for the suggestion. In the module's code, 'eval' is not used to validate input as array. Rather, the input itself is made into an array with 'eval'.
Currently, I cannot think of an alternative to this. Let me know if you can.
Yes, it is possible that the form-field value ($settings['htmLawed']['config']) can be misused to pass evil PHP commands, but there is no reason why the site admin (who sets the htmLawed filter and gets to use the form-field) will do so.
Why close the issue? We both agree that it isn't a good solution. From the top of my head you could use another format for the configuration. Maybe json, I am sure there are external modules that enable you to edit json. Also there is yaml. Plenty of options to get rid of eval where it's not essential.
Sorry, I don't think use of 'eval' is an issue. Note that 'eval' gets called only during htmLawed module configuration, which is done by site administrator, who already has enough privileges to do bad things if they want to.
I am closing this issue. I hope you respect my decision as module developer. If you come up with alternate code, please post in a new issue. I will be happy and thankful to consider using it.
Comments
Comment #2
alpha2zee commentedHi. Thanks for the suggestion. In the module's code, 'eval' is not used to validate input as array. Rather, the input itself is made into an array with 'eval'.
eval('$config = array(' . $settings['htmLawed']['config'] . ');');Currently, I cannot think of an alternative to this. Let me know if you can.
Yes, it is possible that the form-field value ($settings['htmLawed']['config']) can be misused to pass evil PHP commands, but there is no reason why the site admin (who sets the htmLawed filter and gets to use the form-field) will do so.
Comment #3
alpha2zee commentedComment #4
ram4nd commentedWhy close the issue? We both agree that it isn't a good solution. From the top of my head you could use another format for the configuration. Maybe json, I am sure there are external modules that enable you to edit json. Also there is yaml. Plenty of options to get rid of eval where it's not essential.
Comment #5
alpha2zee commentedSorry, I don't think use of 'eval' is an issue. Note that 'eval' gets called only during htmLawed module configuration, which is done by site administrator, who already has enough privileges to do bad things if they want to.
I am closing this issue. I hope you respect my decision as module developer. If you come up with alternate code, please post in a new issue. I will be happy and thankful to consider using it.