From 1bbe725830dbe8cda08f00f24d97b559893116d5 Mon Sep 17 00:00:00 2001 From: Preston Goforth Date: Fri, 14 Apr 2023 17:23:16 -0400 Subject: [PATCH] feat: Add documentation for `stripCspDirectives` and CSP information --- .../guides/guides/content-security-policy.mdx | 36 ++++++++++++++++ docs/guides/references/configuration.mdx | 43 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 docs/guides/guides/content-security-policy.mdx diff --git a/docs/guides/guides/content-security-policy.mdx b/docs/guides/guides/content-security-policy.mdx new file mode 100644 index 00000000000..a4e53a796d6 --- /dev/null +++ b/docs/guides/guides/content-security-policy.mdx @@ -0,0 +1,36 @@ +--- +title: Content Security Policy +e2eSpecific: true +--- + +Content Security Policy (CSP) is a browser security feature that allows you to +restrict the resources that can be loaded into your application. This can be +problematic for Cypress, because it needs to inject JavaScript into your +application in order to run tests and interact with the DOM. This page describes +how Cypress handles CSP and how to configure it to work with your application. + +There are two ways to implement CSP: + +- [Meta tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#http-equiv) +- [HTTP header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) + +The `` tag implementation is fully supported by Cypress without any +configuration required. This is because Cypress loads the necessary `