Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重大问题 vue-router 3.4.6版本更新,去掉param的二次decode会导致严重问题 #82

Closed
StevenLikeWatermelon opened this issue Oct 16, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@StevenLikeWatermelon
Copy link

StevenLikeWatermelon commented Oct 16, 2020

Bug 描述

vue-router 3.4.6为了解决query出现%导致报错问题,更新了版本,导致iframe模式下。url以params的形式传递时没有decode,进而导致iframe的src解析失败

问题重现

重现行为的步骤:

1.选择iframe模式
2.选择打开任意一个url

预期行为

tab页中显示一个iframe

实际效果

多个iframe死循环

@StevenLikeWatermelon StevenLikeWatermelon added the bug Something isn't working label Oct 16, 2020
@bhuh12
Copy link
Owner

bhuh12 commented Oct 16, 2020

死循环的 iframe 原始链接能提供一下吗?

@bhuh12
Copy link
Owner

bhuh12 commented Oct 16, 2020

看如下更改是否能解决问题?

fix(iframe): 解决 vue-router 3.4.6 params 中的链接未解码导致 iframe 页签加载失败

computed: {
    // 链接安全过滤,避免执行js
    url() {
      let { src } = this

      // XSS 攻击链接返回空白页
      if (/^javascript:/.test(src)) {
        return 'about:blank'
      }

      return decodeURIComponent(src)
    }
  }

image

@StevenLikeWatermelon
Copy link
Author

看如下更改是否能解决问题?

fix(iframe): 解决 vue-router 3.4.6 params 中的链接未解码导致 iframe 页签加载失败

computed: {
    // 链接安全过滤,避免执行js
    url() {
      let { src } = this

      // XSS 攻击链接返回空白页
      if (/^javascript:/.test(src)) {
        return 'about:blank'
      }

      return decodeURIComponent(src)
    }
  }

image

恩,这样应该是可以的,感谢!

@StevenLikeWatermelon
Copy link
Author

死循环的 iframe 原始链接能提供一下吗?

任意一个 完整的网址都可以复现

@bhuh12
Copy link
Owner

bhuh12 commented Oct 17, 2020

已经发布了 v1.2.1 版本,请更新看看是否解决问题

@StevenLikeWatermelon
Copy link
Author

已经发布了 v1.2.1 版本,请更新看看是否解决问题

1.2.1已经解决该问题。非常感谢!

@bhuh12 bhuh12 closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants