You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Good development practices.md
+12-12
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Good development practices to reduce the risks of leaking a secret.
21
21
22
22
Using wildcards can easily capture files you do not want to share.
23
23
24
-
Instead of wildcards, name each file you want to add, for example:`git add README.MD`. Before committing your changes, use `git status` command to list track and untracked files. When you commit with `git commit`, your untracked files will not end up in source control.
24
+
Instead of wildcards, name each file you want to add, for example,`git add README.MD`. Before committing your changes, use `git status` command to list track and untracked files. When you commit with `git commit`, your untracked files will not end up in source control.
25
25
26
26
## Name sensitive files in .gitignore and .npmignore
27
27
@@ -58,11 +58,11 @@ This approach may not be feasible at scale because there is no way to easily kee
58
58
**Disadvantages**
59
59
60
60
* You have to deal with your encryption keys securely.
61
-
* No audit logs. Your .git repos will be cloned by multiple developers, applications or servers. Soon your secrets will spread your organization and you will lose track of where they are and who has acces to them.
62
-
* No groups that let you easily specifiy permissions for multiple users.
63
-
* Hard to rotate an access. Rotating an access implies to revoke the key and redistribute it. The distribution part is not easy to handle with git repositories.
61
+
* No audit logs. Your .git repos will be cloned by multiple developers, applications or servers. Soon your secrets will spread your organization, and you will lose track of where they are and who has access to them.
62
+
* No groups that let you easily specify permissions for multiple users.
63
+
* Hard to rotate access. Rotating access implies to revoke the key and redistribute it. The distribution part is not easy to handle with git repositories.
64
64
65
-
### Use a "secrets as a service" solution
65
+
### Use "secrets as a service" solution
66
66
67
67
There are secrets management services like [Hashicorp's Vault](https://www.vaultproject.io/) or [Square's Keywhiz](https://square.github.io/keywhiz/).
68
68
@@ -84,28 +84,28 @@ The main disadvantage of these solutions is the cost of adoption. Their overhead
84
84
Some API providers make it possible to issue credentials with an expiration date.
85
85
86
86
## Whitelist your IPs
87
-
For some API providers you can add an extra layer of security by whitelisting your organization's IP addresses.
87
+
For some API providers, you can add an extra layer of security by whitelisting your organization's IP addresses.
88
88
89
89
## Restrict permissions associated with your keys
90
90
91
-
It is very rare to have to generate root access keys (with full permissions). Some API providers allow granular permissions to their endpoints, enable read / write splitting or role-based access control.
91
+
It is very rare to have to generate root access keys (with full permissions). Some API providers allow granular permissions to their endpoints, enable read/write splitting or role-based access control.
92
92
93
-
A rule of thumb: accesses should be granted on a need-to-know basis only.
93
+
A rule of thumb: accesses should be granted on a need-to-know basis only.
94
94
95
-
## Protect your development / testing secrets as well as your production secrets
95
+
## Protect your development/testing secrets as well as your production secrets
96
96
97
-
This is a common mistake. The line is not clear between development, testing and production secrets. Production secrets can end up in development / testing and vice versa.
97
+
This is a common mistake. The line is not clear between development, testing, and production secrets. Production secrets can end up in development/testing and vice versa.
98
98
99
99
## Don't share secrets over emails, Slack, Skype, etc.
100
100
101
101
Yes, these services were designed to keep your conversations private. No, they were not designed to store your secrets in plain text.
102
102
103
-
Ever had one of these long email conversations forwarded to you with information that was not meant to be shared buried in the thread?
103
+
Ever had one of these long email conversations forwarded to you with information that was not meant to be shared buried in the thread?
104
104
105
105
Don't encourage copy-pasting secrets in multiple places. This increases the surface area for hacks.
106
106
107
107
## Use GitHub scanning tools
108
108
109
-
Keep in mind that why the good development practices exposed above help you reduce the risk of leak, none of these actually prevent your secrets from being pushed to GitHub. Because good development practices are sometimes ignored.
109
+
Keep in mind that why the good development practices exposed above help you reduce the risk of a leak, none of these actually prevent your secrets from being pushed to GitHub. Because good development practices are sometimes ignored.
110
110
111
111
We are the authors of a GitHub scanning tool called [GitGuardian](https://www.gitguardian.com/?ref=github).
Copy file name to clipboardexpand all lines: Leak Mitigation Checklist.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -38,25 +38,25 @@ If someone else leaked confidential information related to you or your company o
38
38
> If you committed a password, change it! If you committed a key, generate a new one."
39
39
> ([Advice from GitHub :octocat: ](https://help.github.com/articles/removing-sensitive-data-from-a-repository/))
40
40
41
-
If you have pushed an API key, your first step should be to immediatly revoke the compromised token.
41
+
If you have pushed an API key, your first step should be to immediately revoke the compromised token.
42
42
43
43
It will NOT be enough to delete sensitive information in source code and commit changes or even purge your repository's history.
44
44
45
45
Keep in mind that you have to update your application accordingly in order not to break it. If your credentials are used by other developers or deployed in your infrastructure, make sure they all get a new version of it.
46
46
47
-
**If you are a junior developer, we highly recommend that you talk to your lead developer or to the security guy. It's OK to make mistakes. Recognizing a mistake is the best way to show how much you care.**
47
+
**If you are a junior developer, we highly recommend that you talk to your lead developer or the security guy. It's OK to make mistakes. Recognizing a mistake is the best way to show how much you care.**
48
48
49
49
## 1.2. (Optional) Delete evidence of the leak
50
50
51
51
### 1.2.1 Why it may be important
52
52
53
53
While you should first rotate your compromised credentials in all cases, you may wish to remove sensitive information from your git history as well. Remember that git is a versioning tool, which means that your commits history is searchable.
54
54
55
-
This is especially important if you committed sensitive data that cannot be changed (like any user data) or if you want to preserve your company's brand reputation and not raise cybersecurity concerns. Keep in mind that the Web never forgets: GitHub offers a [public events API](https://developer.github.com/v3/activity/events/#list-public-events) that can be used by everyone to download public commits. But still we strongly advise to limit exposure of your sensitive information.
55
+
This is especially important if you committed sensitive data that cannot be changed (like any user data) or if you want to preserve your company's brand reputation and not raise cybersecurity concerns. Keep in mind that the Web never forgets: GitHub offers a [public events API](https://developer.github.com/v3/activity/events/#list-public-events) that can be used by everyone to download public commits. But still, we strongly advise limiting exposure of your sensitive information.
56
56
57
57
### 1.2.2 Detailed procedure
58
58
59
-
The procedure of rewriting git history can be a bit tricky but this is a very good opportunity to learn about a few subtleties of the git protocol. Under its appearance of simplicity, the git protocol generally takes years for developers to be profoundly understood! So don't worry if you're a bit uncomfortable with it, and let's practice a little! :smile:
59
+
The procedure of rewriting git history can be a bit tricky, but this is a very good opportunity to learn about a few subtleties of the git protocol. Under its appearance of simplicity, the git protocol generally takes years for developers to be profoundly understood! So don't worry if you're a bit uncomfortable with it, and let's practice a little! :smile:
60
60
61
61
<details>
62
62
<summary><b>Click to expand</b></summary>
@@ -97,7 +97,7 @@ Create a new repository and push it back. Make sure everybody deleted old clones
97
97
98
98
It is a good idea to review the log data to see if there was some suspicious activity.
99
99
100
-
Some secrets can lead to other secrets. For example, Slack tokens can give accesss to messages and shared files generally containing other secrets. GitHub tokens can give access to private repositories also containing secrets.
100
+
Some secrets can lead to other secrets. For example, Slack tokens can give access to messages and shared files generally containing other secrets. GitHub tokens can give access to private repositories also containing secrets.
101
101
102
102
Depending on your findings, if part of your infrastructure or data has been further exposed, you may need to take additional mitigation actions.
103
103
@@ -149,15 +149,15 @@ Keys can be revoked on the [Access Key Management page](https://ak-console.aliyu
149
149
150
150
The way to revoke a token depends on its type. There are two types of tokens:
151
151
* Regular API keys. These keys can be created from the dashboard.
152
-
* "Secured" API keys. These keys are used to allow users to see a filtered view of an index (useful when the index contains data data from many users). They cannot be created from the dashboard. Instead they must be generated at the API level (from your back-end). Such keys must be generated from any regular key (except the admin key) with a search scope (called the "parent key").
152
+
* "Secured" API keys. These keys are used to allow users to see a filtered view of an index (useful when the index contains data from many users). They cannot be created from the dashboard. Instead, they must be generated at the API level (from your back-end). Such keys must be generated from any regular key (except the admin key) with a search scope (called the "parent key").
153
153
154
154
#### Your token is regular
155
155
156
156
You can revoke an API key from your [API keys dashboard](https://www.algolia.com/api-keys).
157
157
158
158
#### Your token is "secured"
159
159
160
-
Secured API keys can only be revoked by revoking their "parent" API key following the aboveprocedure for regular tokens.
160
+
Secured API keys can only be revoked by revoking their "parent" API key following the above procedure for regular tokens.
161
161
162
162
Revoking a parent key will revoke all its child keys.
163
163
@@ -175,7 +175,7 @@ Sign in to the [AWS Management Console](https://console.aws.amazon.com/) as the
175
175
176
176
Expand the "Access keys" section then click on the  button.
177
177
178
-
The difference between the  button and the  button is that disabled keys can be reenabled later, which should not be the case here.
178
+
The difference between the  button and the  button is that disabled keys can be re-enabled later, which should not be the case here.
179
179
180
180
#### The token was issued for an IAM user
181
181
@@ -213,7 +213,7 @@ As far as we know, there is no way to check the last calls made with your API to
213
213
214
214
## <imgsrc="icons/google-logo.jpg"height="30"width="30" > Google
215
215
216
-
As stated [here](https://support.google.com/cloud/answer/6310037?hl=en) you should not store API keys in application's source tree. There are some exceptions like Google Maps API keys that sometimes need to be embedded in JS.
216
+
As stated [here](https://support.google.com/cloud/answer/6310037?hl=en) you should not store API keys in the application's source tree. There are some exceptions like Google Maps API keys that sometimes need to be embedded in JS.
217
217
218
218
API keys are distributed per project. There are two types of personal secrets: API keys and Service account keys, the deletion process is the same and detailed below.
219
219
@@ -233,7 +233,7 @@ Visit your [access tokens panel](https://github.com/settings/tokens) under your
233
233
234
234
### Check for suspicious activity
235
235
236
-
As far as we know, there is no way to check the last calls made with your API token. But GitHub offers the possibility to [review some security logs](https://help.github.com/articles/reviewing-your-security-log/). This is better than nothing but this won't tell you if someone was able to access your private repositories for example.
236
+
As far as we know, there is no way to check the last calls made with your API token. But GitHub offers the possibility to [review some security logs](https://help.github.com/articles/reviewing-your-security-log/). This is better than nothing, but this won't tell you if someone was able to access your private repositories for example.
@@ -251,7 +251,7 @@ You can find the file in `/var/log/gitlab/gitlab-rails` for Omnibus GitLab packa
251
251
252
252
Heroku API keys don't have scopes. They give full programmatic access to your account.
253
253
254
-
> Warning: we are not speaking about [Heroku Oauth](https://devcenter.heroku.com/articles/oauth) tokens which have [scopes](https://devcenter.heroku.com/articles/oauth#scopes). Oauth tokens are generated in the back-end and unlike API keys, they are used with a client id.
254
+
> Warning: we are not speaking about [Heroku OAuth](https://devcenter.heroku.com/articles/oauth) tokens which have [scopes](https://devcenter.heroku.com/articles/oauth#scopes). OAuth tokens are generated in the back-end, and unlike API keys, they are used with a client id.
255
255
256
256
### Revoke a key
257
257
@@ -271,7 +271,7 @@ Then go to the "HubSpot API key" tab then click 
Mailgun tokens give access to your mailing lists and your logs of sent emails. They allow to send emails with your configured [domain names](https://app.mailgun.com/app/domains).
274
+
Mailgun tokens give access to your mailing lists and your logs of sent emails. They allow sending emails with your configured [domain names](https://app.mailgun.com/app/domains).
275
275
276
276
### Revoke a key
277
277
@@ -295,15 +295,15 @@ As far as we know, there is no way to check if an API key was used or not. The o
295
295
296
296
### Revoke a key
297
297
298
-
Slack tokens are very convenient because the have the power to revoke themselves thanks to the [auth.revoke API method](https://api.slack.com/methods/auth.revoke)! Easy as a command line:
298
+
Slack tokens are very convenient because they have the power to revoke themselves thanks to the [auth.revoke API method](https://api.slack.com/methods/auth.revoke)! Easy as a command line:
There is an [audit logs api](https://api.slack.com/docs/audit-logs-api) which is only available to [Enterprise Grid](https://api.slack.com/enterprise-grid) customers.
306
+
There is an [audit logs API](https://api.slack.com/docs/audit-logs-api) which is only available to [Enterprise Grid](https://api.slack.com/enterprise-grid) customers.
0 commit comments