Merge "Disallow css attr() with url type"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 29 Sep 2016 00:58:43 +0000 (00:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 29 Sep 2016 00:58:43 +0000 (00:58 +0000)
includes/Sanitizer.php
tests/phpunit/includes/SanitizerTest.php

index c81c7bb..4069658 100644 (file)
@@ -1015,6 +1015,7 @@ class Sanitizer {
                                | url\s*\(
                                | image\s*\(
                                | image-set\s*\(
+                               | attr\s*\([^)]+[\s,]+url
                        !ix', $value ) ) {
                        return '/* insecure input */';
                }
index 26529e8..c915b70 100644 (file)
@@ -314,6 +314,8 @@ class SanitizerTest extends MediaWikiTestCase {
                                '/* insecure input */',
                                'background-image: -moz-image-set("asdf.png" 1x, "asdf.png" 2x);'
                        ],
+                       [ '/* insecure input */', 'foo: attr( title, url );' ],
+                       [ '/* insecure input */', 'foo: attr( title url );' ],
                ];
        }