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

User Id "0" issues #28406

Closed
phil-davis opened this issue Jul 17, 2017 · 7 comments
Closed

User Id "0" issues #28406

phil-davis opened this issue Jul 17, 2017 · 7 comments

Comments

@phil-davis
Copy link
Contributor

Steps to reproduce

  1. Add a user with user id "0"
  2. Login as "0"
  3. Try to share a file

Expected behaviour

The share panel opens and lets you share the file

Actual behaviour

An error, "Problem loading page, reloading in 5 seconds".
The sharing panel does not display.

Server configuration

Any I expect (was on current master on a dev VM)

Client configuration

Browser:
Firefox
Operating system:
Ubuntu

Logs

ownCloud log (data/owncloud.log)

NetworkError: 401 Unauthorized - http://localhost:8080/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2F%27single%27quotes&reshares=true"

Some code that checks the supplied username+password when accessing this area of the API is failing when supplied with "0" for the user id. (Other file operations like create/rename/delete are working)

There are places in lib/private/user/Session.php that do stuff like:

if (!empty($request->server['PHP_AUTH_USER']) && ...

which will not do the expected code when the user is "0".

And possibly quite a few other places where the user id is used and checked.

@phil-davis phil-davis mentioned this issue Jul 17, 2017
9 tasks
@phil-davis
Copy link
Contributor Author

I came across this because I was testing the case when the user id is a string of digits "123". That seems to work, and I guess there are installations out there that will use an integer as a user id (maybe a University that uses a student number directly as the user id? or...)

I tried "0" and it has problems - which will be due to the pain of empty("0") === true in PHP and similar.

Actually should "0" just be declared not a valid user id (reject it when adding a user)?

@hodyroff
Copy link
Contributor

should be fixed - if not too difficult.

@PVince81 PVince81 added Type:Bug p3-medium Normal priority labels Sep 7, 2017
@PVince81
Copy link
Contributor

PVince81 commented Sep 7, 2017

yeah, we need to find all of those places anyway... we're already trying to avoid such problems in new code but there is likely old code still doing the checks wrong... thank you PHP for empty('0') === true ...

@phil-davis
Copy link
Contributor Author

#29198 requires usernames to be 3 or more chars. So that would "fix" (=workaround) this particular issue.

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

@phil-davis
Copy link
Contributor Author

Username cannot be "0" any more. So the particular issue reported here is avoided. Leaving closed.

@felixboehm felixboehm removed this from the triage milestone Apr 10, 2018
@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants