Problem phenomenon: The front-end receives a data (including html) tag from the background, automatically translates it into an html page element, and automatically executes the script, causing the front-end page to be blocked
The background data accepted is a large number of repeated codes as follows
<script>alert("1");</script><button>i am but</button>
I learned about the xss attack at this time.
But what is an xss attack?
Du Niang’s explanation is a cross-site scripting attack. My current understanding is that intercepting background requests and returning a page can The executed malicious script paralyzes the interface of the web application, and may cause greater harm. I will add it after learning more about it later (6.14).
So how to solve the problem that the page always executes the alert in the script?
I found out later that jquery encoder provides a series of APIs to specifically solve similar problems. Then the next step is simple. Solving the problem becomes learning the API. This is what I Favorite part of solving a problem.
The above is the detailed content of Share how to use jquery encoder to solve XSS script injection problems. For more information, please follow other related articles on the PHP Chinese website!