Plugin Directory

Changeset 2744639 for anrghg


Ignore:
Timestamp:
06/18/2022 11:33:53 PM (4 years ago)
Author:
anrghg
Message:

0.81.6.0

0.81.6 (2022-06-18)

  • Security: KSES whitelist: Fix bug in whitelist extension.
  • Security: Stop trying to use a global KSES whitelist.
  • Security: Date meta tags: Tailor KSES whitelists to the instance.
Location:
anrghg
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • anrghg/tags/0.81.6/anrghg.php

    r2744607 r2744639  
    1414 * Tested PHP up to: 8.0
    1515 * CAUTION: The following field is parsed in the stable tag folder for upgrade configuration:
    16  * Version: 0.81.5
     16 * Version: 0.81.6
    1717 * Author: ANRGHG
    1818 * Author URI: https://anrghg.sunsite.fr
     
    7979 * @var string C_S_ANRGHG_VER  Plugin version constant.
    8080 */
    81 define( 'C_S_ANRGHG_VER', '0.81.5' );
     81define( 'C_S_ANRGHG_VER', '0.81.6' );
    8282
    8383/**
     
    10741074
    10751075/**
    1076  * Generates the whitelist for `wp_kses()`.
     1076 * Generates a global whitelist for `wp_kses()`.
    10771077 *
    10781078 * @since 0.81.5
    1079  * User input is supported by $allowedposttags and $allowedtags.
     1079 * @since 0.81.6 Fix bug in whitelist extension.
     1080 * @since 0.81.6 Tailor whitelists to the instance for more efficiency.
     1081 * Global KSES whitelists are a non-starter, because they defeat the
     1082 * KSES design goals, e.g. the button[onclick] should not be allowed
     1083 * on public pages. But the input[checked,class,id,type] is required
     1084 * on public pages to support display toggle checkboxes. WordPress’s
     1085 * implementation of global attributes is lacking the [tabindex] and
     1086 * most [aria-*] attributes. Thus, KSES + WordPress is bad for a11y.
     1087 * Therefore our KSES whitelists should be tailored to the instance.
     1088 *
     1089 * User input may be supported by $allowedposttags.
    10801090 * @see wp-includes/kses.php
    10811091 * @see also the `$global_attributes` in `wp-includes/kses.php:2520`.
     
    10831093 * `wp_kses()` escapes `>` (and `<`) as HTML entities.
    10841094 *
    1085  * BUG REPORT: After the tabindex argument is properly added to div,
    1086  * the input and meta elements are not added.
    1087  * With array_push() instead of [], the function breaks down.
    1088  *
     1095 * global $allowedtags provided along with $allowedposttags is a very
     1096 * limited subset of the latter, so merging it in would be pointless.
     1097 * @global $allowedposttags      WordPress KSES whitelist.
     1098 * @global $g_m_anrghg_whitelist Extended KSES whitelist.
    10891099 * @return array $g_m_anrghg_whitelist
    10901100 */
    10911101function anrghg_whitelist() {
    1092     global $allowedposttags, $allowedtags, $g_m_anrghg_whitelist;
     1102    global $allowedposttags, $g_m_anrghg_whitelist;
    10931103    if ( false === $g_m_anrghg_whitelist ) {
    10941104        $g_m_anrghg_whitelist = $allowedposttags;
    1095         foreach ( $allowedtags as $l_s_name => $l_m_val ) {
    1096             if ( array_key_exists( $l_s_name, $g_m_anrghg_whitelist ) ) {
    1097                 $g_m_anrghg_whitelist[ $l_s_name ] = array_merge( $g_m_anrghg_whitelist[ $l_s_name ], $allowedtags[ $l_s_name ] );
    1098             } else {
    1099                 $g_m_anrghg_whitelist[] = $allowedtags[ $l_s_name ];
    1100             }
    1101         }
    11021105        $l_a_whitelist = array(
    11031106            'a'        => array(
    1104                 'class'    => true,
    1105                 'href'     => true,
    11061107                'tabindex' => true,
    11071108            ),
    1108             'br'       => array(),
    1109             'button'   => array(
    1110                 'class'   => true,
    1111                 'id'      => true,
    1112                 'name'    => true,
    1113                 'onclick' => true,
    1114                 'type'    => true,
    1115             ),
    1116             'code'     => array(
    1117                 'class' => true,
    1118             ),
    1119             'datalist' => array(
    1120                 'id' => true,
    1121             ),
    11221109            'div'      => array(
    1123                 'aria-hidden'     => true,
    1124                 'autofocus'       => true,
    1125                 'class'           => true,
    1126                 'contenteditable' => true,
    1127                 'hidden'          => true,
    1128                 'id'              => true,
    11291110                'tabindex'        => true,
    11301111            ),
    1131             'fieldset' => array(),
    11321112            'input'    => array(
    1133                 'aria-label'  => true,
    11341113                'checked'     => true,
    11351114                'class'       => true,
    11361115                'id'          => true,
    1137                 'name'        => true,
    1138                 'min'         => true,
    1139                 'max'         => true,
    1140                 'step'        => true,
    1141                 'list'        => true,
    1142                 'onkeyup'     => true,
    1143                 'placeholder' => true,
    11441116                'type'        => true,
    1145                 'value'       => true,
    11461117            ),
    11471118            'label'    => array(
    11481119                'class' => true,
    11491120                'for'   => true,
    1150             ),
    1151             'legend'   => array(
    1152                 'aria-hidden' => true,
    1153                 'aria-label'  => true,
    1154                 'class'       => true,
    1155             ),
    1156             'li'       => array(
    1157                 'class' => true,
    1158             ),
    1159             'meta'     => array(
    1160                 'content'  => true,
    1161                 'name'     => true,
    1162                 'property' => true,
    1163             ),
    1164             'option'   => array(
    1165                 'aria-label' => true,
    1166                 'selected'   => true,
    1167                 'value'      => true,
    1168             ),
    1169             'optgroup' => array(
    1170                 'label' => true,
    1171             ),
    1172             'p'        => array(
    1173                 'class' => true,
    1174             ),
    1175             'select'   => array(
    1176                 'id'   => true,
    1177                 'name' => true,
    1178             ),
    1179             'span'     => array(
    1180                 'class' => true,
    1181                 'id'    => true,
    1182             ),
    1183             'table'    => array(
    1184                 'class' => true,
    1185             ),
    1186             'tbody'    => array(),
    1187             'td'       => array(),
    1188             'textarea' => array(
    1189                 'class'       => true,
    1190                 'id'          => true,
    1191                 'name'        => true,
    1192                 'placeholder' => true,
    1193             ),
    1194             'tr'       => array(
    1195                 'id' => true,
    1196             ),
    1197             'ul'       => array(
    1198                 'class' => true,
    11991121            ),
    12001122        );
     
    12031125                $g_m_anrghg_whitelist[ $l_s_name ] = array_merge( $g_m_anrghg_whitelist[ $l_s_name ], $l_a_whitelist[ $l_s_name ] );
    12041126            } else {
    1205                 $g_m_anrghg_whitelist[] = $l_a_whitelist[ $l_s_name ];
     1127                $g_m_anrghg_whitelist[ $l_s_name ] = $l_a_whitelist[ $l_s_name ];
    12061128            }
    12071129        }
     
    31883110function anrghg_add_date_meta_tags() {
    31893111    if ( anrghg_apply_config( 'anrghg_date_meta_common_published' ) ) {
    3190         echo (
    3191             "\t<meta name=\"date\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3112        echo wp_kses(
     3113            "\t<meta name=\"date\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3114            array( 'meta' => array( 'name' => true, 'content' => true ) )
    31923115        );
    31933116    }
    31943117    if ( anrghg_apply_config( 'anrghg_date_meta_common_last_edit' ) ) {
    3195         anrghg_kses_echo(
    3196             "\t<meta name=\"last-modified\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3118        echo wp_kses(
     3119            "\t<meta name=\"last-modified\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3120            array( 'meta' => array( 'name' => true, 'content' => true ) )
    31973121        );
    31983122    }
    31993123    if ( anrghg_apply_config( 'anrghg_date_meta_open_g_published' ) ) {
    3200         anrghg_kses_echo(
    3201             "\t<meta property=\"article:published_time\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3124        echo wp_kses(
     3125            "\t<meta property=\"article:published_time\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3126            array( 'meta' => array( 'property' => true, 'content' => true ) )
    32023127        );
    32033128    }
    32043129    if ( anrghg_apply_config( 'anrghg_date_meta_open_g_last_edit' ) ) {
    3205         anrghg_kses_echo(
    3206             "\t<meta property=\"article:modified_time\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3130        echo wp_kses(
     3131            "\t<meta property=\"article:modified_time\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3132            array( 'meta' => array( 'property' => true, 'content' => true ) )
    32073133        );
    32083134    }
     
    53845310    'wp_footer',
    53855311    function() {
    5386         global $g_s_anrghg_footer;
     5312        global $g_s_anrghg_footer, $g_m_anrghg_whitelist;
    53875313        if ( ! empty( $g_s_anrghg_footer ) ) {
    53885314            anrghg_kses_echo( "\r\n\r\n" . '<div class="anrghg-footer-complement-list">' );
  • anrghg/tags/0.81.6/package.json

    r2744607 r2744639  
    11{
    22  "name": "anrghg",
    3   "version": "0.81.5",
     3  "version": "0.81.6",
    44  "description": "A.N.R.GHG Publishing Helper",
    55  "main": "index.js",
  • anrghg/tags/0.81.6/readme.txt

    r2744607 r2744639  
    88Requires PHP: 5.6
    99Tested PHP up to: 8.0
    10 Package Version: 0.81.5.0
    11 Version: 0.81.5
     10Package Version: 0.81.6.0
     11Version: 0.81.6
    1212CAUTION: The following field is parsed in trunk/ for release configuration:
    13 Stable Tag: 0.81.5
     13Stable Tag: 0.81.6
    1414License: GPLv2 or later
    1515License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    502502== Changelog ==
    503503
     504= 0.81.6 (2022-06-18) =
     505
     506* Security: KSES whitelist: Fix bug in whitelist extension.
     507* Security: Stop trying to use a global KSES whitelist.
     508* Security: Date meta tags: Tailor KSES whitelists to the instance.
     509
    504510= 0.81.5 (2022-06-18) =
    505511
    506512* Security: Internal style sheets: Secure output.
    507513* Security: Internal style sheets: Restore direct child selectors.
    508 * Security: KSES: Properly implement the whitelist with extensions.
    509 * Security: KSES: Document unfixable bug in implementation.
     514* Security: KSES: Try implementing the whitelist with extensions.
    510515
    511516= 0.81.4 (2022-06-17) =
  • anrghg/trunk/anrghg.php

    r2744607 r2744639  
    1414 * Tested PHP up to: 8.0
    1515 * CAUTION: The following field is parsed in the stable tag folder for upgrade configuration:
    16  * Version: 0.81.5
     16 * Version: 0.81.6
    1717 * Author: ANRGHG
    1818 * Author URI: https://anrghg.sunsite.fr
     
    7979 * @var string C_S_ANRGHG_VER  Plugin version constant.
    8080 */
    81 define( 'C_S_ANRGHG_VER', '0.81.5' );
     81define( 'C_S_ANRGHG_VER', '0.81.6' );
    8282
    8383/**
     
    10741074
    10751075/**
    1076  * Generates the whitelist for `wp_kses()`.
     1076 * Generates a global whitelist for `wp_kses()`.
    10771077 *
    10781078 * @since 0.81.5
    1079  * User input is supported by $allowedposttags and $allowedtags.
     1079 * @since 0.81.6 Fix bug in whitelist extension.
     1080 * @since 0.81.6 Tailor whitelists to the instance for more efficiency.
     1081 * Global KSES whitelists are a non-starter, because they defeat the
     1082 * KSES design goals, e.g. the button[onclick] should not be allowed
     1083 * on public pages. But the input[checked,class,id,type] is required
     1084 * on public pages to support display toggle checkboxes. WordPress’s
     1085 * implementation of global attributes is lacking the [tabindex] and
     1086 * most [aria-*] attributes. Thus, KSES + WordPress is bad for a11y.
     1087 * Therefore our KSES whitelists should be tailored to the instance.
     1088 *
     1089 * User input may be supported by $allowedposttags.
    10801090 * @see wp-includes/kses.php
    10811091 * @see also the `$global_attributes` in `wp-includes/kses.php:2520`.
     
    10831093 * `wp_kses()` escapes `>` (and `<`) as HTML entities.
    10841094 *
    1085  * BUG REPORT: After the tabindex argument is properly added to div,
    1086  * the input and meta elements are not added.
    1087  * With array_push() instead of [], the function breaks down.
    1088  *
     1095 * global $allowedtags provided along with $allowedposttags is a very
     1096 * limited subset of the latter, so merging it in would be pointless.
     1097 * @global $allowedposttags      WordPress KSES whitelist.
     1098 * @global $g_m_anrghg_whitelist Extended KSES whitelist.
    10891099 * @return array $g_m_anrghg_whitelist
    10901100 */
    10911101function anrghg_whitelist() {
    1092     global $allowedposttags, $allowedtags, $g_m_anrghg_whitelist;
     1102    global $allowedposttags, $g_m_anrghg_whitelist;
    10931103    if ( false === $g_m_anrghg_whitelist ) {
    10941104        $g_m_anrghg_whitelist = $allowedposttags;
    1095         foreach ( $allowedtags as $l_s_name => $l_m_val ) {
    1096             if ( array_key_exists( $l_s_name, $g_m_anrghg_whitelist ) ) {
    1097                 $g_m_anrghg_whitelist[ $l_s_name ] = array_merge( $g_m_anrghg_whitelist[ $l_s_name ], $allowedtags[ $l_s_name ] );
    1098             } else {
    1099                 $g_m_anrghg_whitelist[] = $allowedtags[ $l_s_name ];
    1100             }
    1101         }
    11021105        $l_a_whitelist = array(
    11031106            'a'        => array(
    1104                 'class'    => true,
    1105                 'href'     => true,
    11061107                'tabindex' => true,
    11071108            ),
    1108             'br'       => array(),
    1109             'button'   => array(
    1110                 'class'   => true,
    1111                 'id'      => true,
    1112                 'name'    => true,
    1113                 'onclick' => true,
    1114                 'type'    => true,
    1115             ),
    1116             'code'     => array(
    1117                 'class' => true,
    1118             ),
    1119             'datalist' => array(
    1120                 'id' => true,
    1121             ),
    11221109            'div'      => array(
    1123                 'aria-hidden'     => true,
    1124                 'autofocus'       => true,
    1125                 'class'           => true,
    1126                 'contenteditable' => true,
    1127                 'hidden'          => true,
    1128                 'id'              => true,
    11291110                'tabindex'        => true,
    11301111            ),
    1131             'fieldset' => array(),
    11321112            'input'    => array(
    1133                 'aria-label'  => true,
    11341113                'checked'     => true,
    11351114                'class'       => true,
    11361115                'id'          => true,
    1137                 'name'        => true,
    1138                 'min'         => true,
    1139                 'max'         => true,
    1140                 'step'        => true,
    1141                 'list'        => true,
    1142                 'onkeyup'     => true,
    1143                 'placeholder' => true,
    11441116                'type'        => true,
    1145                 'value'       => true,
    11461117            ),
    11471118            'label'    => array(
    11481119                'class' => true,
    11491120                'for'   => true,
    1150             ),
    1151             'legend'   => array(
    1152                 'aria-hidden' => true,
    1153                 'aria-label'  => true,
    1154                 'class'       => true,
    1155             ),
    1156             'li'       => array(
    1157                 'class' => true,
    1158             ),
    1159             'meta'     => array(
    1160                 'content'  => true,
    1161                 'name'     => true,
    1162                 'property' => true,
    1163             ),
    1164             'option'   => array(
    1165                 'aria-label' => true,
    1166                 'selected'   => true,
    1167                 'value'      => true,
    1168             ),
    1169             'optgroup' => array(
    1170                 'label' => true,
    1171             ),
    1172             'p'        => array(
    1173                 'class' => true,
    1174             ),
    1175             'select'   => array(
    1176                 'id'   => true,
    1177                 'name' => true,
    1178             ),
    1179             'span'     => array(
    1180                 'class' => true,
    1181                 'id'    => true,
    1182             ),
    1183             'table'    => array(
    1184                 'class' => true,
    1185             ),
    1186             'tbody'    => array(),
    1187             'td'       => array(),
    1188             'textarea' => array(
    1189                 'class'       => true,
    1190                 'id'          => true,
    1191                 'name'        => true,
    1192                 'placeholder' => true,
    1193             ),
    1194             'tr'       => array(
    1195                 'id' => true,
    1196             ),
    1197             'ul'       => array(
    1198                 'class' => true,
    11991121            ),
    12001122        );
     
    12031125                $g_m_anrghg_whitelist[ $l_s_name ] = array_merge( $g_m_anrghg_whitelist[ $l_s_name ], $l_a_whitelist[ $l_s_name ] );
    12041126            } else {
    1205                 $g_m_anrghg_whitelist[] = $l_a_whitelist[ $l_s_name ];
     1127                $g_m_anrghg_whitelist[ $l_s_name ] = $l_a_whitelist[ $l_s_name ];
    12061128            }
    12071129        }
     
    31883110function anrghg_add_date_meta_tags() {
    31893111    if ( anrghg_apply_config( 'anrghg_date_meta_common_published' ) ) {
    3190         echo (
    3191             "\t<meta name=\"date\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3112        echo wp_kses(
     3113            "\t<meta name=\"date\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3114            array( 'meta' => array( 'name' => true, 'content' => true ) )
    31923115        );
    31933116    }
    31943117    if ( anrghg_apply_config( 'anrghg_date_meta_common_last_edit' ) ) {
    3195         anrghg_kses_echo(
    3196             "\t<meta name=\"last-modified\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3118        echo wp_kses(
     3119            "\t<meta name=\"last-modified\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3120            array( 'meta' => array( 'name' => true, 'content' => true ) )
    31973121        );
    31983122    }
    31993123    if ( anrghg_apply_config( 'anrghg_date_meta_open_g_published' ) ) {
    3200         anrghg_kses_echo(
    3201             "\t<meta property=\"article:published_time\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3124        echo wp_kses(
     3125            "\t<meta property=\"article:published_time\" content=\"" . get_the_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3126            array( 'meta' => array( 'property' => true, 'content' => true ) )
    32023127        );
    32033128    }
    32043129    if ( anrghg_apply_config( 'anrghg_date_meta_open_g_last_edit' ) ) {
    3205         anrghg_kses_echo(
    3206             "\t<meta property=\"article:modified_time\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n"
     3130        echo wp_kses(
     3131            "\t<meta property=\"article:modified_time\" content=\"" . get_the_modified_date( 'Y-m-d\TH:i:sO' ) . "\" />\r\n",
     3132            array( 'meta' => array( 'property' => true, 'content' => true ) )
    32073133        );
    32083134    }
     
    53845310    'wp_footer',
    53855311    function() {
    5386         global $g_s_anrghg_footer;
     5312        global $g_s_anrghg_footer, $g_m_anrghg_whitelist;
    53875313        if ( ! empty( $g_s_anrghg_footer ) ) {
    53885314            anrghg_kses_echo( "\r\n\r\n" . '<div class="anrghg-footer-complement-list">' );
  • anrghg/trunk/package.json

    r2744607 r2744639  
    11{
    22  "name": "anrghg",
    3   "version": "0.81.5",
     3  "version": "0.81.6",
    44  "description": "A.N.R.GHG Publishing Helper",
    55  "main": "index.js",
  • anrghg/trunk/readme.txt

    r2744607 r2744639  
    88Requires PHP: 5.6
    99Tested PHP up to: 8.0
    10 Package Version: 0.81.5.0
    11 Version: 0.81.5
     10Package Version: 0.81.6.0
     11Version: 0.81.6
    1212CAUTION: The following field is parsed in trunk/ for release configuration:
    13 Stable Tag: 0.81.5
     13Stable Tag: 0.81.6
    1414License: GPLv2 or later
    1515License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    502502== Changelog ==
    503503
     504= 0.81.6 (2022-06-18) =
     505
     506* Security: KSES whitelist: Fix bug in whitelist extension.
     507* Security: Stop trying to use a global KSES whitelist.
     508* Security: Date meta tags: Tailor KSES whitelists to the instance.
     509
    504510= 0.81.5 (2022-06-18) =
    505511
    506512* Security: Internal style sheets: Secure output.
    507513* Security: Internal style sheets: Restore direct child selectors.
    508 * Security: KSES: Properly implement the whitelist with extensions.
    509 * Security: KSES: Document unfixable bug in implementation.
     514* Security: KSES: Try implementing the whitelist with extensions.
    510515
    511516= 0.81.4 (2022-06-17) =
Note: See TracChangeset for help on using the changeset viewer.