Bug 1381417

Summary: Username doesn't render correctly if it has symbols.
Product: OpenShift Container Platform Reporter: Ian Lawson <ian.lawson>
Component: apiserver-authAssignee: Dan Mace <dmace>
Status: CLOSED CURRENTRELEASE QA Contact: Li Zhe <zhezli>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: abhgupta, aos-bugs, bingli, ian.lawson, jliggitt, jokerman, mmccomas, wsun, yufchang
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-16 22:11:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ian Lawson 2016-10-04 04:16:17 UTC
Description of problem:

Username in dev-preview-staging does not render correctly if username (from GitHub) contains non-Alphanumeric characters (i.e. ' )

Version-Release number of selected component (if applicable):

Pre-release dev staging Openshift Online

How reproducible:

Change name at GitHub (not account name) to Firstname 'Nickname' Secondname


Steps to Reproduce:
1. Change name at GitHub
2. Log onto Openshift Online dev staging

Actual results:

Name is rendered as Firstname &#39;Nickname&#39; Secondname

Expected results:

Name should be rendered as Firstname 'Nickname' Secondname

Additional info:

Comment 1 Jessica Forrester 2016-10-04 13:12:27 UTC
If I log into an origin server with a user that has ' characters in their name then it works fine.  I suspect this is something specifically related to the github integration. Can you open the developer tools for your browser, log out and log back in and look for the request that looks like https://<server>/oapi/v1/users/~  particularly interested in the content of the metadata.name field

Comment 2 Jordan Liggitt 2016-10-04 14:00:54 UTC
Can you also do this query against github and include the results:

curl https://api.github.com/users/$username

Comment 3 Jordan Liggitt 2016-10-04 14:06:49 UTC
If I edit my github user:

$ curl https://api.github.com/users/liggitt

{
  "login": "liggitt",
  ...
  "name": "Jordan 'T' Liggitt",
}


and log in, I get this as expected:

$ oc get user/~

apiVersion: v1
items:
- apiVersion: v1
  fullName: Jordan 'T' Liggitt
  ...

and the web console shows my name with single quotes, as expected

Comment 4 Ian Lawson 2016-10-05 10:01:27 UTC
The github user comes back correctly:
{
  "login": "utherp0",
  ...
  "name": "Ian 'Uther' Lawson",
}

However, when I login I get:

Ians-MacBook-Pro:hub uther$ oc get user/~
NAME      UID                                    FULL NAME                    IDENTITIES
utherp0   cc341dae-86f6-11e6-97f9-0eaa067b1713   Ian &#39;Uther&#39; Lawson   github:2233236

Web console shows html encoded characters still....

Comment 5 Jessica Forrester 2016-10-05 12:54:00 UTC
If its coming back that way from user/~ then this is not a web console bug.

Comment 6 Dan Mace 2016-10-05 13:16:50 UTC
https://github.com/openshift/online/pull/525

Comment 8 Dan Mace 2016-10-13 14:08:11 UTC
Fixed in oso-reconciler-docker-v3.3.0.0-4

Comment 9 Li Zhe 2016-10-14 10:26:15 UTC
I try to change my name on Github, it seems that it does not make sense. The name showed on web console and get by 'oc get users/~' is still old one. 
And I registered a new Github account with has symbols in its name. After login Openshift, the same problem still exists.

$ curl https://api.github.com/users/lizhe103
{
....
 "name": "li 'zhe';; li?/&",
...
}
on STG env: 
$ oc get users/~
NAME       UID                                    FULL NAME                      IDENTITIES
lizhe103   ****   li &#39;zhe&#39;;; li?/&amp;   *****
on INT env:
$ oc get users/~
NAME       UID                                    FULL NAME                      IDENTITIES
lizhe103   ****   li &#39;zhe&#39;;; li?/&amp;   *****
Showed on web console:
li &#39;zhe&#39;;; li?/&amp;

Comment 11 Bing Li 2016-10-18 06:43:22 UTC
@Dan, Thanks for your explanation! we will verify this bug once the image v3.3.0.0-4 is deployed to online.