Contribute securely

To understand the project's approach to security, think about the steps we'll have to take if someone breaks into the dashboard and installs a bitcoin miner. First we'll need to disable the attacker's access before they can do any more damage, then we'll have to figure out how they got in and how to stop it from happening again.

TIP

In the event of an attack, you need to quickly prove beyond doubt that your account can't be used by an attacker

Even if you're sure your account is secure, any time spent proving it is time the attacker can use to do more damage. If your only access to the project is through pull requests, your job during an attack is fairly simple - just don't submit any PRs if you know it's a bad time. The rest of this page discusses alternative solutions if you need a level of access that's harder to secure.

Limit your access

The principle of least privilegeopen in new window is key to designing a secure system. Put simply, the easiest way to prove you didn't do something is to prove you couldn't have done it if you wanted to. Your best solution depends on how you contribute, so you may want to use one or more of:

Use two-factor authentication

Two-factor authentication ("2FA")open in new window makes it harder for someone to steal your account and push bad commits in your name. This is a good idea for any developer, but we only require it if you can push changes directly to sleepdiary repositories.

If you have direct access to any sleepdiary repositories, please follow GitHub's guide to configuring 2FAopen in new window. If you're ever concerned your account might have been compromised, please update your passwordopen in new window immediately, and consider resetting your 2FA codesopen in new window. This makes it hard to get into your account, and easy to prove your account can't be used to do any more damage.

GPG-sign your commits

GPGopen in new window digitally signs to your commits, proving your computer was used to create a change. For example, if someone steals your GitHub password but not your GPG key, you can prove which of your commits are safe by showing which ones GitHub has verified.

If you have direct access to any sleepdiary repositories, please follow GitHub's guide to configuring GPGopen in new window. You may also want to consider auto-signing all commitsopen in new window.

GPG keys for day-to-day use need to strike a balance between security and usability. You will presumably want to store your key unencrypted on your computer, and might prefer to use a key with a short or empty passphrase. See the next section for information about higher-security keys.

Here are some specific commands you might find useful when dealing with GPG-signed commits:

git log --show-signature # show commit signatures
curl https://github.com/web-flow.gpg | gpg --import - # download GitHub's key
curl https://github.com/<username>.gpg | gpg --import - # download a user's key

GPG-sign tags

Some repositories tag official releases, to give users more confidence about the code they use. These must be signed by a key that meets the following criteria:

  • the key must be stored in a location that is rarely or never online (e.g. an old laptop without network access)
  • the key must expire (usually after a few years)

In the unlikely event you need this level of access, please talk it through with whoever signed the last tag in the relevant repository.