Loading
Declare read_group as the parent permission of GroupStats
What does this MR do and why?
GroupStats skips granular token authorization with parent_authorizes, but names no permission, so it is still listed in authorization_todo.txt. It now declares parent_authorizes: :read_group and leaves the list. This follows !269587 (merged), which authorized GroupReleaseStats.
Why read_group and not read_release:
Group.statsis its only parent, andGroupchecksread_group, so no token gains or loses data.- Its only field,
releaseStats, returnsGroupReleaseStats, which checksread_releaseon the group itself since that MR. Declaringread_releaseonGroupStatswould hidestatsfrom a token that reads the group but not its releases. The example 'denying a granular token that only authorizes the parent of a field' inee/spec/requests/api/graphql/group/release_stats_spec.rbalready expectsgroup.statswithread_groupalone.
It also pins the directive in the type spec, and updates a comment in group_query_spec.rb that still said releaseStats was not authorized.
References
Related to #639319
Related to #593878
I found this while working on gitlab-mcp-server.
Screenshots or screen recordings
No UI change.
How to set up and validate locally
bundle exec rake gitlab:permissions:validatepasses. With master'sgroup_stats_type.rband this todo list, it listsGroupStatsas a type that declares no permission.bundle exec rspec ee/spec/graphql/types/group_stats_type_spec.rb ee/spec/requests/api/graphql/group_query_spec.rb ee/spec/requests/api/graphql/group/release_stats_spec.rbpasses.
Checks I ran (Ruby 3.3.11)
- The type spec,
group_query_spec.rb,release_stats_spec.rband theGroupReleaseStatstype spec: 51 examples, 0 failures, 1 pending. - With master's
group_stats_type.rb, the same specs: 51 examples, 1 failure, the new type spec example. gitlab:permissions:validate, RuboCop, the commit linter and Danger's linters pass; bothcompile_docstasks leave the committed docs unchanged.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.