freeCodeCamp/curriculum/challenges/japanese/09-information-security/information-security-with-h.../configure-helmet-using-the-...

1.8 KiB

id title challengeType forumTopicId dashedName
587d8249367417b2b2512c40 「親」の helmet() ミドルウェアを使用して Helmet を構成する 2 301575 configure-helmet-using-the-parent-helmet-middleware

--description--

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

app.use(helmet()) では、前に紹介したすべてのミドルウェアが自動的にインクルードされますが、noCache()contentSecurityPolicy() は除外されます。しかし、必要に応じてこれらを有効にすることができます。 config オブジェクトを使用して、他のミドルウェアを個別に無効化または構成することもできます。

例:

app.use(helmet({
  frameguard: {         // configure
    action: 'deny'
  },
  contentSecurityPolicy: {    // enable and configure
    directives: {
      defaultSrc: ["'self'"],
      styleSrc: ['style.com'],
    }
  },
  dnsPrefetchControl: false     // disable
}))

説明の都合上、またテストのしやすさを考慮して、各ミドルウェアを別々に紹介しました。 実際のプロジェクトでは「親」の helmet() ミドルウェアを簡単に実装して使用できます。

--hints--

テストはありません。説明のみのチャレンジです。

assert(true);

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