From 1760469ce53045c87c8fa6292e40aaef03d3bfe7 Mon Sep 17 00:00:00 2001 From: Luis Ibarra Date: Thu, 3 Dec 2026 16:05:46 -0500 Subject: [PATCH] docs: document accepted values for APPSMITH_ALLOWED_FRAME_ANCESTORS From v2.7.1, Appsmith uses the frame-ancestors setting only when it is a space-separated list of CSP frame-ancestors sources (appsmithorg/appsmith#42622). Document the accepted forms, the fallback to 'self' and its log line, the Admin Settings save error, and a troubleshooting entry for embeds that stop working after upgrade. Correct the instance settings page, which said the value is enforced through X-Frame-Options; only Content-Security-Policy is set. Co-Authored-By: Claude Opus 5.5 Co-authored-by: multica-agent --- ...bed-appsmith-into-existing-application.mdx | 2 +- .../setup/environment-variables.md | 26 +++++++++++++++++++ .../instance-settings.md | 4 ++- .../embedding-csp-errors.md | 23 +++++++++++++++- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/website/docs/advanced-concepts/embed-appsmith-into-existing-application.mdx b/website/docs/advanced-concepts/embed-appsmith-into-existing-application.mdx index 3e469df257..a43c2ce8db 100644 --- a/website/docs/advanced-concepts/embed-appsmith-into-existing-application.mdx +++ b/website/docs/advanced-concepts/embed-appsmith-into-existing-application.mdx @@ -55,7 +55,7 @@ When embedding Appsmith in private mode, access to the Appsmith app is restricte ### Prerequisites * Ensure you have a self-hosted instance of Appsmith. See the [Appsmith installation guides](/getting-started/setup/installation-guides) for detailed instructions on setting up your Appsmith instance. -* Ensure that Frame ancestors include the parent app domain if you have restricted access for embedding Appsmith. For more information, see [Frame ancestors](/getting-started/setup/environment-variables#appsmith_allowed_frame_ancestors). +* Ensure that Frame ancestors include the parent app domain if you have restricted access for embedding Appsmith. List the domains as CSP `frame-ancestors` sources separated by spaces, such as `https://internal.company.com`. For more information, see [Frame ancestors](/getting-started/setup/environment-variables#appsmith_allowed_frame_ancestors). * Ensure that you've hosted Appsmith app under the sub-domain of the same domain as the parent app. For example, `appsmith.company.com` and `internal.company.com` sharing the same domain (`company.com`). ### Embed Appsmith diff --git a/website/docs/getting-started/setup/environment-variables.md b/website/docs/getting-started/setup/environment-variables.md index 7f7cf3e3c3..dc93a905cb 100644 --- a/website/docs/getting-started/setup/environment-variables.md +++ b/website/docs/getting-started/setup/environment-variables.md @@ -453,6 +453,32 @@ This variable allows you to specify which domains can embed your Appsmith apps i ```yaml APPSMITH_ALLOWED_FRAME_ANCESTORS="'self' http://*.trusted-other.com" ``` + +The value must be a list of CSP `frame-ancestors` sources separated by spaces. Each item must be one of the following: + +- `'self'`: the Appsmith instance's own origin. +- `*`: any site. +- A scheme source, such as `https:`. +- A host source, such as `trusted-other.com` or `https://trusted-other.com`. A host source can start with a scheme, use a `*.` wildcard as its first label (`https://*.trusted-other.com`), and end with a port (`:8443`, or `:*` for any port) and a path (`https://trusted-other.com/apps/`). + +To block embedding everywhere, set the value to `'none'` with no other items. Leave the variable empty to allow only `'self'`. + +:::caution +From Appsmith `v2.7.1`, Appsmith ignores a value in any other form and allows only `'self'`. After a restart, the container log shows: + +``` +APPSMITH_ALLOWED_FRAME_ANCESTORS is not a list of CSP frame-ancestors sources. Using 'self'. +``` + +Commas, semicolons, tabs, line breaks, query strings, and non-ASCII characters all make the value invalid, and so does `'none'` combined with other items. Rewrite such values as shown below, then restart Appsmith. + +| Not accepted | Use instead | +| --- | --- | +| `https://trusted-other.com,https://another-trusted.com` | `https://trusted-other.com https://another-trusted.com` | +| `https://trusted-other.com; https://another-trusted.com` | `https://trusted-other.com https://another-trusted.com` | +| `https://trusted-other.com/?team=ops` | `https://trusted-other.com/` | +| `'none' https://trusted-other.com` | `'none'` or `https://trusted-other.com` | +::: For more information about embedding Appsmith, see the [Embed Appsmith](/advanced-concepts/embed-appsmith-into-existing-application) guide. diff --git a/website/docs/getting-started/setup/instance-configuration/instance-settings.md b/website/docs/getting-started/setup/instance-configuration/instance-settings.md index b1a569543a..39bc894eed 100644 --- a/website/docs/getting-started/setup/instance-configuration/instance-settings.md +++ b/website/docs/getting-started/setup/instance-configuration/instance-settings.md @@ -216,7 +216,9 @@ http://trusted-other.com http://another-trusted.com http://*.trusted-other.com ``` -These values are enforced via the `X-Frame-Options` and `Content-Security-Policy` headers to control where the application can be embedded. +Each URL must be a CSP `frame-ancestors` source: `'self'`, a scheme such as `https:`, or a host with an optional scheme, `*.` wildcard label, port, and path. Query strings, semicolons, and non-ASCII characters aren't accepted. If any URL is in another form, saving fails with the error `Please enter a valid parameter Allowed frame ancestors.` For the full rules, see [`APPSMITH_ALLOWED_FRAME_ANCESTORS`](/getting-started/setup/environment-variables#appsmith_allowed_frame_ancestors). + +These values are enforced via the `frame-ancestors` directive of the `Content-Security-Policy` header to control where the application can be embedded. diff --git a/website/docs/help-and-support/troubleshooting-guide/embedding-csp-errors.md b/website/docs/help-and-support/troubleshooting-guide/embedding-csp-errors.md index f56dff2622..37d4d336c2 100644 --- a/website/docs/help-and-support/troubleshooting-guide/embedding-csp-errors.md +++ b/website/docs/help-and-support/troubleshooting-guide/embedding-csp-errors.md @@ -10,9 +10,30 @@ To mitigate clickjacking, Appsmith sets the `Content-Security-Policy` header wit #### Solution -- Allow the embedding domains with the `APPSMITH_ALLOWED_FRAME_ANCESTORS` environment variable, for example `APPSMITH_ALLOWED_FRAME_ANCESTORS="'self' http://trusted-other.com"`. Separate multiple domains with spaces. See [Environment variables](/getting-started/setup/environment-variables). +- Allow the embedding domains with the `APPSMITH_ALLOWED_FRAME_ANCESTORS` environment variable, for example `APPSMITH_ALLOWED_FRAME_ANCESTORS="'self' http://trusted-other.com"`. Separate multiple domains with spaces. Each item must be a CSP `frame-ancestors` source, such as `'self'`, `https:`, or a host like `https://*.trusted-other.com`. See [`APPSMITH_ALLOWED_FRAME_ANCESTORS`](/getting-started/setup/environment-variables#appsmith_allowed_frame_ancestors). - For background on the clickjacking protection, see [Security](/product/security). +### Embedding stopped working after upgrading to v2.7.1 or later + +#### Cause + +From `v2.7.1`, Appsmith uses the `APPSMITH_ALLOWED_FRAME_ANCESTORS` value only when it is a list of CSP `frame-ancestors` sources separated by spaces. A value that uses commas or semicolons as separators, or contains a query string, tabs, line breaks, or non-ASCII characters, is ignored, and Appsmith allows only `'self'`. Embeds on other sites are then blocked. + +To confirm, check either of the following: + +- The container log shows this line after a restart: + + ``` + APPSMITH_ALLOWED_FRAME_ANCESTORS is not a list of CSP frame-ancestors sources. Using 'self'. + ``` + +- The `Content-Security-Policy` response header of an app page shows `frame-ancestors 'self'` without the domains you configured. + +#### Solution + +- Rewrite the value as sources separated by spaces. For example, change `https://trusted-other.com,https://another-trusted.com` to `https://trusted-other.com https://another-trusted.com`. For the accepted forms, see [`APPSMITH_ALLOWED_FRAME_ANCESTORS`](/getting-started/setup/environment-variables#appsmith_allowed_frame_ancestors). +- Restart Appsmith so the new value takes effect. + ### Removing 'unsafe-eval' from the CSP header #### Cause