Network security-is php safe enough to filter user input only through filters?

Source: Internet
Author: User
The application scenario is that you can enter any text, but cannot enter code similar to html. in php, you can use FILTER_SANITIZE_STRING to filter the filtered content. Is it safe enough, for other scenarios such as xss filtering, users can enter arbitrary text, but cannot enter code similar to html.

In php, FILTER_SANITIZE_STRING can be used to filter user input.

Is the filtered content safe enough? Is it used for other purposes, such as xss filtering?

Reply content:

The application scenario is that you can enter any text, but cannot enter code similar to html.

In php, FILTER_SANITIZE_STRING can be used to filter user input.

Is the filtered content safe enough? Is it used for other purposes, such as xss filtering?

As mentioned in the titleSafe enough... The key is to see how you understand this...

The full name of XSS... XSS isCross-site Scripting... The key point is Scripting...

If you useFILTER_SANITIZE_STRING...YesThere is no risk of being XSS...

But it cannot be said that it is completely safe anywhere... other risks still exist...

For example, such content cannot be directly written into the SQL statement before being processed...

It also depends on how you display the user input...

If the content entered by the user may appear legallyScriptThe tag must also be processed...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.