TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: DNS rebinding protection for Express.js

30 点作者 braxxox超过 6 年前

3 条评论

partycoder超过 6 年前
In this line: <a href="https:&#x2F;&#x2F;github.com&#x2F;brannondorsey&#x2F;host-validation&#x2F;blob&#x2F;2ba4672b82e2d956dd8614c87e2d846505be18d6&#x2F;index.js#L91" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;brannondorsey&#x2F;host-validation&#x2F;blob&#x2F;2ba467...</a> use Array.some rather than iterating through all elements with Array.filter.<p>Then this: <a href="https:&#x2F;&#x2F;github.com&#x2F;brannondorsey&#x2F;host-validation&#x2F;blob&#x2F;2ba4672b82e2d956dd8614c87e2d846505be18d6&#x2F;index.js#L28" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;brannondorsey&#x2F;host-validation&#x2F;blob&#x2F;2ba467...</a> is not something I would recommend. Don&#x27;t try to fix bad input.
评论 #18108605 未加载
arkadiyt超过 6 年前
Neat, thanks for raising awareness of this issue. I don&#x27;t think it makes a lot of sense for the web server case (as you said, using TLS would fix it and that seems like the bigger concern), but if someone is building something like an electron app with a local server component then they ought to use this.<p>FWIW I think you can check just the Host header, it&#x27;s always going to be present and can&#x27;t be set by an attacker - referrer doesn&#x27;t add anything extra and attackers can force requests with blank referrers.<p>Also all your example regexes are correctly anchored but I can see a developer shooting themselves in the foot with that - I&#x27;d maybe add some warnings around it or even programmatically enforce anchored regexes.<p>Anyhow thanks for the Show HN!
nacs超过 6 年前
I understand validating the `Host` header but my understanding that the referer field is optional and theres quite a few users who either block referer headers for privacy&#x2F;anti-tracking purposes. Would this stop those users from accessing the site also?