Skip to content
Info disclosure Disclosed report Beginner

GraphQL query "namespace" leaks data

The GraphQL namespace query returned private profile and secret group data without authentication, bypassing the intended privacy controls. An attacker could retrieve descriptions and project lists that were otherwise inaccessible.

rpadovani Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Triaged in 4 days
  • Fixed in 27 days
  • Paid in 27 days
  • Disclosed after 6 months

NOTE! Thanks for submitting a report! Please replace all the (parenthesized) sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!

Summary

Using the "namespace" query on Graphql you can retrieve some private data that is not available through Standard API or through Web API

Steps to reproduce

User namespace

  1. My Gitlab profile is private: https://gitlab.com/rpadovani
  2. You cannot access a list of my projects: https://gitlab.com/users/rpadovani/contributed
  3. You cannot access these data through the standard APIs:
curl --header "PRIVATE-TOKEN: anotherUserToken" 'https://gitlab.com/api/v4/namespaces/16048'
{"message":"404 Namespace Not Found"}

(rpadovani user id is 16048, I used access token of another user for this curl request) 4. You can however access all these data, without any token (so no need to be registered), through Graphql:

curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"rpadovani\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}' 

Response (omitted other 19 projects for brevity):

{"data":{"namespace":{"description":"","requestAccessEnabled":true,"fullName":"rpadovani","fullPath":"rpadovani","id":"gid://gitlab/Namespace/18021","lfsEnabled":true,"name":"rpadovani","path":"rpadovani","visibility":"public","projects":{"edges":[{"node":{"id":"gid://gitlab/Project/11265641","name":"737-max-8","archived":false,"visibility":"public","description":"https://737max8.com"}}, ...OMIT...     

Group namespace

A Graphql query on a secret group / subgroup can bring to disclose the description of the group

  1. No access from GUI: https://gitlab.com/secret-group-213
  2. Access through GraphQL (please notice I do not provide any access token, at all):
curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"secret-group-213\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}'

Response:

{"data":{"namespace":{"description":"This description is secret!","requestAccessEnabled":false,"fullName":"secret group","fullPath":"secret-group-213","id":"gid://gitlab/Group/5337756","lfsEnabled":true,"name":"secret group","path":"secret-group-213","visibility":"private","projects":{"edges":[]}}}}

Impact

This Graphql query makes the private profile feature quite useless, and leaks the description and some other information about private groups and subgroups.

The impact is limited because the GraphQL implementation is still at the beginning, I think that the impact of this issue would be bigger, if the GraphQL implementation was au-pair with the APIs implementation

Examples

(If the bug is project related, please create an example project and export it using the project export feature)

(If you are using an older version of GitLab, this will also help determine whether the bug has been fixed in a more recent version)

(If the bug can be reproduced on GitLab.com without violating the Rules of Engagement as outlined in the program policy, please provide the full path to the project.)

What is the current bug behavior?

Access data that shouldn't be accessed

What is the expected correct behavior?

empty response

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Impact

An attacker can bypass the "private profile" check, and can access metadata about secret groups

The original report as published on HackerOne, by rpadovani. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

GitLab exposes a GraphQL endpoint at https://gitlab.com/api/graphql alongside its REST APIs (v4). Two features are relevant here: the private profile setting, which hides a user's profile page and the list of projects they contribute to, and private groups, whose pages are not reachable without membership. The report shows that the GraphQL namespace query returns metadata about both kinds of object without enforcing those visibility rules.

Setup

The researcher used their own GitLab.com account, rpadovani, with a private profile, and the access token of another user to demonstrate that the REST API refuses the request. No special role is needed for the attack itself: the GraphQL requests in the report carry no token at all, so an unauthenticated visitor is enough. The only tool shown is curl.

Finding it

The starting point was the observation that the same data is protected in one place and exposed in another. The profile page and the contributed-projects page are blocked, and the REST namespaces endpoint returns a 404 for another user's token. The GraphQL namespace query, given the same namespace path, returns the namespace object and its projects. The researcher also found that a private group's page is not accessible in the GUI, yet its description comes back through the same query.

Exploitation

Step 1: confirm the profile is private

The researcher's profile is private at https://gitlab.com/rpadovani, and the contributed-projects listing at https://gitlab.com/users/rpadovani/contributed is not accessible. This establishes the expected behaviour: the data should not be reachable.

Step 2: confirm the REST API refuses the data

Using the access token of a different user, the namespaces endpoint returns a 404:

Bash
curl --header "PRIVATE-TOKEN: anotherUserToken" 'https://gitlab.com/api/v4/namespaces/16048'
{"message":"404 Namespace Not Found"}

The numeric id 16048 is the user id of rpadovani, and the token belongs to another account. The REST layer returns a 404 for that caller, while the web pages and GraphQL behave differently.

Step 3: retrieve the same data through GraphQL without a token

The GraphQL endpoint accepts a namespace query keyed on fullPath. The request below sends no authentication header of any kind:

Bash
curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"rpadovani\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}'

The query asks for the namespace's description, requestAccessEnabled, fullName, fullPath, id, lfsEnabled, name, path and visibility, plus a projects connection with includeSubgroups: true returning each project's id, name, archived, visibility and description. The response (with 19 further projects omitted for brevity) is:

Text
{"data":{"namespace":{"description":"","requestAccessEnabled":true,"fullName":"rpadovani","fullPath":"rpadovani","id":"gid://gitlab/Namespace/18021","lfsEnabled":true,"name":"rpadovani","path":"rpadovani","visibility":"public","projects":{"edges":[{"node":{"id":"gid://gitlab/Project/11265641","name":"737-max-8","archived":false,"visibility":"public","description":"https://737max8.com"}}, ...OMIT...

The private profile's namespace and its project list are returned to an anonymous caller, which is exactly what the REST API and the web pages deny.

Step 4: read the description of a private group

The same query works against a private group. The group page at https://gitlab.com/secret-group-213 is not accessible through the GUI, yet the following unauthenticated request returns its metadata:

Bash
curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"secret-group-213\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}'

The response:

Text
{"data":{"namespace":{"description":"This description is secret!","requestAccessEnabled":false,"fullName":"secret group","fullPath":"secret-group-213","id":"gid://gitlab/Group/5337756","lfsEnabled":true,"name":"secret group","path":"secret-group-213","visibility":"private","projects":{"edges":[]}}}}

The group's description is disclosed even though visibility is private. The projects connection is empty in this case, so the leak here is the group metadata rather than its project list.

Root cause

The namespace query returns the namespace object and its fields even though the REST API and the web UI deny the same data. The report does not include the code, so the precise location of the missing authorisation check is not shown; the behaviour is consistent with the GraphQL layer not reusing the same policy as the REST endpoints. The researcher notes that the GraphQL implementation was still at an early stage.

Impact

An unauthenticated attacker can bypass the private profile check and read metadata about private groups and subgroups, including the group description. The researcher describes the private profile feature as being made "quite useless" by this query. The impact is bounded: the GraphQL implementation was still at the beginning, and the researcher expects the impact to be larger once GraphQL reaches parity with the REST API.

Fix

The report does not describe the fix that was applied. The expected behaviour stated in the report is an empty response for namespaces the caller is not allowed to see, so the fix should be to enforce the same visibility rules on the namespace resolver as on the REST namespaces endpoint and the web pages.

Variants to test

  1. Other GraphQL resolvers that take a path or id. Query objects such as projects, groups or users by fullPath or global id without a token. A positive result is metadata for an object whose page or REST endpoint returns 404 or 403 to the same caller.
  2. Nested connections. Ask for projects, members or other connections under a namespace the caller cannot see. A positive result is a non-empty connection where the REST equivalent is empty or refused.
  3. Field-level differences. Request individual fields such as description on a private object. A positive result is a field populated in GraphQL but absent from the REST representation for the same caller.
  4. Authenticated low-privilege callers. Repeat the queries with a token from an unrelated account. A positive result is data that the REST API refuses for that same token, as in the 404 Namespace Not Found response above.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

GitLab is a website where people store and share code projects. Every person and every group of people on GitLab has a page, and GitLab lets you decide whether that page is public or private. If you set your profile to private, strangers should not be able to see your page or the list of projects you work on. If you make a group private, only its members should be able to see it.

GitLab offers two different ways for programs to talk to it, rather than a person clicking around in a browser. One is called the REST API and the other is called GraphQL. Think of them as two service counters at the same office: you can ask the same question at either counter, and you would expect the same answer about who is allowed to see what. In this report, the researcher found that the GraphQL counter handed out information that the REST counter and the normal web pages correctly refused to give.

The GraphQL requests in the report carried no login at all. Anyone on the internet, without even having a GitLab account, could ask for a private profile's details or a private group's description and get them back.

Background you need first

What an API is

An API is a way for one computer program to ask another for information, without a human clicking buttons. A useful comparison is a restaurant: the menu is the API. It lists what you can order and how to ask for it, and the kitchen decides what it will serve. When you use a website through your browser, the browser is quietly making these API-style requests for you behind the scenes.

What REST and GraphQL are

REST is a style of API where each kind of thing has its own address. To get information about a namespace, you visit an address like /api/v4/namespaces/16048. The address tells the server exactly what you want.

GraphQL is a different style. There is one address, and you send it a written request describing exactly which pieces of information you want. It is like the difference between ordering a fixed set meal (REST) and filling in a form saying which items you want on your plate (GraphQL). GitLab offers both, and this report is about the GraphQL one.

What a namespace is

GitLab uses the word namespace for a container that holds projects. A person's account is a namespace, and a group is also a namespace. Each namespace has a short name in the web address, called its full path. For the researcher's account, that path is rpadovani.

What a token is

A token is a long secret string that acts like a temporary key. When you log in to an API, you usually send a token instead of a password, so the server knows who you are. If a request has no token, the server treats you as an anonymous visitor, a stranger with no account. Keep that in mind, because the key finding here is that the successful requests had no token at all.

What a private profile and a private group are

GitLab has a setting called private profile. When it is on, your profile page is hidden and so is the list of projects you contribute to. A private group works the same way: its page cannot be opened by people who are not members. These are the two features the report shows being bypassed.

What the vulnerability class means

Improper access control means the software knows who should be allowed to see something, but in one place it forgets to check. It is like a building where the front door has a lock but a side window was left open. Nothing is broken; the rule simply is not applied everywhere it should be.

The tool used

Every request in the report is made with curl, a command-line tool that sends a web request and prints the reply. You do not need to install anything special to follow along; the point is just to see the exact request and the exact answer.

Step by step: how the researcher found it

The researcher started from a simple observation: the same information was protected in one place and exposed in another. The profile page and the contributed-projects page were blocked, and the REST API refused the data. But the GraphQL query, given the same namespace name, returned it. The researcher also found that a private group's page cannot be opened on the normal website, yet its description came back through the same query.

Step 1: confirm the profile really is private

The researcher's profile is set to private at https://gitlab.com/rpadovani, and the page listing the projects they contribute to, https://gitlab.com/users/rpadovani/contributed, cannot be opened. This step matters because it establishes what correct behaviour looks like: the data is supposed to be unreachable. Without this baseline, you could not say the later response was a leak.

Step 2: confirm the REST API refuses the data

Next, the researcher asked the REST API for the same namespace, using the access token of a different user. The idea is to show that the older, more established API applies the rule properly.

Bash
curl --header "PRIVATE-TOKEN: anotherUserToken" 'https://gitlab.com/api/v4/namespaces/16048'
{"message":"404 Namespace Not Found"}

Line by line:

  1. curl is the tool sending the request.
  2. --header "PRIVATE-TOKEN: anotherUserToken" attaches a token header, identifying the caller as some other logged-in user. The value shown is a placeholder, not a real token.
  3. The address https://gitlab.com/api/v4/namespaces/16048 asks the REST API for the namespace whose numeric id is 16048. That number is the user id of rpadovani.
  4. The reply is {"message":"404 Namespace Not Found"}. A 404 is the standard web code for "there is nothing here". The server returns a 404, meaning it found nothing for this caller.

So the REST counter said no. The question now is whether the GraphQL counter says the same.

Step 3: get the same data through GraphQL, with no token

This is the core of the report. The request below sends no authentication header of any kind. It is an anonymous request, the kind any stranger could make.

Bash
curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"rpadovani\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}'

Line by line:

  1. curl sends the request to https://gitlab.com/api/graphql, the single GraphQL address.
  2. -H 'Content-Type: application/json' tells the server the body is formatted as JSON, a common text format for structured data.
  3. --data '...' is the body of the request. Inside it, "query" holds the GraphQL request written as text.
  4. namespace(fullPath:\"rpadovani\") asks for the namespace whose short name is rpadovani. The backslashes are just escaping so the quotes fit inside the JSON string.
  5. The list after it names the fields wanted: description, requestAccessEnabled, fullName, fullPath, id, lfsEnabled, name, path and visibility. In GraphQL you must list every field you want; nothing is returned by default.
  6. projects (includeSubgroups: true, ) asks for the projects inside the namespace, including those in subgroups, and then lists the fields wanted for each project: id, name, archived, visibility and description.
  7. "variables":null and "operationName":null are standard slots for extra parameters; here they are empty.

The server answered with the data the REST API had just refused. The response below omits 19 further projects for brevity:

Text
{"data":{"namespace":{"description":"","requestAccessEnabled":true,"fullName":"rpadovani","fullPath":"rpadovani","id":"gid://gitlab/Namespace/18021","lfsEnabled":true,"name":"rpadovani","path":"rpadovani","visibility":"public","projects":{"edges":[{"node":{"id":"gid://gitlab/Project/11265641","name":"737-max-8","archived":false,"visibility":"public","description":"https://737max8.com"}}, ...OMIT...

What this shows: the private profile's namespace details and its project list came back to an anonymous caller. That is exactly what the web pages and the REST API deny. The ...OMIT... marks where the researcher cut the output short, omitting 19 further projects.

Step 4: read the description of a private group

The same query also works against a private group. The group's page at https://gitlab.com/secret-group-213 cannot be opened through the normal website, yet the following request, again with no token, returns its details:

Bash
curl 'https://gitlab.com/api/graphql' -H 'Content-Type: application/json' --data '{"query":"{namespace(fullPath:\"secret-group-213\") {description\n requestAccessEnabled\n fullName\n fullPath\n id\n lfsEnabled\n name\n path\n visibility\n projects (includeSubgroups: true, ) {edges {node {id\n name\n archived\n visibility\n description}}}}}","variables":null,"operationName":null}'

This is the same request as before, with only the name changed: fullPath:\"secret-group-213\" instead of fullPath:\"rpadovani\". The fields requested are identical. The reply was:

Text
{"data":{"namespace":{"description":"This description is secret!","requestAccessEnabled":false,"fullName":"secret group","fullPath":"secret-group-213","id":"gid://gitlab/Group/5337756","lfsEnabled":true,"name":"secret group","path":"secret-group-213","visibility":"private","projects":{"edges":[]}}}}

Reading the reply: the group's description is This description is secret!, and its visibility is private. The server itself says the group is private, and then hands over its description anyway. The projects list is empty here, so in this case the leak is the group's own details rather than a list of projects.

Why it happens

Each part of GitLab that answers questions has to check whether the person asking is allowed to see the answer. The web pages do this check, and the REST API does this check. The GraphQL namespace query returns the namespace and its fields even though the web pages and REST API deny the same data. The report does not include the code, so the exact place where the check is missing is not shown. The researcher notes that the GraphQL implementation was still at an early stage.

What the impact is

An attacker with no account at all can bypass the private profile setting and read details about private groups and subgroups, including the group description. The researcher describes the private profile feature as being made "quite useless" by this query. The impact is limited because the GraphQL implementation was still at the beginning; the researcher expects the impact to be larger once GraphQL catches up with the REST API.

What should have happened instead

The report states the expected correct behaviour plainly: an empty response. If the caller is not allowed to see a namespace, the query should return nothing, just as the REST API returned a 404. The fix would be to apply the same visibility rules on the GraphQL namespace query as on the REST namespaces endpoint and the web pages. The report does not describe the fix that was actually applied.

Other places worth checking

These are follow-up ideas in the same spirit, useful for anyone learning how to look for this kind of mistake:

  1. Other GraphQL queries that take a name or id. Ask for projects, groups or users by their path or identifier without a token. A positive result is getting details for something whose page or REST endpoint returns 404 or 403 to the same caller.
  2. Nested lists. Ask for projects, members or other lists under a namespace the caller cannot see. A positive result is a non-empty list where the REST equivalent is empty or refused.
  3. Individual fields. Request single fields such as description on a private object. A positive result is a field that is filled in GraphQL but missing from the REST answer for the same caller.
  4. Logged-in but low-privilege callers. Repeat the queries with a token from an unrelated account. A positive result is data that the REST API refuses for that same token, as in the 404 Namespace Not Found response above.

Glossary

  • API: a way for one program to ask another for information, like a menu of requests a service will answer.
  • REST: a style of API where each kind of information has its own web address.
  • GraphQL: a style of API with one address where you send a written request listing exactly the fields you want.
  • Endpoint: a specific web address that accepts requests, such as https://gitlab.com/api/graphql.
  • Namespace: GitLab's word for a container of projects; a user account or a group.
  • Full path: the short name of a namespace as it appears in its web address, for example rpadovani.
  • Token: a secret string used instead of a password to prove who you are to an API.
  • Anonymous request: a request sent with no token, so the server does not know who the caller is.
  • Private profile: a GitLab setting that hides a user's profile page and contributed-projects list.
  • Private group: a group whose page only its members can open.
  • Improper access control: a flaw where the software fails to check whether the caller is allowed to see something.
  • 404: the standard web code meaning "nothing found here"; often used to hide whether something exists.
  • 403: the standard web code meaning "you are not allowed to see this".
  • JSON: a common text format for structured data, used for both requests and replies here.
  • Field: one named piece of information in a GraphQL request or reply, such as description.
  • Query: a GraphQL request that asks for information rather than changing it.
  • Resolver: the part of a GraphQL server that produces the answer for a particular query.
  • curl: a command-line tool that sends web requests and prints the replies.
  • CVSS: a standard scoring system for how serious a security flaw is.
  • Severity: a label such as medium, high or critical describing how serious a flaw is.
  • Unauthenticated: done without logging in or presenting a token.

More by rpadovani

View all

6 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.