环境

浏览器:Microsoft Edge Dev 92.0.884.2
操作系统:Win10 2004 19041.928

现象

访问不安全不是https的网站,会出现以下警告
在这里插入图片描述

解决方案

1.有的网站点开高级后,会出现继续访问的按钮,这种时候直接点击即可。
2.对于1无效的,可以直接在当前页因为状态下输入thisisunsafe,输入完后页面会自动刷新,即可访问
3.对于2无效的,按F12打开开发工具,切换到控制台console,然后输入

sendCommand(SecurityInterstitialCommandId.CMD_PROCEED)

页面刷新,即可进入
在这里插入图片描述

原因分析

查看源码 源码地址

/**
 * This allows errors to be skippped by typing a secret phrase into the page.
 * @param {string} e The key that was just pressed.
 */
function handleKeypress(e) {
  // HTTPS errors are serious and should not be ignored. For testing purposes,
  // other approaches are both safer and have fewer side-effects.
  // See https://goo.gl/ZcZixP for more details.
  const BYPASS_SEQUENCE = window.atob('dGhpc2lzdW5zYWZl');
  if (BYPASS_SEQUENCE.charCodeAt(keyPressState) === e.keyCode) {
    keyPressState++;
    if (keyPressState === BYPASS_SEQUENCE.length) {
      sendCommand(SecurityInterstitialCommandId.CMD_PROCEED);
      keyPressState = 0;
    }
  } else {
    keyPressState = 0;
  }
}

分析可得,当键盘连续输入BYPASS_SEQUENCE这个常量时,就会执行sendCommand(SecurityInterstitialCommandId.CMD_PROCEED),那么这个变量是什么呢?控制台看看就知道了在这里插入图片描述
其实就是上面的thisisunsafe,当然这个常量后续可能会变化,我们可以直接调用sendCommand(SecurityInterstitialCommandId.CMD_PROCEED)来到达目的。

如何恢复警告

进入后,在左上角的地址栏,点开不安全按钮,选择重新启用警告即可在这里插入图片描述

警告

当访问不安全的网站时,请确保网站是可信的。

参考文章

https://alphahinex.github.io/2020/11/01/this-is-unsafe/
https://stackoverflow.com/questions/44650854/how-to-disable-chrome-hsts-permanently-for-a-subdomain?noredirect=1&lq=1

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐