允许用户发布httphttps以外的url方案?

问题描述 投票:1回答:1

我有一个博客评论区,用户可以在这里写下自己的网站和对它的评论,它是这样显示的。

<a href="https://example.com">Website</a>
<br>
<span>my website is about...</span>
<br><br>
<a href="https://example2.com">Website2</a>
<br>
<span>my website2 is about...</span>

我只允许httphttps的URL方案。

我的一些用户告诉我,他们想写一个网站或连接使用的URL方案,如 ftp:// - mailto: - file: - info::

<a href="ftp://example.com">Website</a>
<br>
<span>my website is about transfering to you</span>
<br><br>
<a href="file:example2.com/file.xml">Website2</a>
<br>
<span>my website2 is about sharing a file link to download</span>
<br><br>
<a href="mailto:[email protected]">Website2</a>
<br>
<span>my website3 is to send me email for medical conditions</span>

对浏览者来说,允许这样做是安全的,还是会意外地危害到他们的隐私或安全?

html security anchor url-scheme privacy
1个回答
1
投票

这是个坏主意。请记住,绝大多数提供这种功能的网站(如Wordpress评论)都会立即被恶意软件链接完全占领。如果HTTP还不够糟糕的话,允许其他方案扩大了攻击者可用的选项,无论是对你网站的访问者进行直接攻击,还是在使用你作为代理载体。如果他们真的有一个需要非HTTP方案的网站,他们应该链接到自己的网站,并从那里使用任何他们想要的链接,而不是把责任推给你。

© www.soinside.com 2019 - 2024. All rights reserved.