Skip to content

[Graph Api] Normal user not authorized to get their assigned role  #5583

Closed

Description

@amrita-shrestha

Describe the bug

Normal users ( user with role User, Guest, SpaceAdmin) are not authorized to get their assigned roles. Only admin user can get their assigned role.

Steps to reproduce

Steps to reproduce the behavior:

  1. create user rosy with role User
  2. do API request to get assign role
    curl -vk -X GET -u rosy:rosy https://localhost:9200/graph/v1.0/users/05e63eb1-d2e3-40b5-966e-97e0cbe22dd8/appRoleAssignments
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Content-Length: 158
< Content-Type: application/json; charset=utf-8
< Date: Thu, 16 Feb 2023 04:39:01 GMT
< X-Graph-Version: 2.0.0+92923f680
< 
{ [158 bytes data]
100   158  100   158    0     0   1961      0 --:--:-- --:--:-- --:--:--  1975
* Connection #0 to host localhost left intact
{
   "error" : {
      "code" : "accessDenied",
      "innererror" : {
         "date" : "2023-02-16T04:39:01Z",
         "request-id" : "amrita-OptiPlex-3050/VTXGkwheNT-001625"
      },
      "message" : "Unauthorized"
   }
}
  1. change user role to Admin
< HTTP/1.1 200 OK
< Content-Length: 285
< Content-Type: application/json; charset=utf-8
< Date: Thu, 16 Feb 2023 04:39:36 GMT
< X-Graph-Version: 2.0.0+92923f680
< 
{ [285 bytes data]
100   285  100   285    0     0   3682      0 --:--:-- --:--:-- --:--:--  3701
* Connection #0 to host localhost left intact
{
   "value" : [
      {
         "appRoleId" : "71881883-1768-46bd-a24d-a356a2afdf7f",
         "id" : "b6c26c6c-24a5-4160-99df-c6a728d85c55",
         "principalId" : "05e5d2ec-31d6-48e3-9d6c-730a67b98b20",
         "principalType" : "User",
         "resourceDisplayName" : "ownCloud Infinite Scale",
         "resourceId" : "4ac207ac-3a4b-4aa3-993d-2f33ca29d215"
      }
   ]
}

Question

  • Is this expected behavior?

Actual behavior

only user with the role Admin can get assign role

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

Details

OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

Activity

  1. changed the title [-]Normal user not authorized to get their assigned role [/-] [+][Graph Api] Normal user not authorized to get their assigned role [/+] on Feb 16, 2023
  2. kulmann commented on Feb 16, 2023

    @kulmann
    Contributor

    Question, why would you expect to be able to retrieve the assigned role of the user?

    The user that you can retrieve via graph should contain the role.

  3. amrita-shrestha commented on Feb 16, 2023

    @amrita-shrestha
    ContributorAuthor

    @kulmann my question
    /graph/v1.0/users/<id>/appRoleAssignments is this admin endpoint? Do only admin can access this endpoint?

    Is it the design that the user with role like User, SpaceAdmin, Guest can GET to his/her assigned role ?
    If yes, through which api endpoint can a normal user can know his/her app role
    In setting api we have https://host.docker.internal:9200/api/v0/settings/roles-listthrough which user get their assigned role

  4. kulmann commented on Feb 16, 2023

    @kulmann
    Contributor

    @amrita-shrestha

    I don't know how the endpoint is secured in the backend, but at least I can tell you that the endpoint is not relevant for a non-admin user. IMO it should only be available to admins.

    At the moment the settings api is used to get the role of the user (like you mentioned it). As soon as web transitioned to the new permissions endpoint we will not fetch the role of the logged in user anymore in web.

    That's why I wanted to know what you plan to do with the role. An API test for just checking the role of the logged in user is not needed.

  5. amrita-shrestha commented on Feb 16, 2023

    @amrita-shrestha
    ContributorAuthor

    @kulmann thank you for the information. So that means closing this issue will be OK.

  6. v-scharf commented on Feb 16, 2023

    @v-scharf
    Contributor

    I discus also with @C0rby about it. Behavior is expect. endpoint was implemented only for admin user. we can close issue

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