如何找到包含 credentials/passwords 和 git 日志的提交
How can I find commits which contain credentials/passwords with git log
所以,我有一个存储库,我怀疑有人不小心向其中提交了凭据
我需要找到所有包含我的凭据的提交:tiWEythzNEX8N3sktiWEythzNEX8N3sk
让我们看看一些提交。 There is small repo to reproduce
使用命令git log --oneline -n 10
963f080 (HEAD -> find-credentials-git-log) feat(3309): add middleware
b83a41f fix(3309): rm credentials
70ec8dc bug: ooops I show my credentials
895937f feat(3309): add server
534792d feat(3309): add types
9cce5c9 feat(3309): add position entity
现在让我们看看 70ec8dc bug: ooops I show my credentials
提交的 git 差异
使用命令git show 70ec8dc
commit 70ec8dc914609d50bd0ef3c0b420db0b7a4aa7f5
Author: Yegor <mail@gmail.com>
Date: Wed Jun 19 12:21:38 2019 +0300
bug: ooops I show my credentials
diff --git a/typeorm/3309/startServer.ts b/typeorm/3309/startServer.ts
index 0f1c9bd..b3bd09e 100644
--- a/typeorm/3309/startServer.ts
+++ b/typeorm/3309/startServer.ts
@@ -45,7 +45,7 @@ export const startServer = async () => {
prefix: redisSessionPrefix
}),
name: 'offerhub',
- secret: process.env.SESSION_SECRET,
+ secret: 'tiWEythzNEX8N3sktiWEythzNEX8N3sk', // My credentials
resave: false,
saveUninitialized: false,
cookie: {
我需要找到 git diff
包含此 text/credentials tiWEythzNEX8N3sktiWEythzNEX8N3sk
的所有提交。怎么做?
git log --oneline -S 'tiWEythzNEX8N3sktiWEythzNEX8N3sk'
查看文档 here。
所以,我有一个存储库,我怀疑有人不小心向其中提交了凭据
我需要找到所有包含我的凭据的提交:tiWEythzNEX8N3sktiWEythzNEX8N3sk
让我们看看一些提交。 There is small repo to reproduce
使用命令git log --oneline -n 10
963f080 (HEAD -> find-credentials-git-log) feat(3309): add middleware
b83a41f fix(3309): rm credentials
70ec8dc bug: ooops I show my credentials
895937f feat(3309): add server
534792d feat(3309): add types
9cce5c9 feat(3309): add position entity
现在让我们看看 70ec8dc bug: ooops I show my credentials
提交的 git 差异
使用命令git show 70ec8dc
commit 70ec8dc914609d50bd0ef3c0b420db0b7a4aa7f5
Author: Yegor <mail@gmail.com>
Date: Wed Jun 19 12:21:38 2019 +0300
bug: ooops I show my credentials
diff --git a/typeorm/3309/startServer.ts b/typeorm/3309/startServer.ts
index 0f1c9bd..b3bd09e 100644
--- a/typeorm/3309/startServer.ts
+++ b/typeorm/3309/startServer.ts
@@ -45,7 +45,7 @@ export const startServer = async () => {
prefix: redisSessionPrefix
}),
name: 'offerhub',
- secret: process.env.SESSION_SECRET,
+ secret: 'tiWEythzNEX8N3sktiWEythzNEX8N3sk', // My credentials
resave: false,
saveUninitialized: false,
cookie: {
我需要找到 git diff
包含此 text/credentials tiWEythzNEX8N3sktiWEythzNEX8N3sk
的所有提交。怎么做?
git log --oneline -S 'tiWEythzNEX8N3sktiWEythzNEX8N3sk'
查看文档 here。