Les En-têtes de sécurité

Qu'est-ce qu'une entête ?

Les en-têtes HTTP sont des valeurs qui sont affichées dans les messages de requête et de réponse dans l'en-tête de message pour HTTP. Ces en-têtes peuvent servir à indiquer au navigateur les données qu'il reçoit, par exemple un contenu PNG ou HTML. Les en-têtes peuvent également être utilisés pour accroître la sécurité et la confidentialité des visiteurs de votre site Web.

Security Headers

  • Strict-Transport-Security : Cette option oblige le navigateur à utiliser le protocole HTTPS.
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Strict-Transport-Security header - HTTP | MDN
The HTTP Strict-Transport-Security response header (often abbreviated as HSTS) informs browsers that the host should only be accessed using HTTPS, and that any future attempts to access it using HTTP should automatically be upgraded to HTTPS. Additionally, on future connections to the host, the browser will not allow the user to bypass secure connection errors, such as an invalid certificate. HSTS identifies a host by its domain name only.
  • X-Frame-Options : Indique au navigateur si vous souhaitez que votre site soit intégré dans un autre site ou non. Cela peut aider à se protéger contre des attaques telles que le clickjacking.
X-Frame-Options: SAMEORIGIN
X-Frame-Options header - HTTP | MDN
The HTTP X-Frame-Options response header can be used to indicate whether a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.
  • X-Content-Type-Options : Empêche le navigateur d'essayer de détecter le type de contenu par MIME et de s'en tenir à l'en-tête Content-Type déclaré.
X-Content-Type-Options: nosniff
X-Content-Type-Options header - HTTP | MDN
The HTTP X-Content-Type-Options response header indicates that the MIME types advertised in the Content-Type headers should be respected and not changed. The header allows you to avoid MIME type sniffing by specifying that the MIME types are deliberately configured.
  • Referrer-Policy : Permet au site de contrôler la les informations que le navigateur transmet lorsqu'il se dirige vers un nouveau site.
Referrer-Policy: no-referrer
Referrer-Policy header - HTTP | MDN
The HTTP Referrer-Policy response header controls how much referrer information (sent with the Referer header) should be included with requests. Aside from the HTTP header, you can set this policy in HTML.
  • Permissions-Policy : Permet au site de contrôler les fonctionnalités et les API qui peuvent être utilisées dans le navigateur.
Permissions Policy - HTTP | MDN
Permissions Policy provides mechanisms for web developers to explicitly declare what functionality can and cannot be used on a website. You define a set of “policies” that restrict what APIs the site’s code can access or modify the browser’s default behavior for certain features. This allows you to enforce best practices, even as the codebase evolves — as well as more safely compose third-party content.
  • Expect-ct : Permet au site de déterminer s'il est compatible avec les prochaines exigences de Chrome en matière de transparence des certificats.
expect-ct: max-age=86400, enforce
Expect-CT header - HTTP | MDN
The Expect-CT response header lets sites opt in to reporting and/or enforcement of Certificate Transparency requirements. Certificate Transparency (CT) aims to prevent the use of misissued certificates for that site from going unnoticed.

Vous trouverez plus d'informations sur https://securityheaders.com ainsi qu'un scanner d'en-tête.

Vous vous êtes abonné avec succès à CodeClan
Parfait ! Ensuite, complétez le paiement pour obtenir un accès complet à tout le contenu premium.
Erreur ! Impossible de s'inscrire. Lien invalide.
Bienvenue ! Vous vous êtes connecté avec succès.
Erreur ! Impossible de se connecter. Veuillez réessayer.
Succès ! Votre compte est entièrement activé, vous avez maintenant accès à tout le contenu.
Erreur ! Le paiement Stripe a échoué.
Succès ! Vos informations de facturation sont mises à jour.
Erreur ! La mise à jour des informations de facturation a échoué.