freeCodeCamp/curriculum/challenges/chinese/06-information-security-and.../information-security-with-h.../disable-dns-prefetching-wit...

1.6 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d8248367417b2b2512c3d Disable DNS Prefetching with helmet.dnsPrefetchControl() 2 使用helmet.dnsPrefetchControl禁用DNS预取

Description

提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。为了提高性能大多数浏览器都会为页面中的链接预取DNS记录。以这种方式当用户点击链接时目标IP已知。这可能导致过度使用DNS服务如果您拥有一个大网站数百万人访问......隐私问题一个窃听者可能会推断您在某个页面上或者页面统计信息更改某些链接可能会即使他们不是也会出现。如果您有高安全性需求则可以以性能损失为代价禁用DNS预取。

Instructions

Tests

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

Challenge Seed

Solution

// solution required