最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ecmascript 6 - How to solve Open Redirect vulnerability - Stack Overflow

programmeradmin4浏览0评论

In a webapp we are trying to solve an Open Redirect vulnerability.

The code is like this:

window.location.href = DOMPurify.sanitize(data.href);

Which apparently is vulnerable. One recommended solution is to hardcode the http-host:

window.location.href = `${DOMPurify.sanitize(data.href)}`;

Problem: the webapp is deployed on serveral hosts, with different hostnames. We tried a few options:

  • get hostname using new URL(window.location.href) --> vulnerable
  • get hostname using new URL(window.location.href), check if in allow-list --> vulnerable
  • set hostname hardcoded in html-template --> vulnerable

We are running Snyk to test, and it keeps giving errors. Any clues? et

发布评论

评论列表(0)

  1. 暂无评论