Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Che doesn't sanitize usernames when creating per-user namespaces/projects #15899

Closed
3 of 13 tasks
johnmcollier opened this issue Jan 31, 2020 · 2 comments
Closed
3 of 13 tasks
Labels
kind/bug Outline of a bug - must adhere to the bug report template.

Comments

@johnmcollier
Copy link
Contributor

johnmcollier commented Jan 31, 2020

Describe the bug

I've deployed Eclipse Che on OpenShift 3.11 on IBM Cloud, with openShiftoAuth: true. The accounts on my cluster are of the form: iam#<users-email-address> (e.g. iam#john@ibm.com).

When I go to create a workspace, I get the following error in Che:

Error: Failed to get the workspace: "Workspace with id 'iam' doesn't exist"

If I try to manually run the failed workspace, the following error will show in my browser:

Failure executing: POST at: https://172.21.0.1/apis/project.openshift.io/v1/projectrequests.
Message: ProjectRequest.project.openshift.io "iam#some-name@email.com-che" is invalid:
metadata.name: Invalid value: "iam#some-name@email.com-che": a DNS-1123 label must consist
of lower case alphanumeric characters or '-', and must start and end with an alphanumeric
character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a
z0-9])?'). Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes
[StatusCause(field=metadata.name, message=Invalid value: "iam#some-name@email.com-che":
a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and
end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a
z0-9]([-a-z0-9]*[a-z0-9])?'), reason=FieldValueInvalid, additionalProperties={})],
group=project.openshift.io, kind=ProjectRequest, name=iam#some-name@email.com-che,
retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status,
message=ProjectRequest.project.openshift.io "iam#some-name@email.com-che" is invalid:
metadata.name: Invalid value: "iam#some-name@email.com-che": a DNS-1123 label must consist
of lower case alphanumeric characters or '-', and must start and end with an alphanumeric
character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a
z0-9])?'), metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null,
additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).

It looks like the ProjectRequest resource is complaining about the invalid characters in my cluster account's username. Would it be possible to sanitize the username before creating the per-user namespace/project?

Che version

  • latest
  • nightly
  • other: please specify

Steps to reproduce

  1. Deploy Che on OpenShift on IBM Cloud, with Che configured to use OpenShift oAuth
    • Alternatively, just deploy Che on a cluster where the usernames contain characters like # or @
  2. Try to create a workspace.
  3. Workspace start will fail due to the errors I posted above

Expected behavior

Workspace start succeeds regardless of what my username is

Runtime

  • kubernetes (include output of kubectl version)
  • Openshift (include output of oc version)
  • minikube (include output of minikube version and kubectl version)
  • minishift (include output of minishift version and oc version)
  • docker-desktop + K8S (include output of docker version and kubectl version)
  • other: (please specify)

Screenshots

Installation method

  • chectl
  • che-operator
  • minishift-addon
  • I don't know
@johnmcollier johnmcollier added the kind/bug Outline of a bug - must adhere to the bug report template. label Jan 31, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Jan 31, 2020
@skabashnyuk
Copy link
Contributor

Hello @johnmcollier . Thanks for this report. This issue probably duplicate #15323

@johnmcollier
Copy link
Contributor Author

@skabashnyuk Yup, you're right! Let me close this issue then.

@amisevsk amisevsk removed the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

No branches or pull requests

4 participants