Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions website/docs/getting-started/setup/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
:::
</dd>
For more information about embedding Appsmith, see the [Embed Appsmith](/advanced-concepts/embed-appsmith-into-existing-application) guide.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</dd>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading