Home  >  Article  >  Backend Development  >  如果允许用户输入URL应当注意什么?

如果允许用户输入URL应当注意什么?

WBOY
WBOYOriginal
2016-06-06 20:32:541135browse

假如允许用户输入URL, 类似与在线书签的功能。
那么我应当怎么处理URL才能比较安全点?

貌似URL中可以执行JS~~~
假设不考率该URL指向的网页是否安全, 仅仅考虑URL, 那么我应当做哪些防御?

回复内容:

假如允许用户输入URL, 类似与在线书签的功能。
那么我应当怎么处理URL才能比较安全点?

貌似URL中可以执行JS~~~
假设不考率该URL指向的网页是否安全, 仅仅考虑URL, 那么我应当做哪些防御?

使用白名单限定协议类型,比如只允许http/https/ftp协议,其他协议均禁止。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn