Disallow anonymous / unauthenticated GraphQL queries
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
There is currently no config variable to permanently disable graphQL for unauthenticated queries. GraphQL allows unauthorized access to whole bunch of info, so would be nice to be able to disable it without messing with gitlab sources.
Steps to reproduce
Install gitlab, run any graphQL command that exposes server info to users that do not have login, enjoy!
Example Project
N/A
What is the current bug behavior?
Remote attacker is able to run GraphQL queries on private gitlab-CE server without ANY auth.
What is the expected correct behavior?
GraphQL should require auth to run queries in form of API keys.
Relevant logs and/or screenshots
Any public server is vulnerable
https://gitlab.com/-/graphql-explorer
Output of checks
N/A
Results of GitLab environment info
Applicable in any gitlab installation (including gitlab.com)
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.16.1 ? ... OK (13.16.1) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 6/5 ... yes 15/7 ... yes 16/8 ... yes 15/9 ... yes 14/11 ... yes 15/15 ... yes 15/17 ... yes 70/18 ... yes 20/19 ... yes 20/20 ... yes 20/21 ... yes 20/23 ... yes 21/24 ... yes 70/25 ... yes 20/26 ... yes 70/27 ... yes 70/28 ... yes 23/29 ... yes 70/35 ... yes 21/37 ... yes 23/38 ... yes 70/40 ... yes 20/41 ... yes 20/42 ... yes 14/44 ... yes 70/46 ... yes 14/48 ... yes 23/49 ... yes 23/50 ... yes 6/51 ... yes 71/52 ... yes 39/53 ... yes 47/55 ... yes 16/56 ... yes 47/57 ... yes 16/58 ... yes 28/61 ... yes 6/62 ... yes 6/63 ... yes 58/64 ... yes 6/65 ... yes 15/66 ... yes 23/68 ... yes 39/71 ... yes 28/72 ... yes 71/73 ... yes 70/74 ... yes 25/76 ... yes 55/77 ... yes 16/78 ... yes 16/81 ... yes 6/82 ... yes 72/83 ... yes 72/84 ... yes 25/85 ... yes 23/86 ... yes 76/87 ... yes 16/88 ... yes 78/89 ... yes 82/90 ... yes 15/93 ... yes 92/94 ... yes 20/95 ... yes 82/97 ... yes 82/98 ... yes 82/99 ... yes 82/100 ... yes 71/101 ... yes 16/103 ... yes 82/104 ... yes 16/105 ... yes 82/106 ... yes 82/107 ... yes 25/108 ... yes 20/109 ... yes 25/110 ... yes 112/111 ... yes 112/112 ... yes 20/114 ... yes 20/115 ... yes 123/116 ... yes 23/117 ... yes 23/118 ... yes 23/119 ... yes 106/121 ... yes 23/122 ... yes 123/123 ... yes 25/124 ... yes 82/125 ... yes 129/126 ... yes 134/127 ... yes 123/128 ... yes 129/129 ... yes 15/130 ... yes 134/131 ... yes 139/132 ... yes 142/133 ... yes 141/136 ... yes 15/137 ... yes 123/138 ... yes 15/139 ... yes 36/140 ... yes 36/141 ... yes 36/142 ... yes 20/144 ... yes 20/145 ... yes 15/149 ... yes 151/150 ... yes 152/151 ... yes 152/152 ... yes 112/153 ... yes 154/154 ... yes 154/157 ... yes 23/158 ... yes 20/159 ... yes 139/160 ... yes 141/161 ... yes 154/162 ... yes 25/163 ... yes 20/164 ... yes 20/165 ... yes 15/166 ... yes 67/168 ... yes 143/169 ... yes 82/170 ... yes 18/171 ... yes 143/172 ... yes 25/173 ... yes 25/174 ... yes 25/175 ... yes 25/177 ... yes 25/178 ... yes 15/179 ... yes 82/180 ... yes 82/181 ... yes 112/182 ... yes 20/183 ... yes 25/184 ... yes 123/185 ... yes 82/186 ... yes 25/187 ... yes 18/188 ... yes 18/189 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.29.0 ? ... yes (2.29.0) Git user has default SSH configuration? ... yes Active users: ... 56 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
Add relevant config options to gitlab.rb