freeCodeCamp/curriculum/challenges/chinese/06-information-security-and.../information-security-with-h.../prevent-ie-from-opening-unt...

1.4 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d8248367417b2b2512c3b Prevent IE from Opening Untrusted HTML with helmet.ieNoOpen() 2 使用helmet.ieNoOpen阻止IE打开不受信任的HTML

Description

提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。某些Web应用程序将提供不受信任的HTML以供下载。默认情况下某些版本的Internet Explorer会在您的站点上下文中打开这些HTML文件。这意味着不受信任的HTML页面可能会在您的页面上下文中开始做坏事。此中间件将X-Download-Options标头设置为noopen。这将阻止IE用户在受信任站点的上下文中执行下载。

Instructions

Tests

tests:
  - text: helmet.ieNoOpen中间件应正确安装
    testString: 'getUserInput => $.get(getUserInput("url") + "/_api/app-info").then(data => { assert.include(data.appStack, "ienoopen"); assert.equal(data.headers["x-download-options"], "noopen"); }, xhr => { throw new Error(xhr.responseText); })'

Challenge Seed

Solution

// solution required