Update sharepoint connector to work with less permissions #1294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The SharePoint connector currently requires an excessive amount of permissions to function effectively. Specifically, the Sites.FullControl.All permission level is not acceptable for most companies, as it grants the Service Principal unrestricted access to all sites. Even the Sites.ReadAll permission level is not ideal, as it allows access to all company sites.
To address this issue, this pull request introduces changes that avoid scanning all sites when a specific site has been defined. By doing so, the Service Principal only requires Sites.Selected permissions and can be added to the site's Access Control List as a read-only user. This approach aligns with the best practice of least privilege.
I have also modified the way a site is defined. Instead of just the site name, the URL is now required because I was unable to find a way to obtain the root URL with the restricted permissions.