This is an automated email from the ASF dual-hosted git repository.

vavila pushed a commit to branch feat/embedded-force-referrerpolicy
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 759df1bc4fb8ac60fbbc217b1a231fe2874e6a1e
Author: Vitor Avila <[email protected]>
AuthorDate: Tue Mar 18 17:26:44 2025 -0300

    feat(embedded): Force a specific referrerPolicy for the iframe request
---
 superset-embedded-sdk/src/index.ts | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/superset-embedded-sdk/src/index.ts 
b/superset-embedded-sdk/src/index.ts
index 063db77fb7..706ea3fbb8 100644
--- a/superset-embedded-sdk/src/index.ts
+++ b/superset-embedded-sdk/src/index.ts
@@ -64,6 +64,8 @@ export type EmbedDashboardParams = {
   iframeTitle?: string
   /** additional iframe sandbox attributes ex (allow-top-navigation, 
allow-popups-to-escape-sandbox) **/
   iframeSandboxExtras?: string[]
+  /** force a specific refererPolicy to be used in the iframe request **/
+  referrerPolicy?: ReferrerPolicy | null
 }
 
 export type Size = {
@@ -88,7 +90,8 @@ export async function embedDashboard({
   dashboardUiConfig,
   debug = false,
   iframeTitle = "Embedded Dashboard",
-  iframeSandboxExtras = []
+  iframeSandboxExtras = [],
+  referrerPolicy = null
 }: EmbedDashboardParams): Promise<EmbeddedDashboard> {
   function log(...info: unknown[]) {
     if (debug) {
@@ -142,6 +145,10 @@ export async function embedDashboard({
       iframeSandboxExtras.forEach((key: string) => {
         iframe.sandbox.add(key);
       });
+      // force a specific refererPolicy to be used in the iframe request
+      if(referrerPolicy) {
+        iframe.referrerPolicy = referrerPolicy;
+      }
 
       // add the event listener before setting src, to be 100% sure that we 
capture the load event
       iframe.addEventListener('load', () => {

Reply via email to