From 304b43cb308f326e2a5a5cda6fa886906b6c4f83 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Tue, 26 Mar 2019 18:26:56 -0700 Subject: [PATCH] Add 'allow-popups' to iframe sandbox permissions --- reader/sanitizer/sanitizer.go | 2 +- reader/sanitizer/sanitizer_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reader/sanitizer/sanitizer.go b/reader/sanitizer/sanitizer.go index eae9b211..1065e5b1 100644 --- a/reader/sanitizer/sanitizer.go +++ b/reader/sanitizer/sanitizer.go @@ -137,7 +137,7 @@ func getExtraAttributes(tagName string) ([]string, []string) { case "video", "audio": return []string{"controls"}, []string{"controls"} case "iframe": - return []string{"sandbox"}, []string{`sandbox="allow-scripts allow-same-origin"`} + return []string{"sandbox"}, []string{`sandbox="allow-scripts allow-same-origin allow-popups"`} default: return nil, nil } diff --git a/reader/sanitizer/sanitizer_test.go b/reader/sanitizer/sanitizer_test.go index b6588f03..57769dd3 100644 --- a/reader/sanitizer/sanitizer_test.go +++ b/reader/sanitizer/sanitizer_test.go @@ -165,7 +165,7 @@ func TestEspaceAttributes(t *testing.T) { func TestReplaceYoutubeURL(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output { @@ -175,7 +175,7 @@ func TestReplaceYoutubeURL(t *testing.T) { func TestReplaceSecureYoutubeURL(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output { @@ -185,7 +185,7 @@ func TestReplaceSecureYoutubeURL(t *testing.T) { func TestReplaceSecureYoutubeURLWithParameters(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output { @@ -195,7 +195,7 @@ func TestReplaceSecureYoutubeURLWithParameters(t *testing.T) { func TestReplaceYoutubeURLAlreadyReplaced(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output { @@ -205,7 +205,7 @@ func TestReplaceYoutubeURLAlreadyReplaced(t *testing.T) { func TestReplaceProtocolRelativeYoutubeURL(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output { @@ -215,7 +215,7 @@ func TestReplaceProtocolRelativeYoutubeURL(t *testing.T) { func TestReplaceIframeURL(t *testing.T) { input := `` - expected := `` + expected := `` output := Sanitize("http://example.org/", input) if expected != output {