mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Apply kses bad-protocol checks only to URI typed attributes. Props takayukister. fixes #5917 #6888 #6910 #7512
git-svn-id: http://svn.automattic.com/wordpress/trunk@8671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4104795d70
commit
3911137835
@ -551,6 +551,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
|||||||
$attrarr = array ();
|
$attrarr = array ();
|
||||||
$mode = 0;
|
$mode = 0;
|
||||||
$attrname = '';
|
$attrname = '';
|
||||||
|
$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
|
||||||
|
|
||||||
# Loop through the whole attribute list
|
# Loop through the whole attribute list
|
||||||
|
|
||||||
@ -595,7 +596,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
|||||||
if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
|
if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
|
||||||
# "value"
|
# "value"
|
||||||
{
|
{
|
||||||
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
|
$thisval = $match[1];
|
||||||
|
if ( in_array($attrname, $uris) )
|
||||||
|
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
|
||||||
|
|
||||||
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
||||||
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
|
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
|
||||||
@ -609,7 +612,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
|||||||
if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
|
if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
|
||||||
# 'value'
|
# 'value'
|
||||||
{
|
{
|
||||||
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
|
$thisval = $match[1];
|
||||||
|
if ( in_array($attrname, $uris) )
|
||||||
|
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
|
||||||
|
|
||||||
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
||||||
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
|
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
|
||||||
@ -623,7 +628,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
|||||||
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
|
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
|
||||||
# value
|
# value
|
||||||
{
|
{
|
||||||
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
|
$thisval = $match[1];
|
||||||
|
if ( in_array($attrname, $uris) )
|
||||||
|
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
|
||||||
|
|
||||||
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
if(FALSE === array_key_exists($attrname, $attrarr)) {
|
||||||
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
|
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
|
||||||
|
Loading…
Reference in New Issue
Block a user