Changeset 36c236e in github


Ignore:
Timestamp:
Sep 16, 2008 9:02:53 AM (5 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
a47acc5
Parents:
2f746dcd
Message:

Fix typos + only add callback for style tags when safe-flag is set

Location:
program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/html.php

    r1518702 r36c236e  
    3434 
    3535    public static $common_attrib = array('id','class','style','title','align'); 
    36     public static $containers = array('div','span','p','h1','h2','h3','form','textarea','table','tr','th','td'); 
     36    public static $containers = array('div','span','p','h1','h2','h3','form','textarea','table','tr','th','td','style'); 
    3737    public static $lc_tags = true; 
    3838 
  • program/steps/mail/func.inc

    r109314c r36c236e  
    612612    } 
    613613     
    614     // allow CSS styles, will be sanitized by rcmail_washtml_callback() 
    615     if ($p['safe']) { 
    616       $wash_opts['html_elements'][] = 'style'; 
    617     } 
    618      
    619614    $washer = new washtml($wash_opts); 
    620615    $washer->add_callback('form', 'rcmail_washtml_callback'); 
    621     $washer->add_callback('style', 'rcmail_washtml_callback'); 
     616     
     617    if ($p['safe']) {  // allow CSS styles, will be sanitized by rcmail_washtml_callback() 
     618      $washer->add_callback('style', 'rcmail_washtml_callback'); 
     619    } 
     620     
    622621    $body = $washer->wash($html); 
    623622    $REMOTE_OBJECTS = $washer->extlinks; 
     
    709708    case 'style': 
    710709      // decode all escaped entities and reduce to ascii strings 
    711       $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entitiy_decode($source)); 
     710      $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entitiy_decode($content)); 
    712711       
    713       // now check for evli strings like expression, behavior or url() 
    714       if (!preg_match('/expression|behavior|url\(|import/', $css)) { 
     712      // now check for evil strings like expression, behavior or url() 
     713      if (!preg_match('/expression|behavior|url\(|import/', $stripped)) { 
    715714        $out = html::tag('style', array('type' => 'text/css'), $content); 
    716715        break; 
Note: See TracChangeset for help on using the changeset viewer.