Files
freeCodeCamp/curriculum/challenges/japanese/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md
2022-01-20 20:30:18 +01:00

2.7 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d8247367417b2b2512c38 helmet.frameguard() を使用してクリックジャック攻撃のリスクを軽減する 2 301582 mitigate-the-risk-of-clickjacking-with-helmet-frameguard

--description--

注意点として、このプロジェクトは Replit にある次のスタータープロジェクトをベースに構築されているか、または GitHub からクローンされています。

あなたのページは、あなたの同意なしに <frame><iframe> に挿入される可能性があります。 こうした可能性は、特にクリックジャック攻撃につながるおそれがあります。 クリックジャック攻撃とは、ユーザーをだまして、ユーザーが意図しているものとは違うページとやり取りさせる手法です。 これを利用し、iframe を通じて悪意のあるコンテキストでページを実行することが可能です。 こうした状況では、ハッカーによってあなたのページ上に隠れたレイヤーが配置されます。 悪意のあるスクリプトを実行するために、隠しボタンが使用されることがあります。 このミドルウェアは、X-Frame-Options ヘッダーを設定して、 サイトをフレーム内に配置できるユーザーを制限します。 DENY、SAMEORIGIN、ALLOW-FROM の 3 つのモードがあります。

サンプルのアプリをフレームに配置する必要はありません。

--instructions--

helmet.frameguard() を使用し、config オブジェクト {action: 'deny'} を渡してください。

--hints--

helmet.frameguard() ミドルウェアを正しくマウントする必要があります。

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/app-info').then(
    (data) => {
      assert.include(
        data.appStack,
        'frameguard',
        'helmet.frameguard() middleware is not mounted correctly'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

helmet.frameguard() の 'action' を 'DENY' に設定する必要があります。

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/app-info').then(
    (data) => {
      assert.property(data.headers, 'x-frame-options');
      assert.equal(data.headers['x-frame-options'], 'DENY');
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

--solutions--

/**
  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.
*/