Is Your Private Github Repository Secure?

Is Your Private Github Repository Secure?

●1 ●15 ●34
calendar_today ago • schedule3 min read
— Originally published at mousaalbateh.com

Nowadays, most of us Devs, whenever we want to create a new project, we automatically use one of the major cloud git repositories storage providers for that purpose; while you can set your repository to private, you're still relying on the provider's security.

[!NEWS] [On April 12,2022, Github uncovered an attack campaign](https://github.blog/news-insights/company-news/security-alert-stolen-oauth-user-tokens/) where stolen OAuth user tokens issued to two third-party integrators were abused. Some private repositories were cloned by the attackers.

Your private repositories are exposed to the same risks and threats that data stored on the cloud have. Therefore, if you have a private repository, you may need to think beyond just setting a repository as private on Github or Bitbucket.

How Could git-remote-gcrypt Help?

Unless you have the resources to host your own private repos' storage, there is a simpler solution where you can still leverage cloud providers' repository storage capabilities while protecting your repositories from external risks. During my research, I came across this tool (git-remote-gcrypt) which caught my attention as not only it's open-source but also utilizes well known encryption mechanisms such as PGP keys and still enables collaboration.

I tested it myself, and I was impressed. Despite the fact that it had been developed many years ago, it is still functional!

The installation process is straightforward, and even if you are not very familiar with OpenPGP keys, the tool simplifies the process and makes it easy to navigate. However, you may need to understand what fingerprints mean in the context of OpenPGP.

I'm not going to list all the steps here since they are pretty much well explained in the repository which you can find below:

https://github.com/spwhitton/git-remote-gcrypt/tree/master

[!TIP]
It is not mentioned directly in the README file, but if you are on a Linux machine, you can simply run "apt install git-remote-gcrypt"; and you will get the tool installed including dependencies with little hassle.

In short, you can encrypt your repository while still enjoying the benefits of using existing well known cloud providers without worrying about confidentiality of your repository.

Of course, like any solution, there will be pros and cons which we need to understand.

Pros

  1. Great solution to protect your repository's confidentiality against cloud threats.
  2. You do not need to host and maintain your own private git cloud repository storage.
  3. Uses OpenPGP standards which is common and supported by majority of operating systems.
  4. You can still work with others and collaborate together by adding participants.
  5. Useful for repositories where code exposure may lead to piracy or adverse exposure of security vulnerabilities if the developers didn't discover them yet.

Cons

  1. If keys are lost or stolen, you could lose access to the repository.
  2. You lose providers' features for collaboration online such as reviewing pull requests online via their GUI.
  3. OpenPGP keys need to be maintained and can be complex even to senior engineers.
  4. Overkill if the repository doesn't contain anything important or sensitive enough and by default, you shouldn't have any secrets stored on a repository anyways.

Conclusion

There are other solutions to protect confidentiality of cloud stored repositories but this solution won in my eyes because of how easy it is to implement if your organization is using the common major providers like Github or Bitbucket.

It is very easy to miss early on thinking about the repository's security, especially during early design phases. In a Zero-trust environment, it is best in my opinion to encrypt by default and later on decide whether or not using the cloud providers' features or services are worth the risk. For small group of developers, I don't think it will be needed; but that is just my personal opinion.

Have you thought about this problem before?

Want more #cybersecurity & #git deep dives?

Join 6,024+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

Part 4 of 4 in cloud

More Posts

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

Your Backup Data Knows More Than You Think. HYCU aiR Is Finally Asking It the Right Questions.

Tom Smithverified - May 14

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9

Your SOC's AI Analyst Reads Whatever the Attacker Typed

alessandro_pignati - Oct 26

Why “Building in Public” Is Hollowing Out Your Developer Career

Karol Modelski - Jun 18
chevron_left
1.2k Points • 50 Badges
14Posts
8Comments
11Connections
You want to talk about backend engineering or cybersecurity? I'm always open for it. I'm always inte... Show more

Related Jobs

View all jobs →

Commenters (This Week)

3 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!