允许用户 post url 除了 http/https 之外的方案?
Allow users to post url schemes other than http/https?
我有一个博客评论部分,用户可以在其中写下他们的网站并对其发表评论,它显示如下:
<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>
我只允许 http/https 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:name@example3.com">Website2</a>
<br>
<span>my website3 is to send me email for medical conditions</span>
观看者允许这样做是否安全,或者它是否会意外危及他们的隐私或安全?
这是个坏主意。请记住,绝大多数提供此类功能(例如 Wordpress 评论)的网站都会立即被恶意软件 link 完全淹没。如果 HTTP 还不够糟糕,允许其他方案可以扩展攻击者可用的选项,或者直接攻击您网站的访问者,或者将您用作代理向量。如果他们确实有一个需要非 HTTP 方案的网站,他们应该 link 到他们自己的网站并使用他们想要的任何 links,而不是将责任推给你。
我有一个博客评论部分,用户可以在其中写下他们的网站并对其发表评论,它显示如下:
<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>
我只允许 http/https 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:name@example3.com">Website2</a>
<br>
<span>my website3 is to send me email for medical conditions</span>
观看者允许这样做是否安全,或者它是否会意外危及他们的隐私或安全?
这是个坏主意。请记住,绝大多数提供此类功能(例如 Wordpress 评论)的网站都会立即被恶意软件 link 完全淹没。如果 HTTP 还不够糟糕,允许其他方案可以扩展攻击者可用的选项,或者直接攻击您网站的访问者,或者将您用作代理向量。如果他们确实有一个需要非 HTTP 方案的网站,他们应该 link 到他们自己的网站并使用他们想要的任何 links,而不是将责任推给你。