See https://www.drupal.org/SA-CORE-2014-003

Patch from D7:

diff --git a/includes/form.inc b/includes/form.inc
index 846bcb5..3840885 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -2722,7 +2722,7 @@ function form_select_options($element, $choices = NULL) {
   $options = '';
   foreach ($choices as $key => $choice) {
     if (is_array($choice)) {
-      $options .= '<optgroup label="' . $key . '">';
+      $options .= '<optgroup label="' . check_plain($key) . '">';
       $options .= form_select_options($element, $choice);
       $options .= '</optgroup>';
     }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klausi’s picture

longwave’s picture

Status: Active » Needs review
FileSize
546 bytes
larowlan’s picture

Status: Needs review » Reviewed & tested by the community

assuming bot agrees

klausi’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

I know there is not test case in D7, but we should do it properly here.

longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
2.33 KB
1.79 KB
larowlan’s picture

Status: Needs review » Reviewed & tested by the community

thanks

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: 2304965-optgroup-xss-FAIL.patch, failed testing.

klausi’s picture

Status: Needs work » Reviewed & tested by the community

Failed as expected, back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed c05668e and pushed to 8.x. Thanks!

  • alexpott committed c05668e on 8.x
    Issue #2304965 by longwave | klausi: Fixed Port form_select_options()...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.