Skip to content

Commit 97c0b40

Browse files
Allow Providers Iframe script execution (#52569)
1 parent f95319e commit 97c0b40

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

airflow-core/src/airflow/ui/src/pages/Iframe.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ProgressBar } from "src/components/ui";
2424

2525
import { ErrorPage } from "./Error";
2626

27-
export const Iframe = () => {
27+
export const Iframe = ({ sandbox = "allow-same-origin allow-forms" }: { readonly sandbox: string }) => {
2828
const { page } = useParams();
2929
const { data: pluginData, isLoading } = usePluginServiceGetPlugins();
3030

@@ -44,10 +44,6 @@ export const Iframe = () => {
4444
return <ErrorPage />;
4545
}
4646

47-
// The following iframe sandbox setting is intentionally less restrictive.
48-
// ONLY trusted contents can be framed within Iframe.
49-
const sandbox = "allow-same-origin allow-forms";
50-
5147
return (
5248
<Box flexGrow={1} m={-3}>
5349
<iframe

airflow-core/src/airflow/ui/src/pages/Security.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ import { ProgressBar } from "src/components/ui";
2424

2525
import { ErrorPage } from "./Error";
2626

27+
// The following iframe sandbox setting is intentionally less restrictive.
28+
// This is considered safe because the framed content originates from the Auth manager,
29+
// which is part of the deployment of Airflow and trusted as per our security policy.
30+
// https://airflow.apache.org/docs/apache-airflow/stable/security/security_model.html
31+
const SANDBOX = "allow-scripts allow-same-origin allow-forms";
32+
2733
export const Security = () => {
2834
const { page } = useParams();
2935

@@ -43,15 +49,9 @@ export const Security = () => {
4349
return <ErrorPage />;
4450
}
4551

46-
// The following iframe sandbox setting is intentionally less restrictive.
47-
// This is considered safe because the framed content originates from the Auth manager,
48-
// which is part of the deployment of Airflow and trusted as per our security policy.
49-
// https://airflow.apache.org/docs/apache-airflow/stable/security/security_model.html
50-
const sandbox = "allow-scripts allow-same-origin allow-forms";
51-
5252
return (
5353
<Box flexGrow={1} m={-3}>
54-
<iframe sandbox={sandbox} src={link.href} style={{ height: "100%", width: "100%" }} title={link.text} />
54+
<iframe sandbox={SANDBOX} src={link.href} style={{ height: "100%", width: "100%" }} title={link.text} />
5555
</Box>
5656
);
5757
};

airflow-core/src/airflow/ui/src/router.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ export const routerConfig = [
143143
path: "connections",
144144
},
145145
{
146-
element: <Iframe />,
146+
// The following iframe sandbox setting is intentionally less restrictive.
147+
// This is considered safe because the framed content originates from the Plugins,
148+
// which is part of the deployment of Airflow and trusted as per our security policy.
149+
// https://airflow.apache.org/docs/apache-airflow/stable/security/security_model.html
150+
// They are not user provided plugins.
151+
element: <Iframe sandbox="allow-scripts allow-same-origin allow-forms" />,
147152
path: "plugin/:page",
148153
},
149154
{

0 commit comments

Comments
 (0)