Problem/Motivation

There are several potential problems when variables are put onto the screen:

  • You miss to escape it in the first place
  • You escape it twice

The code

      // Switch the title on a per-service basis if required.
      // $mtitle = $mtitle;.
      switch ($service_code_name) {
        case 'twitter':
          $mtitle = empty($data_options['twitter_suffix']) ? $mtitle : Html::escape($mtitle) . ' ' . Html::escape($data_options['twitter_suffix']);
          break;
      }

seems to escape in one case, but not in the other.

In other words, we maybe have no escaping (a potential security problem) or double escaping, which deals to annoying " quotes.

Proposed resolution

  • Validate by putting some simple JS into these title, whether the Drupal Attribute functionality escapes automatically
  • In case it doesn't, the first condition in the code above needs to be escaped
  • Otherwise the other escapes might be redundant

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

naveenvalecha’s picture

Greg Boggs’s picture

I believe since these come from an options element, you can't submit JavaScript in these fields. So, I think it's impossible to put HTML in and you don't really need the escapes, but I am not certain. So, here's a patch with consistent escapes to play it safe.

Greg Boggs’s picture

Status: Active » Needs review
naveenvalecha’s picture

Status: Needs review » Fixed

Fair enough. Committed and pushed to 8.x-2.x

Status: Fixed » Closed (fixed)

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