Skip to content

Commit

Permalink
Fix bug where external content in src attribute of input/video tags w…
Browse files Browse the repository at this point in the history
…as not secured (roundcube#5583)
  • Loading branch information
alecpl committed Jan 7, 2017
1 parent cb58d37 commit e08f22e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================

- Fix bug where image data URIs in css style were treated as evil/remote in mail preview (#5580)
- Fix bug where external content in src attribute of input/video tags was not secured (#5583)

RELEASE 1.3-beta
----------------
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/rcube_washtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private function is_image_attribute($tag, $attr)
return $attr == 'background'
|| $attr == 'color-profile' // SVG
|| ($attr == 'poster' && $tag == 'video')
|| ($attr == 'src' && preg_match('/^(img|source)$/i', $tag))
|| ($attr == 'src' && preg_match('/^(img|source|input|video|audio)$/i', $tag))
|| ($tag == 'image' && $attr == 'href'); // SVG
}

Expand Down
22 changes: 22 additions & 0 deletions tests/Framework/Washtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,26 @@ function test_wash_mathml()

$this->assertSame(trim($washed), trim($exp), "MathML content");
}

/**
* Test external links in src of input/video elements (#5583)
*/
function test_src_wash()
{
$html = "<input type=\"image\" src=\"http://TRACKING_URL/\">";

$washer = new rcube_washtml;
$washed = $washer->wash($html);

$this->assertTrue($washer->extlinks);
$this->assertNotContains('TRACKING', $washed, "Src attribute of <input> tag (#5583)");

$html = "<video src=\"http://TRACKING_URL/\">";

$washer = new rcube_washtml;
$washed = $washer->wash($html);

$this->assertTrue($washer->extlinks);
$this->assertNotContains('TRACKING', $washed, "Src attribute of <video> tag (#5583)");
}
}

0 comments on commit e08f22e

Please sign in to comment.