Problem/Motivation

In hybridauth_username_alter() we replace user name with values from hybridauth.
But in documentation for format_username():

* @return
* An unsanitized string with the username to display. The code receiving
* this result must ensure that check_plain() is called on it before it is
* printed to the page.

We should not sanitized user name in hybridauth_username_alter().
Example:
On user edit page
Example of issue

firstName: Shaquille
lastName: O'Neal

# displayed value
<title>Shaquille O&amp;#039;Neal | Sitename</title>
# expected displayed value
<title>Shaquille O&#039;Neal | Sitename</title>

Proposed resolution

Disable sanitize for token_replace().
I am not sure if we also should remove strip_tags(), will leave it as is.

$name = trim(strip_tags($hybridauth_name));

Result:

Example of issue after patch

Comments

zniki.ru created an issue. See original summary.

nikolay shapovalov’s picture

Assigned: nikolay shapovalov » Unassigned
Status: Active » Needs review
StatusFileSize
new691 bytes

Patch attached.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Thank you! Yes, this absolutely makes sense to prevent double escaping.

  • duozersk committed 72cb324 on 7.x-2.x authored by zniki.ru
    Issue #3292639 by zniki.ru, klausi, duozersk: Prevent user name double...
duozersk’s picture

Status: Reviewed & tested by the community » Fixed

Nikolay, Klaus,

Thank you for the contribution. Committed to 7.x-2.x.

AndyB

Status: Fixed » Closed (fixed)

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