Skip to content

Commit 8fe5855

Browse files
committed
Issue #2962753 by ivnish, asawari, sagarmohite0031, phenaproxima, smustgrave, longwave, pameeela, sime, joelpittet, quietone: Remove oEmbed security warning
1 parent 692ebbb commit 8fe5855

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

modules/media/media.install

-31
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
1212
use Drupal\Core\Url;
1313
use Drupal\image\Plugin\Field\FieldType\ImageItem;
1414
use Drupal\media\Entity\MediaType;
15-
use Drupal\media\MediaTypeInterface;
16-
use Drupal\media\Plugin\media\Source\OEmbedInterface;
1715
use Drupal\user\RoleInterface;
1816

1917
/**
@@ -78,35 +76,6 @@ function media_requirements($phase) {
7876
}
7977
}
8078
elseif ($phase === 'runtime') {
81-
// Check that oEmbed content is served in an iframe on a different domain,
82-
// and complain if it isn't.
83-
$domain = \Drupal::config('media.settings')->get('iframe_domain');
84-
85-
if (!\Drupal::service('media.oembed.iframe_url_helper')->isSecure($domain)) {
86-
// Find all media types which use a source plugin that implements
87-
// OEmbedInterface.
88-
$media_types = \Drupal::entityTypeManager()
89-
->getStorage('media_type')
90-
->loadMultiple();
91-
92-
$oembed_types = array_filter($media_types, function (MediaTypeInterface $media_type) {
93-
return $media_type->getSource() instanceof OEmbedInterface;
94-
});
95-
96-
if ($oembed_types) {
97-
// @todo Potentially allow site administrators to suppress this warning
98-
// permanently. See https://www.drupal.org/project/drupal/issues/2962753
99-
// for more information.
100-
$requirements['media_insecure_iframe'] = [
101-
'title' => t('Media'),
102-
'description' => t('It is potentially insecure to display oEmbed content in a frame that is served from the same domain as your main Drupal site, as this may allow execution of third-party code. <a href=":url">You can specify a different domain for serving oEmbed content here</a>.', [
103-
':url' => Url::fromRoute('media.settings')->setAbsolute()->toString(),
104-
]),
105-
'severity' => REQUIREMENT_WARNING,
106-
];
107-
}
108-
}
109-
11079
$module_handler = \Drupal::service('module_handler');
11180
foreach (MediaType::loadMultiple() as $type) {
11281
// Load the default display.

modules/media/tests/src/Functional/MediaSettingsTest.php

-15
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,6 @@ protected function setUp(): void {
2929
]));
3030
}
3131

32-
/**
33-
* Tests that media warning appears if oEmbed media types exists.
34-
*/
35-
public function testStatusPage(): void {
36-
$assert_session = $this->assertSession();
37-
38-
$this->drupalGet('admin/reports/status');
39-
$assert_session->pageTextNotContains('It is potentially insecure to display oEmbed content in a frame');
40-
41-
$this->createMediaType('oembed:video');
42-
43-
$this->drupalGet('admin/reports/status');
44-
$assert_session->pageTextContains('It is potentially insecure to display oEmbed content in a frame');
45-
}
46-
4732
/**
4833
* Tests that the media settings form stores a `null` iFrame domain.
4934
*/

0 commit comments

Comments
 (0)