Skip to content
Snippets Groups Projects
Verified Commit 5bfff4b1 authored by anarcat's avatar anarcat
Browse files

show how to reverse the repository hash

parent b9b7e501
No related branches found
No related tags found
No related merge requests found
......@@ -527,6 +527,34 @@ $ curl -s 'https://gitlab.torproject.org/api/v4/projects/647' | jq .web_url
"https://gitlab.torproject.org/tpo/core/arti"
```
## Find the project associated with a hashed repository name
Git repositories are not stored under the project name in GitLab
anymore, but under a hash of the project ID. The easiest way to get to
the project URL from a hash is [through the rails console](https://docs.gitlab.com/ee/administration/repository_storage_paths.html#from-hashed-path-to-project-name), for
example:
sudo gitlab-rails console
then:
ProjectRepository.find_by(disk_path: '@hashed/b1/7e/b17ef6d19c7a5b1ee83b907c595526dcb1eb06db8227d650d5dda0a9f4ce8cd9').project
The project's full path is also available in the `config` file in the
git repository, under the `fullpath` config entry.
Finally, you can also generate a rainbow table of all possible hashes
to get the project ID, and from there, find the project using the API
above. Here's a Python blob that will generate a hash for every
project ID up to 2000:
import hashlib
for i in range(2000):
h = hashlib.sha256()
h.update(str(i).encode('ascii'))
print(i, h.hexdigest())
## Connect to the PostgreSQL server
The GitLab Omnibus setup is special: it ships its own embedded
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment