-
Notifications
You must be signed in to change notification settings - Fork 0
Restrict Query.users field to admin users and add Query.user field #685
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Knerio <96529060+Knerio@users.noreply.github.com>
|
@copilot Is there even a user query via id? |
Co-authored-by: Knerio <96529060+Knerio@users.noreply.github.com>
Yes, users can be queried by ID using the query {
node(id: "gid://sagittarius/User/123") {
... on User {
id
username
}
}
}This works because Additionally, I've updated the error handling to use |
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2160720545 Status: Passed Job summariesrspec: [ee]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12100941356/artifacts/tmp/coverage/index.html rspec: [ce]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12100941355/artifacts/tmp/coverage/index.html rubocop667 files inspected, no offenses detected |
|
@copilot Add a seperate query to query users and use that, node is for something else, because its not working |
Co-authored-by: Knerio <96529060+Knerio@users.noreply.github.com>
Added a dedicated query {
user(id: "gid://sagittarius/User/123") {
id
username
}
}The field follows the same pattern as |
|
I will need to look into it why it fails |
The
Query.usersfield returned all users without authorization. Per issue comments, this should be restricted to admins while preserving the ability to query individual users by ID through a dedicateduserquery field.Changes
list_usersability to admin-only policy blockGraphQL::UnauthorizedErrorfor non-admin usersusersquery and the newuser(id:)queryAuthorization Matrix
Example
Error Handling
Uses
GraphQL::UnauthorizedErrorinstead ofGraphQL::ExecutionErrorto provide consistent authorization error structure across the GraphQL API, matching the error handling pattern used in mutations and other authorization failures.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.