[wp-trac] [WordPress Trac] #55966: safecss_filter_attr() returns empty if containing min()

WordPress Trac noreply at wordpress.org
Wed Sep 7 15:27:34 UTC 2022


#55966: safecss_filter_attr() returns empty if containing min()
----------------------------------------------+----------------------------
 Reporter:  uxl                               |       Owner:
                                              |  SergeyBiryukov
     Type:  defect (bug)                      |      Status:  accepted
 Priority:  normal                            |   Milestone:  6.1
Component:  Formatting                        |     Version:  6.0
 Severity:  major                             |  Resolution:
 Keywords:  has-patch early needs-unit-tests  |     Focuses:  css
----------------------------------------------+----------------------------

Comment (by SergeyBiryukov):

 It looks like the tests for `WP_Theme_JSON::remove_insecure_properties()`
 need some adjustments. as they [https://github.com/WordPress/wordpress-
 develop/runs/8230656804?check_suite_focus=true#step:17:222 fail with these
 changes].

 Since `var(--color, var(--unsafe-fallback))` is now allowed per comment:3,
 I guess these would need some new examples of unsafe values?

 {{{
 There were 3 failures:

 1)
 Tests_Theme_wpThemeJson::test_remove_insecure_properties_removes_unsafe_styles
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
              'core/group' => Array (...)
 +            'core/cover' => Array (...)
          )
      )
      'version' => 2
  )

 /var/www/tests/phpunit/includes/abstract-testcase.php:1006
 /var/www/tests/phpunit/tests/theme/wpThemeJson.php:1665
 phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:51
 /var/www/vendor/bin/phpunit:118

 2)
 Tests_Theme_wpThemeJson::test_remove_insecure_properties_removes_unsafe_styles_sub_properties
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
                  'bottomLeft' => '6px'
 +                'topRight' => 'var(--top-right, var(--unsafe...back))'
 @@ @@
                  'left' => '1px'
 +                'bottom' => 'var(--bottom, var(--unsafe-fallback))'
 @@ @@
                          'left' => '2px'
 +                        'bottom' => 'var(--bottom, var(--unsafe-
 fallback))'
 @@ @@
                          'bottomLeft' => '5px'
 +                        'topRight' => 'var(--top-right,
 var(--unsafe...back))'
 @@ @@
                                  'left' => '4px'
 +                                'bottom' => 'var(--bottom, var(--unsafe-
 fallback))'
                              )
                          )
                      )
                  )
              )
          )
      )
      'version' => 2
  )

 /var/www/tests/phpunit/includes/abstract-testcase.php:1006
 /var/www/tests/phpunit/tests/theme/wpThemeJson.php:1800
 phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:51
 /var/www/vendor/bin/phpunit:118

 3)
 Tests_Theme_wpThemeJson::test_remove_insecure_properties_removes_unsafe_preset_settings
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
                      0 => Array (
 -                        'name' => 'Pink'
 -                        'slug' => 'pink'
 -                        'color' => '#FFC0CB'
 +                        'name' => 'Blue'
 +                        'slug' => 'blue'
 +                        'color' => 'var(--color, var(--unsafe-fallback))'
                      )
 +                    1 => Array (...)
 @@ @@
                      0 => Array (...)
 +                    1 => Array (...)
 @@ @@
                              0 => Array (
 -                                'name' => 'Pink'
 -                                'slug' => 'pink'
 -                                'color' => '#FFC0CB'
 +                                'name' => 'Blue'
 +                                'slug' => 'blue'
 +                                'color' => 'var(--color, var(--unsafe--
 fallback))'
                              )
 +                            1 => Array (...)
                          )
                      )
                  )
              )
          )
      )
      'version' => 2
  )

 /var/www/tests/phpunit/includes/abstract-testcase.php:1006
 /var/www/tests/phpunit/tests/theme/wpThemeJson.php:2059
 phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:51
 /var/www/vendor/bin/phpunit:118
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55966#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list