Index: trunk/phase3/includes/Sanitizer.php |
— | — | @@ -57,6 +57,11 @@ |
58 | 58 | )?(?=$space|\$)/sx" ); |
59 | 59 | |
60 | 60 | /** |
| 61 | + * Regular expression to match URIs that could trigger script execution |
| 62 | + */ |
| 63 | +define( 'MW_SCRIPT_URL_PATTERN', '/(^|\s)(javascript|vbscript)[^\w]/i' ); |
| 64 | + |
| 65 | +/** |
61 | 66 | * List of all named character entities defined in HTML 4.01 |
62 | 67 | * http://www.w3.org/TR/html4/sgml/entities.html |
63 | 68 | * @private |
— | — | @@ -631,7 +636,7 @@ |
632 | 637 | $attribute === 'about' || $attribute === 'property' || $attribute === 'resource' || |
633 | 638 | $attribute === 'datatype' || $attribute === 'typeof' ) { |
634 | 639 | //Paranoia. Allow "simple" values but suppress javascript |
635 | | - if ( preg_match( '/(^|\s)javascript\s*:/i', $value ) ) { |
| 640 | + if ( preg_match( MW_SCRIPT_URL_PATTERN, $value ) ) { |
636 | 641 | continue; |
637 | 642 | } |
638 | 643 | } |