Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A ounce of prevention is worth a pound of cure #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Leak Mitigation Checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Examples of sensitive information:
If someone else leaked confidential information related to you or your company on GitHub, you may ask GitHub to perform a [DMCA takedown](https://help.github.com/articles/dmca-takedown-policy/#f-submitting-notices).

# Table of contents
[0. How to prevent exposing keys and sensitive information](#0-how-to-prevent-exposing-keys-and-sensitive-information)

* [0.1 Adding a .gitignore file to your code](#01-adding-a-gitignore-file-to-your-code)

* [0.2 Add sensitive files to the list](#02-add-sensitive-files-to-the-list)

* [0.3 Making your app work without keys in the code](#03-making-your-app-work-without-keys-in-the-code)

[1. General advice](#1-general-advice)

Expand All @@ -30,6 +37,18 @@ If someone else leaked confidential information related to you or your company o

[3. Any question?](#3-any-question)

# 0. How to prevent exposing keys and sensitive information
Before your first push to a repo, add this simple step to your workflow, which should avoid you having to backtrack and endure the embarrassment. That step is to add a .gitignore file to your code before you push for the first time. The process is simple and will prevent headaches for you and other developers of your project in the future.

## 0.1 Adding a .gitignore file to your code
Create a new file named .gitignore and save it in the root of your project. This can be done via the terminal or in Finder/Explorer/Linux file manager as needed. The file must have a dot before the "gitignore" part or it won't be recognized exactly like this: ".gitignore" (that is the entire file name, weird, I know, but it's magical).

## 0.2 Add sensitive files to the list
Since it is difficult to tell what every single developer might possibly name their key files and other secrets, it is easier if you add your specific files to the .gitignore file yourself. All you do is make an entry inside the .gitignore for each file that you don't want shared on the public internet as part of your source code. When you commit the .gitignore file, github automatically looks the other way, and will not include your sensitive files in the repo. It's almost like they planned it!

## 0.3 Making your app work without keys in the code
A valid question might be "How do I still make my app work without the keys or other sensitive files?" The answer is copy key files to the server where the code is running (usually by hand) so that they stay safe. Typically you would transfer the key file to the server once you've cloned your git repo onto the server. This way, the app still runs and your secret information stays secure. No one ever seems to explain this concept to devs, thus the need for GitGuardian to step in and help keep you safe.

# 1. General advice

## 1.1. :warning: First thing first: rotate your credentials
Expand Down