Skip to content

Hubsite REST API is not consistent for user with read permissions #4276

@sebastienlevert

Description

@sebastienlevert

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

When calling the Hubsite REST API with the GetById method, I should be able to get information about the hub if I have access anywhere within it.

Observed Behavior

Behaviors change between tenants but the following behavior is seen on multiple tenants right now.

When requesting a hub with a hubsiteid that exists and should work, we get an access denied error :

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <m:code>-2147024891, System.UnauthorizedAccessException</m:code>
    <m:message xml:lang="en-US">
        Access denied. You do not have permission to perform this action or access this resource.
    </m:message>
</m:error>

I believe this resource should always return data if the connected user has access to any site that is associated to the hub.

Steps to Reproduce

  1. Create a new site
  2. Register it as a hub
  3. Add a reader accounts to the root of the hub
  4. Connect to the site with the reader account
  5. Run the following REST call in your browser https://tenant.sharepoint.com/_api/HubSites/GetById?hubSiteId='f93eff08-5806-499c-92db-38800eefbe44'

On some tenants this will work all the time, some tenants will have different behavior based on the hub (nothing different between hubs) and some tenants will never work.

I also validated that no "specific" rights were assigned to "join" a hub on those hubs (for example, using the Grant-PnPHubsiteRights Cmdlet.

Discussion

I'm about to thing that this API should not be public as I can update the hub using the GetById method (which seems... weird?) and could also expose data to readers that they should not see (the ACLs of which users / groups can or cannot create sites joined to the hub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APIstatus:to-be-reviewedIssue needs to be reviewed by Microsoft for additional follow up / review.type:archive-old-issueIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions