Changeset 5586 in subversion for trunk/roundcubemail/program/include/main.inc
- Timestamp:
- Dec 9, 2011 4:13:54 PM (18 months ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/include/main.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r5562 r5586 884 884 * @return string Modified CSS source 885 885 */ 886 function rcmail_mod_css_styles($source, $container_id )886 function rcmail_mod_css_styles($source, $container_id, $allow_remote=false) 887 887 { 888 888 $last_pos = 0; … … 890 890 891 891 // ignore the whole block if evil styles are detected 892 $stripped = preg_replace('/[^a-z\(:;]/', '', rcmail_xss_entity_decode($source)); 893 if (preg_match('/expression|behavior|url\(|import[^a]/', $stripped)) 892 $source = rcmail_xss_entity_decode($source); 893 $stripped = preg_replace('/[^a-z\(:;]/i', '', $source); 894 $evilexpr = 'expression|behavior' . (!$allow_remote ? '|url\(|import[^a]' : ''); 895 if (preg_match("/$evilexpr/i", $stripped) // don't accept No-Gos 896 || (strpos($stripped, 'url(') && !preg_match('!url\s*\([ "\'](https?:)//[a-z0-9/._+-]+["\' ]\)!Ui', $source))) // only allow clean urls 894 897 return '/* evil! */'; 895 896 // remove css comments (sometimes used for some ugly hacks)897 $source = preg_replace('!/\*(.+)\*/!Ums', '', $source);898 898 899 899 // cut out all contents between { and } … … 938 938 $out = html_entity_decode(html_entity_decode($content)); 939 939 $out = preg_replace_callback('/\\\([0-9a-f]{4})/i', 'rcmail_xss_entity_decode_callback', $out); 940 $out = preg_replace('#/\*.*\*/#Um ', '', $out);940 $out = preg_replace('#/\*.*\*/#Ums', '', $out); 941 941 return $out; 942 942 }
Note: See TracChangeset
for help on using the changeset viewer.
