Default branch visible despite no permissions to repository
The default branch name of a GitLab project was exposed to users without repository access, such as non-members of a public project with repository set to 'Only Project Members'. An attacker could learn the default branch name, which may reveal sensitive information.
GitLab
Originally disclosed on GitLab
- Fixed in 2.1 years
- Disclosed after 2.1 years
Update: per Michelle's comment here
The issue outlined in the description has been resolved, however, additional findings occurred during the security review: gitlab-org/security/gitlab#103 (comment 333022117)
curl -s https://staging.gitlab.com/dcouture/norepoaccess | grep this_is_the_default_branch
<input type="hidden" name="repository_ref" id="repository_ref" value="this_is_the_default_branch" />
<div class="search-autocomplete-opts hide" data-autocomplete-path="/search/autocomplete" data-autocomplete-project-id="4588281" data-autocomplete-project-ref="this_is_the_default_branch"></div>
</a></li><li class=""><a class="shortcuts-repository-charts" title="Repository" href="/dcouture/norepoaccess/-/graphs/this_is_the_default_branch/charts"><span>Repository</span>
HackerOne report #706361 by ashish_r_padelkar on 2019-10-02, assigned to @cmaxim:
Summary
Hello,
The default branch should not be visible to guest/non-member users when they do not have any access to repository. However, default branch is still visible to such users.
I am reporting this issue as similar report was resolved before #531694 which exposes default branch when there was no access to repository.
Steps to reproduce
-
Create a public project with non access to repository for non members. This can be done by setting repository as
Only Project Members. -
This should ensure that no information related to repository is visible to non members
-
Now , as a non member, just visit to project details pages
https://gitlab.com/<UserName>/<ProjectName>and do the inspect element of browser. -
In
Bodyhtml tag, you should seedata-find-fileattribute which exposes default branch. Note that default branch can be set to anything by admins.

Examples
You can see my project here at https://gitlab.com/gitlabadminuser/thisispublicproject and follow the above steps to know default branch from this project.
What is the current bug behavior?
Default branch is visible to non members when they do not have any access to repository
What is the expected correct behavior?
None of the repository related information should be visible to non members when they do not have access
Output of checks
This bug happens on GitLab.com and might be on omnibus installations too.
Regards,
Ashish
Impact
This bug exposes default branch to
- Non members in public project when repository is
only project members - Guest in private project can see when they do not have any access to repository
- No badges setup in projects/groups
- Public pipelines are disabled
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the project page included the default branch name in a data attribute (data-find-file) without checking if the viewer had repository access.
Impact
The default branch name could be disclosed to users without repository access.
What the attacker needed
A public project with repository set to 'Only Project…; Attacker is a non-member or guest without repository access
The fix
The report's update says the described issue was resolved, but additional findings arose.
How it was found
- Create a public project and set repository access to 'Only Project Members'.
- As a non-member, visit the project's main page.
- Inspect the page's HTML and look for the data-find-file attribute, which reveals the default branch name.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In GitLab, a project can be public but its code repository can be restricted to members only. The name of the default branch (like 'main' or 'master') is part of the repository and should also be hidden. This report shows that the branch name was still visible in the page's HTML code, so anyone could see it even without permission.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.