Escape template data to prevent XSS security vulnerabilities in Magento
Escape Magento template data with $escaper escapeHtml to prevent XSS vulnerabilities in ecommerce storefronts.
Lesson Content
Whenever your code allows others to inject either code or styles into a block of content, it must be escaped to prevent cross-site scripting, or XSS security vulnerabilities. Not escaping this content can lead to malicious code being added to your storefront, which is especially worrisome with eCommerce sites.
Luckily, this is pretty easy, though it may seem a bit tedious to do. Just know that validating and sanitizing this data is one of your important responsibilities as an eCommerce developer.
Magento provides a special variable named $escaper. To add intellisense to your IDE, typeh...
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.