Mirko L Posted February 6, 2020 Share Posted February 6, 2020 (edited) Hi there, i'm developing a module and i need to print a variable that contains html code in a tpl file. I know that i can use "nofilter" to do this (i.e. {$var nofilter}) When i try to validate the module (on validator.prestashop.com), in the security tab, there is this error: "Removing variable escaping is highly discouraged because malicious code can be displayed and executed". If i remove "nofilter", the variable is print as plain text. For example: in module class $var = "<p>test string</p>"; $this->context->smarty->assign(['var'=>$var]); in tpl file {$var nofilter} <!-- output: test string --> {$var|escape:'html':'UTF-8'} <!-- output: <p>test string</p> --> How can i solve the validation error? Can i submit the module on the marketplace also with this error? I'm using PrestaShop version 1.7.6.3 Thanks in advance Edited February 6, 2020 by Mirko L (see edit history) Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted February 6, 2020 Share Posted February 6, 2020 Hi. please leave this error and upload module in prestashop addons use this {$var nofilter} Thanks Link to comment Share on other sites More sharing options...
Mirko L Posted February 6, 2020 Author Share Posted February 6, 2020 ok thank you! Link to comment Share on other sites More sharing options...
fbenoist.com Posted February 6, 2020 Share Posted February 6, 2020 With your code there is a risk of an XSS attack. You must write: {$var|cleanHtml nofilter} 2 Link to comment Share on other sites More sharing options...
Mirko L Posted February 6, 2020 Author Share Posted February 6, 2020 8 minutes ago, fbenoist.com said: With your code there is a risk of an XSS attack. You must write: {$var|cleanHtml nofilter} thank you @fbenoist.com, it solve the error on validator! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now