diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.chinese.md index c311fb85dd..1e03ff29b5 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.chinese.md @@ -2,15 +2,20 @@ id: 587d8248367417b2b2512c3c title: Ask Browsers to Access Your Site via HTTPS Only with helmet.hsts() challengeType: 2 -videoUrl: '' +forumTopicId: 301573 localeTitle: 要求浏览器通过HTTPS访问您的站点仅限于使用helmet.hsts() --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。 HTTP严格传输安全(HSTS)是一种Web安全策略,可帮助保护网站免受协议降级攻击和cookie劫持。如果您的网站可以通过HTTPS访问,您可以要求用户的浏览器避免使用不安全的HTTP。通过设置标头Strict-Transport-Security,您可以告诉浏览器在指定的时间内对将来的请求使用HTTPS。这将适用于初始请求之后的请求。配置helmet.hsts()以在接下来的90天内使用HTTPS。传递配置对象{maxAge:timeInSeconds,force:true}。 Glitch已经启用了hsts。要覆盖其设置,您需要在配置对象中将字段“force”设置为true。在检查Glitch标头进行测试后,我们将拦截并恢复Glitch标头。注意:在自定义网站上配置HTTPS需要获取域和SSL / TSL证书。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +HTTP 严格安全传输(HSTS)是一个能帮助我们抵御协议 降级攻击Cookie 挟持 的 WEB 安全协议。如果你的网站能够通过 HTTPS 访问,那么你就可以让你的用户避免使用不安全的 HTTP 协议访问。为此,你只需要在 header 中设置 Strict-Transport-Security 字段,以此来告诉浏览器在今后的一段时间内使用 HTTPS 来请求网站内容。这一设置对首次请求之后所以的后续请求都适用。 +
## Instructions -
+
+通过 helmet.hsts(),网站会在未来的90天内使用 HTTPS。我们还可以传入配置对象 {maxAge: timeInSeconds, force: true}。Repl.it 默认已经开启 hsts,但你仍然可以通过添加 {force: true} 来覆盖它。我们会拦截 Glitch 请求的 header 来进行此挑战的测试,然后恢复此项配置。 +注意: 配置 HTTPS 需要域名以及 SSL/TSL 证书。
## Tests @@ -18,9 +23,9 @@ localeTitle: 要求浏览器通过HTTPS访问您的站点仅限于使用helmet.h ```yml tests: - - text: helmet.hsts()中间件应正确安装 + - text: 应正确加载 helmet.hsts() 中间件 testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.include(data.appStack, 'hsts'); assert.property(data.headers, 'strict-transport-security'); }, xhr => { throw new Error(xhr.responseText); }) - - text: maxAge应该等于7776000毫秒(90天) + - text: 应将 maxAge 设置为 7776000 ms(90 天) testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.match(data.headers['strict-transport-security'], /^max-age=7776000;?/); }, xhr => { throw new Error(xhr.responseText); }) ``` @@ -36,7 +41,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.chinese.md index e58f168240..e207cc91a4 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.chinese.md @@ -2,15 +2,19 @@ id: 587d8248367417b2b2512c3a title: Avoid Inferring the Response MIME Type with helmet.noSniff() challengeType: 2 -videoUrl: '' -localeTitle: 避免使用helmet.noSniff()推断响应MIME类型 +forumTopicId: 301574 +localeTitle: 使用 helment.noSniff() 来避免推断响应的 MIME 类型 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。浏览器可以使用内容或MIME嗅探来适应来自响应的不同数据类型。它们覆盖Content-Type标头以猜测和处理数据。虽然这在某些情况下可能很方便,但它也可能导致一些危险的攻击。此中间件将X-Content-Type-Options标头设置为nosniff。这指示浏览器不绕过提供的Content-Type。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +浏览器可以通过 content 或者 MIME 嗅探来判断不同的响应内容。这两个的优先级比 header 中的 Content-Type 高。这在一些情况下非常方便,但也会造成一定的安全风险。我们可以通过中间件来把 header 中的 X-Content-Type-Options 字段设置为 nosniff,这样浏览器就不会绕过 header 中的 Content-Type 了。 +
## Instructions -
+
+
## Tests @@ -18,7 +22,7 @@ localeTitle: 避免使用helmet.noSniff()推断响应MIME类型 ```yml tests: - - text: helmet.noSniff()中间件应该正确安装 + - text: 应正确加载 helmet.noSniff() 中间件 testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.include(data.appStack, 'nosniff'); assert.equal(data.headers['x-content-type-options'], 'nosniff'); }, xhr => { throw new Error(xhr.responseText); }) ``` @@ -34,7 +38,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.chinese.md index 8ef0b0c955..20ec44e4c5 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.chinese.md @@ -2,15 +2,38 @@ id: 587d8249367417b2b2512c40 title: Configure Helmet Using the ‘parent’ helmet() Middleware challengeType: 2 -videoUrl: '' -localeTitle: 配置头盔使用“父”头盔()中间件 +forumTopicId: 301575 +localeTitle: 使用 helmet() 中间件来配置 Helmet --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。 app.use(helmet())将自动包含上面介绍的所有中间件,noCache()和contentSecurityPolicy()除外,但如果需要,可以启用这些中间件。您还可以使用配置对象单独禁用或配置任何其他中间件。 //示例app.use(helmet({ frameguard: { // configure action: 'deny' }, contentSecurityPolicy: { // enable and configure directives: { defaultSrc: ["self"], styleSrc: ['style.com'], } }, dnsPrefetchControl: false // disable }))我们分别为教学目的引入了每个中间件,并且易于测试。使用“父”头盔()中间件对于真实项目来说是最简单,更清洁的。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 + +app.use(helmet()) 会自动加载除了 noCache()contentSecurityPolicy() 以外的,上面所有提到的中间件。但如果需要的话,我们也可以手动加入这两个中间件。通过修改配置对象,你还可以启用或禁用其它中间件。 +

示例:

+ +```js +app.use(helmet({ + frameguard: { // 配置 + action: 'deny' + }, + contentSecurityPolicy: { // 启用并配置 + directives: { + defaultSrc: ["self"], + styleSrc: ['style.com'], + } + }, + dnsPrefetchControl: false // 禁用 +})) +``` + +为了方便教学和测试,我们会一个一个地引入中间件。但在实际项目中,通过使用父级的 helmet() 来实现是最清晰和简洁的。 +
## Instructions -
+
+
## Tests @@ -18,7 +41,7 @@ localeTitle: 配置头盔使用“父”头盔()中间件 ```yml tests: - - text: 没有测试 - 这是一个描述性的挑战 + - text: 没有测试—这是一个介绍关卡 testString: assert(true) ``` @@ -34,7 +57,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.chinese.md index a5eb92ace0..cbe61f5afd 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.chinese.md @@ -2,15 +2,19 @@ id: 587d8249367417b2b2512c3e title: Disable Client-Side Caching with helmet.noCache() challengeType: 2 -videoUrl: '' -localeTitle: 使用helmet.noCache()禁用客户端缓存 +forumTopicId: 301576 +localeTitle: 使用 helment.noCache() 禁用客户端缓存 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。如果您要为您的网站发布更新,并且您希望用户始终下载较新的版本,您可以(尝试)在客户端的浏览器上禁用缓存。它在开发中也很有用。缓存具有性能优势,您将失去这些优势,因此只有在真正需要时才使用此选项。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +如果你为你的网站发布了一个更新,此时你一定想要用户看到最新的版本。为此,你可以通过禁用浏览器缓存来实现。而且,这个功能在开发环境中也非常有用。但另一方面,缓存可以为你的网站带来性能方面的提升,因此你应该只在必要的时候禁用缓存。 +
## Instructions -
+
+
## Tests @@ -18,7 +22,7 @@ localeTitle: 使用helmet.noCache()禁用客户端缓存 ```yml tests: - - text: 应该正确安装helmet.noCache()中间件 + - text: 应正确加载 helmet.noCache() 中间件 testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.include(data.appStack, 'nocache'); assert.equal(data.headers['cache-control'], 'no-store, no-cache, must-revalidate, proxy-revalidate'); }, xhr => { throw new Error(xhr.responseText); }) ``` @@ -34,7 +38,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.chinese.md index d20f643b80..a5801761b2 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.chinese.md @@ -2,15 +2,19 @@ id: 587d8248367417b2b2512c3d title: Disable DNS Prefetching with helmet.dnsPrefetchControl() challengeType: 2 -videoUrl: '' -localeTitle: 使用helmet.dnsPrefetchControl()禁用DNS预取 +forumTopicId: 301577 +localeTitle: 使用 helmet.dnsPrefetchControl() 禁用 DNS 预获取 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。为了提高性能,大多数浏览器都会为页面中的链接预取DNS记录。以这种方式,当用户点击链接时,目标IP已知。这可能导致过度使用DNS服务(如果您拥有一个大网站,数百万人访问......),隐私问题(一个窃听者可能会推断您在某个页面上),或者页面统计信息更改(某些链接可能会即使他们不是,也会出现。)如果您有高安全性需求,则可以以性能损失为代价禁用DNS预取。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +为了提高性能,大部分浏览器都会为页面上的链接预先加载 DNS 记录。这样当用户点击一个链接的时候浏览器已经知道其 IP 地址了。但这也会造成 DNS 服务的过度使用(如果你有一个百万用户数量级的大型网站)、隐私问题(窃听者可以借此推测出你在访问哪个页面)、页面统计数据准确性(有些没访问过的链接会被标记成已访问)。如果你对安全性要求比较高,你应该禁用 DNS 预加载。当然,这样做会让你损失一些性能。 +
## Instructions -
+
+
## Tests @@ -18,7 +22,7 @@ localeTitle: 使用helmet.dnsPrefetchControl()禁用DNS预取 ```yml tests: - - text: 应该正确安装helmet.dnsPrefetchControl()中间件 + - 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); }) ``` @@ -34,7 +38,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.chinese.md index 5589d68818..69936fc08e 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.chinese.md @@ -2,20 +2,48 @@ id: 58a25bcff9fc0f352b528e7d title: Hash and Compare Passwords Asynchronously challengeType: 2 -videoUrl: '' +forumTopicId: 301578 localeTitle: 哈希和异步比较密码 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。由于散列设计为计算密集型,因此建议在服务器上异步执行此操作,以避免在散列时阻止传入连接。所有你需要做的就是异步散列密码是调用bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => { /*Store hash in your db*/ });
将此散列函数添加到服务器(我们已经定义了函数中使用的变量供您使用)并将其记录到控制台以供您查看!此时,您通常会将哈希值保存到数据库中。现在,当您需要确定新输入是否与散列相同时,您只需使用比较函数bcrypt.compare(myPlaintextPassword, hash, (err, res) => { /*res == true or false*/ }); 。在记录完成的哈希并将“res”记录到比较中的控制台之后,将其添加到现有哈希函数中(因为您需要在调用比较函数之前等待哈希完成)。您应该在控制台中看到一个哈希值,然后打印出“true”!如果您将compare函数中的'myPlaintextPassword'更改为'someOtherPlaintextPassword',那么它应该为false。
 bcrypt.hash('passw0rd!',13,(错误,哈希)=> {
-  的console.log(散列); //$2a$12$Y.PHPE15wR25qrrtgGkiYe2sXo98cjuMCG1YwSI5rJW1DSJp0gEYS
-  bcrypt.compare('passw0rd!',hash,(err,res)=> {
-      的console.log(RES); //真正
-  });
-}); 
当您认为自己已经做对时,请提交您的页面。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +由于哈希运算会占用很大计算机资源并且会耗费比较多时间,因此比较推荐的做法是异步调用哈希算法,这样就不会因此阻止其它连接或请求了。异步调用哈希方法非常简单,只需要: + +```js +bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => { + /* 在数据库中存储 hash */ +}); +``` + +
## Instructions -
+
+把这段哈希方法添加到你的服务器(我们已经定义好这个方法的变量给你直接使用了),然后你可以尝试在控制台输出。之后,我们通常需要把哈希的结果保存到数据库。 +当你需要对比用户输入的值是否和之前哈希过的值一样的时候,只需要调用对比函数: + +```js +bcrypt.compare(myPlaintextPassword, hash, (err, res) => { + /*res == true or false*/ +}); +``` + +当控制台输出生成的哈希并在对比的回调中输出结果后,我们就可以将其添加到现有的哈希函数中。控制台中会首先输出一个哈希结果,然后输出 true。如果将比较函数中的 "myPlaintextPassword" 更改为 "someOtherPlaintextPassword",则比较的结果应显示 false。 + +```js +bcrypt.hash('passw0rd!', 13, (err, hash) => { + console.log(hash); + //$2a$12$Y.PHPE15wR25qrrtgGkiYe2sXo98cjuMCG1YwSI5rJW1DSJp0gEYS + bcrypt.compare('passw0rd!', hash, (err, res) => { + console.log(res); //true + }); +}); + +``` + +请在完成挑战后提交你的页面。
## Tests @@ -23,7 +51,7 @@ localeTitle: 哈希和异步比较密码 ```yml tests: - - text: 异步哈希生成并正确比较 + - text: 应异步地进行哈希并正确地执行对比 testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /START_ASYNC[^]*bcrypt.hash.*myPlaintextPassword( |),( |)saltRounds( |),( |).*err( |),( |)hash[^]*END_ASYNC/gi, 'You should call bcrypt.hash on myPlaintextPassword and saltRounds and handle err and hash as a result in the callback'); assert.match(data, /START_ASYNC[^]*bcrypt.hash[^]*bcrypt.compare.*myPlaintextPassword( |),( |)hash( |),( |).*err( |),( |)res[^]*}[^]*}[^]*END_ASYNC/gi, 'Nested within the hash function should be the compare function comparing myPlaintextPassword to hash'); }, xhr => { throw new Error(xhr.statusText); }) ``` @@ -39,7 +67,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.chinese.md index dbfdae3dd5..3db91bc10b 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.chinese.md @@ -2,15 +2,33 @@ id: 58a25bcff9fc0f352b528e7e title: Hash and Compare Passwords Synchronously challengeType: 2 -videoUrl: '' -localeTitle: 哈希并同步比较密码 +forumTopicId: 301579 +localeTitle: 哈希和同步比较密码 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。同步散列也很容易,但如果使用服务器端成本高或经常进行散列会导致延迟。使用此方法进行散列与调用var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds);
将此散列方法添加到代码中,然后将结果记录到控制台。同样,使用的变量已在服务器中定义,因此您无需调整它们。您可能会注意到即使您使用与异步函数相同的密码进行哈希处理,控制台中的结果也不同 - 这是由于每次哈希值随机生成,如第三个哈希字符串中的前22个字符所示。现在将密码输入与新的同步散列进行比较,您将使用compareSync方法: var result = bcrypt.compareSync(myPlaintextPassword, hash);结果是布尔值true或false。添加此功能并登录控制台结果以查看其是否正常工作。当您认为自己已经做对时,请提交您的页面。如果您在这些挑战期间遇到错误,可以在此处查看示例完成的代码。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +同步执行哈希运算是非常简单的,但这会在哈希计算量大并且次数多的情况下造成延迟。如果想要同步执行哈希运算,只需要这样调用: + +```js +var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds); +``` + +把同步哈希的方法添加到你的代码并在控制台输出。和之前一样,我们已经为你定义好了你需要使用的变量,你不需要做任何改动。你可能注意到,即使你对同一个密码进行哈希运算,同步哈希和异步哈希的结果也是不一样的。这是因为每次哈希的盐都是随机生成的,这种随机反映在前 22 个字符的不同上。 +当你需要对比用户输入的值是否和之前哈希过的值一样的时候,只需要调用对比函数: + +```js +var result = bcrypt.compareSync(myPlaintextPassword, hash); +``` + +返回的结果为 truefalse +
## Instructions -
+
+请添加这个方法,并把结果输出到控制台,以此来验证同步哈希操作是否成功。 +请在完成挑战后提交你的页面。
## Tests @@ -18,7 +36,7 @@ localeTitle: 哈希并同步比较密码 ```yml tests: - - text: 同步哈希生成并正确比较 + - text: 应同步地进行哈希并正确地执行对比 testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /START_SYNC[^]*hash.*=.*bcrypt.hashSync.*myPlaintextPassword( |),( |)saltRounds[^]*END_SYNC/gi, 'You should call bcrypt.hashSync on myPlaintextPassword with saltRounds'); assert.match(data, /START_SYNC[^]*result.*=.*bcrypt.compareSync.*myPlaintextPassword( |),( |)hash[^]*END_SYNC/gi, 'You should call bcrypt.compareSync on myPlaintextPassword with the hash generated in the last line'); }, xhr => { throw new Error(xhr.statusText); }) ``` @@ -34,7 +52,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.chinese.md index e12622586a..0d4241f993 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.chinese.md @@ -2,15 +2,19 @@ id: 587d8247367417b2b2512c37 title: Hide Potentially Dangerous Information Using helmet.hidePoweredBy() challengeType: 2 -videoUrl: '' -localeTitle: 使用helmet.hidePoweredBy()隐藏潜在的危险信息 +forumTopicId: 301580 +localeTitle: 使用 helmet.hidePoweredBy() 隐藏潜在的危险信息 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。如果黑客看到您的网站由Express提供支持,他们可以利用Express / Node中的已知漏洞。 X-Powered-By:Express默认发送来自Express的每个请求。 helmet.hidePoweredBy()中间件将删除X-Powered-By标头。您还可以将标头显式设置为其他内容,以便让人们离开。例如app.use(helmet.hidePoweredBy({setTo:'PHP 4.2.0'}))
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +如果黑客发现你的网站是用 Express 搭建的,那么他们就可以利用 Express 或 Node 现存的漏洞来攻击你的网站。X-Powered-By: Express 默认情况下会添加到所有响应的 header。不过 helmet.hidePoweredBy() 中间件可以帮你把 header 中的 X-Powered-By 字段移除。你甚至可以把它设置成其它的值来骗过黑客,比如 app.use(helmet.hidePoweredBy({ setTo: 'PHP 4.2.0' })) +
## Instructions -
+
+
## Tests @@ -18,7 +22,7 @@ localeTitle: 使用helmet.hidePoweredBy()隐藏潜在的危险信息 ```yml tests: - - text: helmet.hidePoweredBy()中间件应正确安装 + - text: 应正确地加载 helmet.hidePoweredBy() 中间件 testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.include(data.appStack, 'hidePoweredBy'); assert.notEqual(data.headers['x-powered-by'], 'Express')}, xhr => { throw new Error(xhr.responseText); }) ``` @@ -34,7 +38,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.chinese.md index 5a76f32a41..d3c82e0bb9 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/install-and-require-helmet.chinese.md @@ -2,15 +2,20 @@ id: 587d8247367417b2b2512c36 title: Install and Require Helmet challengeType: 2 -videoUrl: '' -localeTitle: 安装并需要头盔 +forumTopicId: 301581 +localeTitle: 安装和引入 Helmet --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。 Helmet通过设置各种HTTP标头来帮助您保护Express应用程序。安装包,然后需要它。
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +Helmet 通过配置不同的 HTTP header 信息来使你的 Express 应用更加安全。 +
## Instructions -
+
+ +安装版本号为 `3.21.3` 的 Helmet,并引入它。
## Tests @@ -18,8 +23,8 @@ localeTitle: 安装并需要头盔 ```yml tests: - - text: “helmet”依赖应该在package.json中 - testString: getUserInput => $.get(getUserInput('url') + '/_api/package.json').then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'helmet'); }, xhr => { throw new Error(xhr.responseText); }) + - text: 'package.json 中应存在版本号为 3.21.3helmet 依赖项' + testString: getUserInput => $.get(getUserInput('url') + '/_api/package.json').then(data => { var packJson = JSON.parse(data); assert(packJson.dependencies.helmet === '3.21.3' ); }, xhr => { throw new Error(xhr.responseText); }) ``` @@ -34,7 +39,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.chinese.md b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.chinese.md index 210707ce63..b68aed7c2f 100644 --- a/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.chinese.md +++ b/curriculum/challenges/chinese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.chinese.md @@ -2,15 +2,20 @@ id: 587d8247367417b2b2512c38 title: Mitigate the Risk of Clickjacking with helmet.frameguard() challengeType: 2 -videoUrl: '' -localeTitle: 使用helmet.frameguard()降低点击劫持的风险 +forumTopicId: 301582 +localeTitle: 使用 helmet.frameguard() 降低点击劫持的风险 --- ## Description -
提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。未经您的同意,您的页面可以放在<frame><iframe> 。除其他外,这可能导致点击劫持攻击。点击劫持是一种欺骗用户与不同于用户认为的页面进行交互的技术。这可以通过iframing在恶意上下文中执行您的页面获得。在这种情况下,黑客可以在页面上放置隐藏层。隐藏按钮可用于运行错误的脚本。此中间件设置X-Frame-Options标头。它限制了谁可以将您的网站放在框架中。它有三种模式:DENY,SAMEORIGIN和ALLOW-FROM。我们不需要我们的应用程序框架。您应该使用配置对象{action: 'deny'}传递的helmet.frameguard()
+
+请注意,本项目在 这个 Repl.it 项目 的基础上进行开发。你也可以从 GitHub 上克隆。 +黑客可能会不经过你的允许,把你的页面嵌套在 或者