Skip to content

User Id "0" issues #28406

Closed
Closed

Description

@phil-davis

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.

Activity

  1. phil-davis commented on Jul 17, 2017

    @phil-davis
    ContributorAuthor

    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)?

  2. hodyroff commented on Jul 18, 2017

    @hodyroff

    should be fixed - if not too difficult.

  3. PVince81 commented on Sep 7, 2017

    @PVince81
    Contributor

    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 ...

  4. added this to the triage milestone on Sep 7, 2017
  5. phil-davis commented on Oct 10, 2017

    @phil-davis
    ContributorAuthor

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

  6. ownclouders commented on Dec 19, 2017

    @ownclouders
    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.

  7. phil-davis commented on Dec 20, 2017

    @phil-davis
    ContributorAuthor

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

  8. removed this from the triage milestone on Apr 10, 2018
  9. lock commented on Jul 30, 2019

    @lock

    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.

  10. locked as resolved and limited conversation to collaborators on Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions