From 2cab677427f7fd462f35432d4a83fe89a26d7595 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 9 Jul 2008 09:55:42 +0000 Subject: Elgg 1.0, meet kses. Kses, Elgg 1.0. git-svn-id: https://code.elgg.org/elgg/trunk@1344 36083f99-b078-4883-b0ff-0f9b5a30f544 --- vendors/kses/docs/attribute-value-checks | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 vendors/kses/docs/attribute-value-checks (limited to 'vendors/kses/docs/attribute-value-checks') diff --git a/vendors/kses/docs/attribute-value-checks b/vendors/kses/docs/attribute-value-checks new file mode 100644 index 000000000..8b0d645ee --- /dev/null +++ b/vendors/kses/docs/attribute-value-checks @@ -0,0 +1,68 @@ +kses attribute value checks +=========================== + +As you've probably already read in the README file, an $allowed_html array +normally looks like this: + +$allowed = array('b' => array(), + 'i' => array(), + 'a' => array('href' => 1, + 'title' => 1), + 'p' => array('align' => 1), + 'br' => array()); + +This sets what elements and attributes are allowed. + +From kses 0.2.0, you can also perform some checks on the attribute values. You +do it like this: + +$allowed = array('b' => array(), + 'i' => array(), + 'a' => array('href' => + array('maxlen' => 100), + 'title' => 1), + 'p' => array('align' => 1), + 'font' => array('size' => + array('maxval' => 20)), + 'br' => array()); + +This means that kses should perform the maxlen check with the value 100 on the + value, as well as the maxval check with the value 20 on the value. + +The currently implemented checks (with more to come) are 'maxlen', 'maxval', +'minlen', 'minval' and 'valueless'. + +'maxlen' checks that the length of the attribute value is not greater than the +given value. It is helpful against Buffer Overflows in WWW clients and various +servers on the Internet. In my example above, it would mean that +"" wouldn't be +accepted. + +Of course, this problem is even worse if you put that long URL in a +tag instead, so the WWW client will fetch it automatically without a user +having to click it. + +'maxval' checks that the attribute value is an integer greater than or equal to +zero, that it doesn't have an unreasonable amount of zeroes or whitespace (to +avoid Buffer Overflows), and that it is not greater than the given value. In +my example above, it would mean that "" is accepted but +"" is not. This check helps against Denial of Service attacks +against WWW clients. + +One example of this DoS problem is