Skip to content

Extend MinimalPermissionsGuidancePlugin with scopes to ignore #1365

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

bartizan
Copy link
Contributor

@bartizan bartizan marked this pull request as ready for review August 14, 2025 15:36
@bartizan bartizan requested a review from a team as a code owner August 14, 2025 15:36
Copy link
Collaborator

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Let's do some changes before we proceed. Since quite a few things changed, I'll have a more thorough look at it in the week of Aug 25. For the future, let's keep PRs focused on the issue at hand and avoid unrelated refactorings. If you see room for improvement, please raise an issue so that we can discuss it first 🙂

@@ -8,6 +8,14 @@
},
"apiSpecsFolderPath": {
"type": "string"
},
"permissionsToExclude": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're just adding this property, we can't update previous versions schemas because the property isn't available there. Let's only add it to the latest version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -96,4 +101,57 @@ internal async Task<IEnumerable<string>> UpdateUserScopesAsync(IEnumerable<strin

return newMinimalScopes;
}

public static MethodAndUrl GetMethodAndUrl(string methodAndUrlString)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't need to be public. Let's make it internal instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return new(Method: info[0], Url: info[1]);
}

public static string GetTokenizedUrl(string absoluteUrl)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't need to be public. Let's make it internal instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return "/" + string.Concat(new Uri(sanitizedUrl).Segments.Skip(2).Select(Uri.UnescapeDataString));
}

public static MethodAndUrl[] GetRequestsFromBatch(string batchBody, string graphVersion, string graphHostName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't need to be public. Let's make it internal instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -96,4 +101,57 @@ internal async Task<IEnumerable<string>> UpdateUserScopesAsync(IEnumerable<strin

return newMinimalScopes;
}

public static MethodAndUrl GetMethodAndUrl(string methodAndUrlString)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method isn't related to Graph so let's find a better place for it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to MethodAndUrlUtils.
(the method is consumed by graph plugings)

@bartizan
Copy link
Contributor Author

For the future, let's keep PRs focused on the issue at hand and avoid unrelated refactorings. If you see room for improvement, please raise an issue so that we can discuss it first 🙂

At the beginning it seemed like we needed those changes for Graph-related classes.
But I am okay to cut the unrelated refactorings off the PR to keep it clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants