All writing
Blog4 min read

How to Secure your Github Account in Less than 10 Minutes

Amadeo Pellicce

Github is one of the most essential services used by technology professionals and companies to collaborate on work and protect their precious source code. The following guide helps you secure your Github account in less than 10 minutes by following the eight steps below.

1. Set up a strong, unique passphrase

This is the most important step of the list as a strong, unique password alone can go a long way into securing your account. Assuming you already have a Github account set up, go to the Settings -> Account page and update your password following the advice below.

Warden was founded on the idea that we should not have to rely solely on passwords for authentication as secrets are fundamentally a bad idea for non-critical web services. People forget, reuse, poorly generate and inadequately store them. Nevertheless, at present, we have to be able to secure our existing accounts using passwords adequately.

I always recommend using a password manager with an adequate private cloud backup policy (individual post on this to come) or a dedicated password manager service such as 1Password.

Remember, it’s not all about passphrase strength. For example, if you re-use the secret at multiple locations, it may be leaked, and people may use it to access your other accounts.

2. Set up Two Factor Authentication

Head to the Settings -> Security page and press “Set up Two Factor Authentication”.

We recommend using Google Authenticator over SMS as your SIM card can be taken over by bad actors due to bad security policies at your mobile provider. You can set up Google Authenticator on a suite of devices such as iOS, Android and Blackberry by following this guide by Google.

Click “Set up using an app” and on Google authenticator:

  1. Scan the barcode provided with the Google Authenticator app using ‘scan barcode’;
  2. Enter the Enter the six-digit code from the application into the input form on Github;
  3. Back up your authenticator backup keys by adding them in the notes field of your password manager. Alternatively, write it down on a piece of paper that you keep in a secure place. This step is often overlooked even by security professionals and not doing this correctly can make the difference in securing your Github Account.

3. Secure the email account that is associated with your Github account

This is a small but critical step in the process. Without having Two Factor Authentication, your backup account (Gmail or Microsoft) account being taken over by a bad actor can lead to your Github account password being reset. The bad actor can also contact Github support over email by impersonating you.

Furthermore, if you used SMS as your MFA method and your SIM card is compromised, or if your backup security codes have been compromised, this, in conjunction with your email account being taken over can also lead to your Github account being taken over. Albeit, not a small feat but a bad actor with the right motivations such as having a copy of your client’s source code may be willing to go through this.

4. Revoke any Unrecognised or Old and Unused Sessions

You can simply do this by going to the Settings -> Security page.

If you find any sessions that you do not recognise or are not planning to use, hover over the […] icon and press “Revoke”.

Doing this can mean that if someone could get access to a device that you previously used or if your old session cookies are compromised, your account would still be secure.

5. Review your Authorised Applications and Integrations

Go into your Github account under Settings -> Authorized Applications and make sure to revoke any unused applications. These may have read or write access to your repositories, so it’s important to keep this access tight at all times.

You should also review any installed integrations under Settings -> Installed Integrations. Any work tools used at your previous job or any services you signed up for that appear here and are no longer in used should have their access revoked.

6. Include your own updates in notification preferences

You may want to include yourself in any updates that are made to your repositories even by yourself. In the event that your account is taken over, this allows you to get notified of any forks or changes that are made on your account.

You can do this by going to Settings -> Notifications and by ticking the box “Include your own updates”.

7. Review your Account Security Log

We found that Github provides an excellent guide on this. In essence, you should go through your account recent events to see if you find anything suspicious on your account. If you do find something, make sure to change your password and potentially ask either your Github organisation owner or Github support for help.

8. Optional: make your email account private in your Github settings

Github allows your to display your account email on your Github profile. While this can be useful if you use your Github public profile commercially, contribute to important open source projects or would simply like to have a way to be reached out to by your profile viewers, we find that this feature can be potentially abused by bad actors.

You can do this by going to Settings -> Profile. On the “Public Email” dropdown form, select “Don’t show my email address”.

You can further go to Settings -> Emails and tick the box “keep my email private”. This will prompt Github to use a temporary username@users.noreply.github.com as your email address in Github notifications. This means that if you are in an email thread with fellow git contributors and a contributor is compromised; your email address is not leaked.

This is a small but potentially important thing which could save your account from being taken over and at the very least reduces spam in your email account.

Do you have any extra tips on how to protect your Github accounts that aren’t mentioned in this guide? Let us know about this and any feedback in the comments below!


Originally published on the Warden blog.

Never miss a post

Full posts by email before anywhere else. No spam, ever.

Related posts