mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-26 19:30:55 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36779df3bb | ||
|
|
3d3d801729 | ||
|
|
0f2ffee6f9 | ||
|
|
f4d37a2c0d | ||
|
|
be5596df1d | ||
|
|
e97f26bb5f | ||
|
|
ae13c96df8 | ||
|
|
d15dfdc387 | ||
|
|
631d8dcf03 | ||
|
|
192b96289f | ||
|
|
b8141713e8 | ||
|
|
3fedf6f8e7 | ||
|
|
6f6ebd454f | ||
|
|
ce42947cae | ||
|
|
84e285e4ce | ||
|
|
928c6a6043 | ||
|
|
106897fdf0 | ||
|
|
98d5648f6e | ||
|
|
9358e84588 | ||
|
|
958c18f0b7 | ||
|
|
089639e9fb | ||
|
|
85afd767f7 | ||
|
|
38006fb93b | ||
|
|
9ae1def963 | ||
|
|
6517900e5a | ||
|
|
5e51da600b | ||
|
|
f0b8d26c99 | ||
|
|
1724591029 | ||
|
|
80d29764a0 | ||
|
|
f498b1d308 | ||
|
|
8eabfd614e | ||
|
|
4acd7a3c8d | ||
|
|
a37822dffd | ||
|
|
1c6b28aa61 | ||
|
|
f15b4e408b | ||
|
|
d5f9d2b5d2 | ||
|
|
67a7069bb8 | ||
|
|
fd5d786538 | ||
|
|
c017b763f3 | ||
|
|
e796458763 | ||
|
|
2a9fbbc64d | ||
|
|
d6081d0cc4 | ||
|
|
e6c3a495ce | ||
|
|
93f292c3df | ||
|
|
780fb4a8f1 | ||
|
|
0d9ab37ba4 | ||
|
|
acffe44440 | ||
|
|
178f78fa14 | ||
|
|
1ab1ae0e70 | ||
|
|
9f8ca91b8b | ||
|
|
eec6c5a391 | ||
|
|
714c0bef1e | ||
|
|
e9b699dda1 | ||
|
|
5afe59d2fa | ||
|
|
8adf27b1ea | ||
|
|
aecd32075e | ||
|
|
290118cbbe | ||
|
|
d2e1e43a25 | ||
|
|
2161ff358b | ||
|
|
f338bc584f | ||
|
|
e6a132bf4f | ||
|
|
8625cc30db | ||
|
|
7cc3d7e467 | ||
|
|
b8ff5eec73 | ||
|
|
36a4871585 | ||
|
|
c85ebbb2ba | ||
|
|
3a3e13c3b5 | ||
|
|
14a00e1ffd | ||
|
|
bd707fa9c4 | ||
|
|
5e6b1840df | ||
|
|
d8e3a694f2 | ||
|
|
05e3462025 | ||
|
|
b83fe80968 | ||
|
|
5db0159c52 | ||
|
|
5f87c4137c | ||
|
|
ea94318ba3 | ||
|
|
3128789777 | ||
|
|
270207e5eb | ||
|
|
efe96640fc | ||
|
|
0137637c2c | ||
|
|
6adc045580 | ||
|
|
45c898c5ea | ||
|
|
95f8bd0daa | ||
|
|
2cc2519302 | ||
|
|
be13bba64c | ||
|
|
7111a698c0 | ||
|
|
8b9092a248 | ||
|
|
0aa05133a9 | ||
|
|
2952df5432 | ||
|
|
541e26b067 | ||
|
|
6018a6bb70 | ||
|
|
ca987b3842 | ||
|
|
67f8d28d7f | ||
|
|
f88abe99d7 | ||
|
|
6ddf27c5c3 | ||
|
|
aadd9387b2 | ||
|
|
0fd68c901d | ||
|
|
17a3943afe | ||
|
|
abc73e2443 | ||
|
|
3c1751e5c4 | ||
|
|
a32ef6afc4 | ||
|
|
127df8a6f0 | ||
|
|
aa91fd3e5e | ||
|
|
c8e97d97f9 | ||
|
|
67e3603ba4 | ||
|
|
f62617d7a6 | ||
|
|
9324184c24 | ||
|
|
a80ce0d251 | ||
|
|
c1c4a93f98 | ||
|
|
e74e6292ee | ||
|
|
25c3e92c2a | ||
|
|
9ab424172d | ||
|
|
28fd47e170 | ||
|
|
8250e40a75 | ||
|
|
f735c9a5c9 | ||
|
|
e7553b0168 | ||
|
|
12d276acd7 | ||
|
|
e6934bf0a5 | ||
|
|
6f5ad9dc0b | ||
|
|
a2019a4782 | ||
|
|
5d7b7718ec | ||
|
|
190877a24b | ||
|
|
144362b972 | ||
|
|
d353ac5108 | ||
|
|
a27a08904a | ||
|
|
5ef4e336ce | ||
|
|
78f2c46517 | ||
|
|
bdcb9e33a8 | ||
|
|
6e4e9df55f | ||
|
|
b3bed5658d | ||
|
|
a10ae91ba7 | ||
|
|
a8dbc7f107 | ||
|
|
4544156b44 | ||
|
|
b52e8c9c7c | ||
|
|
0ce1249b95 | ||
|
|
3932ed6baf | ||
|
|
981b636920 | ||
|
|
c8e15c731a | ||
|
|
901f932a89 | ||
|
|
c0a9580a65 | ||
|
|
8be91eea5d | ||
|
|
1c6f2252b8 | ||
|
|
58d130c5f3 | ||
|
|
091ea81e68 | ||
|
|
f036dce6ab | ||
|
|
2d58f1f94e | ||
|
|
86cfe0848b | ||
|
|
973d74e592 | ||
|
|
3909ebe03b | ||
|
|
65f42020af | ||
|
|
65a91ae976 | ||
|
|
7db08bfd90 | ||
|
|
af26553292 | ||
|
|
d5e431e7d4 | ||
|
|
54ba3ec377 | ||
|
|
656ef1c9a7 | ||
|
|
b8accd7273 | ||
|
|
238c31beaa | ||
|
|
eb31190f31 | ||
|
|
389d45e380 | ||
|
|
81b3a6e279 | ||
|
|
c50906373c | ||
|
|
40545fb680 | ||
|
|
2acc34dfdf | ||
|
|
ede68fd95d | ||
|
|
6c60c3dde3 | ||
|
|
ad505754fc | ||
|
|
21d81879e2 | ||
|
|
b5ca2ba614 | ||
|
|
ef4655fcf1 | ||
|
|
01b553a75d | ||
|
|
fae366a404 | ||
|
|
6129b1a15d | ||
|
|
31d03a1146 | ||
|
|
eabc7b5c12 | ||
|
|
1dc7569f95 | ||
|
|
1797e9c966 | ||
|
|
e2eaceb4cd | ||
|
|
c637b129ec | ||
|
|
8470e43d7f | ||
|
|
94f5950d68 | ||
|
|
fe69a17c9c | ||
|
|
6ca7a11d88 | ||
|
|
cfbb600fcb | ||
|
|
e36b550851 | ||
|
|
2232dc191c | ||
|
|
bdc688dd53 | ||
|
|
e0f6399d5c | ||
|
|
3e88ac6726 | ||
|
|
d0088f6c7c | ||
|
|
0d7c18cb39 | ||
|
|
d0e98416b9 | ||
|
|
b7438011b4 | ||
|
|
4e59d3bf19 | ||
|
|
e4b26aea4a | ||
|
|
473d0d55a7 | ||
|
|
8bd4649b01 | ||
|
|
a69df84325 | ||
|
|
0faebdefea | ||
|
|
a728e3abf3 | ||
|
|
e87c62fe72 | ||
|
|
4801818e3d | ||
|
|
b4a0577786 | ||
|
|
212232f80a | ||
|
|
11dcb44e41 | ||
|
|
af0df6ea2c | ||
|
|
9db91442b3 | ||
|
|
9d76070806 | ||
|
|
2fa580f1bb | ||
|
|
c6f15b768e | ||
|
|
779937ca87 | ||
|
|
731856e974 | ||
|
|
baf54631c7 | ||
|
|
3e760d7fed | ||
|
|
679f00dc9c | ||
|
|
dae5c142d7 | ||
|
|
8e8873286e | ||
|
|
6693cbdde3 | ||
|
|
8b3ce2cb1e | ||
|
|
94cae90d1e | ||
|
|
c4b07f5113 | ||
|
|
01d73028f8 | ||
|
|
862f1203ed | ||
|
|
581e81c16e | ||
|
|
6c166c9530 | ||
|
|
4181ede6cd | ||
|
|
10745be661 | ||
|
|
ee2d73c740 | ||
|
|
e7fbcf5333 | ||
|
|
2810eccc82 | ||
|
|
baff419091 | ||
|
|
d13e0fdfde | ||
|
|
5a300c3c64 | ||
|
|
d8ddb9630a | ||
|
|
1537eeb5fa | ||
|
|
1a492537dd | ||
|
|
bd4107b002 | ||
|
|
7b48cadf6d | ||
|
|
6eab8a7a0a | ||
|
|
c6d14e5b7d | ||
|
|
ce95cafd54 | ||
|
|
4024faceab | ||
|
|
1afa931248 | ||
|
|
2474c39311 | ||
|
|
f6460a7365 | ||
|
|
b47e00858e | ||
|
|
b200a13c8d | ||
|
|
e6fabdbb31 | ||
|
|
cdd654eab7 | ||
|
|
2f07b96333 | ||
|
|
62e74b2b18 | ||
|
|
e75693b131 | ||
|
|
3cd14d4696 | ||
|
|
d29cc9892c | ||
|
|
d996882f4e | ||
|
|
17b6aa856d | ||
|
|
c21a9cf121 | ||
|
|
d3c4342c15 | ||
|
|
b4c2f8e69c | ||
|
|
a0f72a4e35 | ||
|
|
24844002de | ||
|
|
593edeae21 | ||
|
|
6df770d261 | ||
|
|
4f0c9dcede | ||
|
|
52425a8ca9 | ||
|
|
454acebe5a | ||
|
|
6fcf91e934 | ||
|
|
f89b8f2b29 | ||
|
|
648a7ba577 | ||
|
|
7c5594c39d | ||
|
|
274e8212a6 | ||
|
|
36c6ddaf86 | ||
|
|
15ed72bc09 | ||
|
|
ace8de93a9 | ||
|
|
45a4c0a284 | ||
|
|
c5e1e8abc0 | ||
|
|
ef38b69c39 | ||
|
|
ac6bde9996 | ||
|
|
23568cc0ba | ||
|
|
e61c2cfae7 | ||
|
|
38e0b11995 | ||
|
|
31903d1a80 | ||
|
|
3655284b57 | ||
|
|
db79a96118 | ||
|
|
5152e1fc63 | ||
|
|
c04e137b28 | ||
|
|
9b3342fbff | ||
|
|
d9a060a12d | ||
|
|
77f2fdd09a | ||
|
|
dba1ef6104 | ||
|
|
725da55905 | ||
|
|
cfac551ab8 | ||
|
|
c559fdbf04 | ||
|
|
e2ac47cd06 | ||
|
|
8ef16d9efb | ||
|
|
b6f726654e | ||
|
|
8cbb84c50f | ||
|
|
f3eac0c958 | ||
|
|
3211cfbbb1 | ||
|
|
c6934f5eab | ||
|
|
f8c054b879 | ||
|
|
ad2a64c82b | ||
|
|
9e0028fe73 | ||
|
|
dfbd01a980 | ||
|
|
86737955de | ||
|
|
7f0b027486 | ||
|
|
4d04ea079f | ||
|
|
6e1c41b536 | ||
|
|
275232f8c8 | ||
|
|
c8f9560aa3 | ||
|
|
315ee56024 | ||
|
|
e446ba0738 | ||
|
|
2ccd40677d | ||
|
|
41ef2a8cd2 | ||
|
|
d8acd1354f | ||
|
|
e28cfd1ad5 | ||
|
|
e5f5e64cdb | ||
|
|
b55d88dc15 | ||
|
|
f3360cbf66 | ||
|
|
065b621604 | ||
|
|
fd87df475c | ||
|
|
c7b6792956 | ||
|
|
1f2d11003d | ||
|
|
6432f11a6b | ||
|
|
7d53fb5951 | ||
|
|
b9aa3ef97d | ||
|
|
c271497ecb | ||
|
|
e05c4645ac | ||
|
|
63d8e6e21b | ||
|
|
5bd59b0d8c | ||
|
|
464e152783 | ||
|
|
91406b0c4c | ||
|
|
04e81270cb | ||
|
|
69c6695765 | ||
|
|
9e0e050f92 | ||
|
|
b2efcf36c8 | ||
|
|
ba39abfb19 | ||
|
|
f47e1f71ee | ||
|
|
6d980b4eab | ||
|
|
ca18e8e2f6 | ||
|
|
ec436d7b33 | ||
|
|
38a511f6ba | ||
|
|
15ac1ffdd1 | ||
|
|
eb977ba237 | ||
|
|
9a6b1c3bbb | ||
|
|
95443e742c | ||
|
|
0c94db2d6b | ||
|
|
9808551eed | ||
|
|
b6fe5b08d3 | ||
|
|
5309811a09 | ||
|
|
3b6c198715 | ||
|
|
57bfa41b33 | ||
|
|
474266c0b5 | ||
|
|
c891470344 | ||
|
|
e6004da801 | ||
|
|
e18b1a884a | ||
|
|
faeb0914b2 | ||
|
|
d6578df998 | ||
|
|
f010513d17 | ||
|
|
d4be9602e3 | ||
|
|
7676690697 | ||
|
|
f4b9b6d0b3 | ||
|
|
7a3d155675 | ||
|
|
68b6388ef7 | ||
|
|
547e9768ec | ||
|
|
8608cf5b48 | ||
|
|
a08ddedb88 | ||
|
|
4bc7c13310 | ||
|
|
771055fd59 | ||
|
|
75c70bf804 |
No files matched your search
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [zricethezav]
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Basic Info (please complete the following information):**
|
||||
- OS:
|
||||
- Gitleaks Version:
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
cc @zricethezav
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
cc @zricethezav
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Maintenance request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
cc @zricethezav
|
||||
@@ -0,0 +1,8 @@
|
||||
### Description:
|
||||
Explain the purpose of the PR.
|
||||
|
||||
### Checklist:
|
||||
|
||||
* [ ] Does your PR pass tests?
|
||||
* [ ] Have you written new tests for your changes?
|
||||
* [ ] Have you lint your code locally prior to submission?
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: |
|
||||
zricethezav/gitleaks
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Test
|
||||
run: make test
|
||||
+7
-2
@@ -4,9 +4,14 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.DS_STORE
|
||||
*.idea
|
||||
*.got
|
||||
gitleaks
|
||||
build
|
||||
.gitleaks.toml
|
||||
|
||||
# Test binary
|
||||
*.test
|
||||
*.out
|
||||
|
||||
examples
|
||||
dist/
|
||||
@@ -0,0 +1,29 @@
|
||||
project_name: gitleaks
|
||||
|
||||
builds:
|
||||
- main: main.go
|
||||
binary: gitleaks
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- "386"
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
ldflags:
|
||||
- -s -w -X=github.com/zricethezav/gitleaks/v8/cmd.Version={{.Version}}
|
||||
archives:
|
||||
- builds: [gitleaks]
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
replacements:
|
||||
amd64: x64
|
||||
386: x32
|
||||
release:
|
||||
prerelease: true
|
||||
@@ -0,0 +1,6 @@
|
||||
- id: gitleaks
|
||||
name: Detect hardcoded secrets
|
||||
description: Detect hardcoded secrets using Gitleaks
|
||||
entry: gitleaks protect --verbose --redact --staged
|
||||
language: golang
|
||||
pass_filenames: false
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
sudo: required
|
||||
language: go
|
||||
go:
|
||||
- 1.11
|
||||
services:
|
||||
- docker
|
||||
script:
|
||||
- env GO111MODULE=on make test
|
||||
after_success:
|
||||
- env GO111MODULE=on go build
|
||||
- export REPO=zricethezav/gitleaks
|
||||
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH;
|
||||
fi`
|
||||
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make deploy; fi
|
||||
env:
|
||||
global:
|
||||
- secure: kUjq6Jgnm57V+ikDoYJ4IrFu4bLMHkaBb9uLtbQj0A545zZt4Dbooarnwqbfz2efqqMDZ9TXP6kN6677yWm0DyvFOCYx/Xq2innnVbBJczQciEUb5PI/9fcmLOfTe/QgGNi0GZOCdIOGlki2sbKxob6tTOUsm52ugRSJU92cXkX8w+Gzc6pC6fAb4moLE2QpwK1xWDHm2sHiZYExpBOH8eidSH5VPGVdNE9QmUA/FwwJ9NFGsZ8BgWCJPy7IJreyixsv2nNpiZNHoj0UgKe4wylzceu4sG/yQDIYk3fLVWBXSm/nSA17QYIjVMzQFjSAVC5dRqzq8HzFYiAYLKzkoOtrbBqEGtXzYZMN6yC8zEedk9gX6P6mvGpWYBy280uumcpGl6eoKYj5ke2H6kfcCUhMNTGZP17nmnTa1KFLAz1nxB1jfJwwO6v1l+xdytju5yAhm049Af7VyDM5GmE2x5ha48uKvK7wHtv+IKiZbbcR9ExsXvm21+7NVjQvRPzAw4/Sor9SG/yjoA/Sf7e4evy1w3fALv4WlaSisj5Yalmv7mzeeFZaIB7EIq6OryeRld2Rr1MZwwhZgIs7+SWwpjKfwhkfLVEUvSWCdnS2tnTydK6R6OFxfG5TGfR/WHooXLHEv5gMuKhUu/CqnbLyvI+8IOH2ybz2AtZWjf5n7oY=
|
||||
- secure: cIxKSkBNkPFAn243eHtwHJb8z6Uty1cZ43ZK/UABjwJoSrhu/roK4soqdZLwdVRA/0QswAlp6AC25Zs3ngLKGxxFHoeB8Tx6VLanE1zoi8OT0I2KbT92FdrLV4HlcRshKZtTFoTCfgVKPnWNKC+hil97CQzQPGRpZLBSfNefk5uCMnQiAzaJ5lyWPx+sjLHzpVlGA6aQx9ZeBQqngQJoDHKc0K3hKwug4h9mkkhyaYE3kgxtsdOYlHvOtQgVk+Zih5uW7ABOQCyAOaQVipXBC+uiuNf2DeAuGDaX69DTRKqPzuIasbhwyGqlfsr2JeofEWgZGmTaWGKMi03hnIY+U9+lHjygBW1qqVglODboouUrV3LwER9kqrT+ZFTM5Ca8VB+Gx5khkknbjWd06jpzRQxNXdukYN89kEaAHkBH844G99pMDqcZ32lHK7lpCu8n1H/Liz3ygoV6ScJXnYAP6y9rrd3bb9KEmnKhmFacVLRIAUw1vN/cgspJpl/Mk6s5rvGwsbQih1OxGyooOLxGjEGWqVDFgHFtyiwX9s9kT+hNTwKgbhp7Ragk/QuDYUPZ3Vum7HoiNPS9KpQNstLvDckdtd8h13JIw6nX+xdWbNKjjdYbAZRstJHUROQtNq3XdWNQ9YjqbCoybaxCOwOUTwOiTSWNKXjTFbFI5mR/ZO0=
|
||||
- COMMIT=${TRAVIS_COMMIT::8}
|
||||
- secure: o6uPX071qGRKgOQmitxiDr1j+KRW8W6ru0wmKNBFuUlZvQudwCUZMnVfk6OeofT1IgLCHmLS8ST81cTyeXqOQhYVZrlxTmEUpDHHRTu6dOj3eqRzdJow1LIWNpw5xfOaqXUdQ8+SQ47ZeSFapsmaY9oeRDvSJ8zLS4qUdgUylvZFJWjSrjzi2xemJa1l3MDdZRhEaNkfMliDGCv2vuUFp7tYz0QtyqBkBMORQl53dzgrcQcsRjDSE274WJl9CUg1l0pNMFsAbVCUGwUqCmKace9LXZ9JV00TRdg4EpryDsUCi23q0THnwstvRffwyJrw+xbhY/X3GKC4zOKqiCLJ4MTPQEIKlpVJQ9e9lWJ8FYhpUrl3QaHfEPINJ0taUfGhCyNzi5QBkSWbTcWVmRMmu+QIy7moW9crcz2xmVEUey7AaGwZT2Kk6JGw26w5q9IUy1Z9mwaljmHrUTqZrOX4Hj3UblpkHN+mGkoia/ipta5KhN5lTTIs4N3V+El7O2R2GggBrVHNiSualfydo+RX8k/S6PM1/C88IQO3Y2utoJrr415CznncvhF9Sc6tncZcShcNQj1iEOSsGxY2noW265eHzTMKJ/xuN6Bp9OXVK+8iOcUsz1T7F0UqwY3xnD8F7fBZ7IGG41DsXBDIcPmb+SIYbhv0uJjm3BEuv4TzIU0=
|
||||
-234
@@ -1,234 +0,0 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
2.0.0
|
||||
----
|
||||
- rules introduced in the gitleaks configurationn
|
||||
- removing `--entropy` option
|
||||
- removing `--single-search` option
|
||||
|
||||
1.25.1
|
||||
----
|
||||
- Fixing #188
|
||||
|
||||
1.25.0
|
||||
----
|
||||
- Pretty big refactor, see `src` directory
|
||||
- Dropping dep for go modules
|
||||
- Separating email and author
|
||||
- Readding branch support with `--branch=`
|
||||
|
||||
1.24.0
|
||||
----
|
||||
- `--commit` now allows users to target a specific commit to audit
|
||||
- `--commit-stop` audit all commits up to and including what is specified at `--commit-stop`
|
||||
- Updated go-git version to 4.9.1
|
||||
|
||||
1.23.0
|
||||
----
|
||||
-- `--repo-config` allows users to load configs specific to a repo target
|
||||
|
||||
1.22.0
|
||||
----
|
||||
- context inclusion for redactions
|
||||
- noise reduction for entropy signals
|
||||
|
||||
1.21.0
|
||||
----
|
||||
- added support for cloning repositories using github api
|
||||
- auditing PRs now allows for whitelisting files
|
||||
|
||||
1.20.0
|
||||
----
|
||||
- adding gitlab user and group support
|
||||
|
||||
1.19.3
|
||||
----
|
||||
- memoizing root commit
|
||||
- only count commits (not commit + parent) for total commit number
|
||||
|
||||
1.19.2
|
||||
----
|
||||
- fixed a bug where gitleaks was skipping the initial commit
|
||||
- commit cache now checks curr commit + parent commit hash
|
||||
- removed newlines from commit message
|
||||
|
||||
1.19.1
|
||||
----
|
||||
- mistakenly removed default whitelist files
|
||||
|
||||
1.19.0
|
||||
----
|
||||
- removed `--all-refs`. By default gitleaks now scans all branches, remote and local.
|
||||
- added commit memoizer to prevent duplicate commit audits
|
||||
- removed branch whitelist
|
||||
- removed branch from report as a commit is an object independent of branch
|
||||
- Better regexes for facebook, github, twitter (no more unbounded wildcards)
|
||||
|
||||
1.18.0
|
||||
----
|
||||
- fixing slack token
|
||||
- defaulting to single thread process
|
||||
- `--max-go=` --> `--threads=`
|
||||
- guarding `--threads=` > max threads available (you aint gettin any more performance)
|
||||
|
||||
1.17.0
|
||||
----
|
||||
- Default regex added to search: slack, telegram.
|
||||
- Default whitelisting: bin, doc, jpeg, gif
|
||||
|
||||
1.16.1
|
||||
----
|
||||
- Fixing default ssh auth logic
|
||||
|
||||
1.16.0
|
||||
----
|
||||
- Better commit coverage. Now iterates through each commit in git log and generates a patch with each commit's parent.
|
||||
- Removing the need for --private/-p option. Instead gitleaks will determine if the repo is private or not.
|
||||
|
||||
|
||||
1.15.0
|
||||
----
|
||||
- Whitelist repos use regex now
|
||||
- Whitelist repo check before clone
|
||||
|
||||
1.14.0
|
||||
----
|
||||
- Entropy Range support in gitleaks config
|
||||
|
||||
1.13.0
|
||||
----
|
||||
- Github PR support
|
||||
- Github has its own go file. All other services, bitbucket, gitlab, etc should follow this convention
|
||||
|
||||
1.12.1
|
||||
----
|
||||
- Show program usage when no arguments are provided
|
||||
- Exit program after the -h or --help options are used
|
||||
|
||||
1.12.0
|
||||
----
|
||||
- removing --csv option
|
||||
- --report option now requires .json or .csv in filename
|
||||
- adding total time to audit in logs
|
||||
|
||||
1.11.1
|
||||
----
|
||||
- fix commit whitelist logic
|
||||
|
||||
1.11.0
|
||||
-----
|
||||
- Commit depth option
|
||||
- Commit stats output
|
||||
|
||||
1.10.0
|
||||
-----
|
||||
- Add entropy option
|
||||
|
||||
1.9.0
|
||||
-----
|
||||
- exclude fork option
|
||||
|
||||
1.8.0
|
||||
-----
|
||||
- whitelist repos
|
||||
- sample config option
|
||||
|
||||
1.7.3
|
||||
-----
|
||||
- style points
|
||||
|
||||
1.7.2
|
||||
-----
|
||||
- Fixing dangling goroutines, removing channel messaging
|
||||
|
||||
1.7.1
|
||||
-----
|
||||
- Fixing bug where single repos were not being audited
|
||||
|
||||
1.7.0
|
||||
-----
|
||||
- Exit code == 2 on error
|
||||
- Cleaning up some logs
|
||||
- Removing some unreachable code
|
||||
|
||||
1.6.1
|
||||
-----
|
||||
- Recover from panic when diffing
|
||||
|
||||
1.6.0
|
||||
-----
|
||||
- Default maximum goroutines spawned is number of cores your CPU run with. See benchmarks in wiki.
|
||||
- Cleanup after each repo audit for organizations rather than waiting for the entire organization to complete. Eliminates the risk of running out of disk space.
|
||||
|
||||
|
||||
1.5.0
|
||||
-----
|
||||
- Support for CSV reporting
|
||||
- Refactoring Github user/owner audits
|
||||
|
||||
1.4.0
|
||||
-----
|
||||
- Support for single commit repos
|
||||
- Bumped go-git version from 4.5.0 to 4.7.0
|
||||
|
||||
1.3.0
|
||||
-----
|
||||
- Target specific branch
|
||||
|
||||
1.2.1
|
||||
-----
|
||||
- Check errors when generating commit patch
|
||||
|
||||
1.2.0
|
||||
-----
|
||||
- Added support for providing an alternate GitHub URL to support scanning GitHub Enterprise repositories
|
||||
|
||||
1.1.2
|
||||
-----
|
||||
- Added version option
|
||||
- Introduced changelog
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
- Fixed commit patch order
|
||||
- Updated Readme
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
- Fixed Twitter typo
|
||||
- Fixed sample docker command
|
||||
- Default clone option to "in-memory"
|
||||
- Added clone option for "disk"
|
||||
- Updated Makefile
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
- Rewrite, see Readme.md: https://github.com/zricethezav/gitleaks/releases/tag/v1.0.0
|
||||
|
||||
0.4.0
|
||||
-----
|
||||
- Added support for external regexes
|
||||
|
||||
0.3.0
|
||||
-----
|
||||
- Added local scan
|
||||
- Meaningful exit codes
|
||||
- Timestamped logs
|
||||
- Refactored for some maintainability
|
||||
|
||||
0.2.0
|
||||
-----
|
||||
- Additionally regex checking
|
||||
- $HOME/.gitleaks/ directory for clones and reports
|
||||
- Pagination for Org/User list... no more partial repo lists
|
||||
- Persistent repos for Orgs and Users (no more re-cloning)
|
||||
- Updated README
|
||||
- Multi-staged Docker build
|
||||
- Travis CI
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
- full git history search
|
||||
- regex/entropy checks
|
||||
- report generation
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
The gitleaks project is under [GNU General Public License v3.0](LICENSE.md) and accepts
|
||||
contributions via GitHub pull requests.
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Open a PR. Give the PR a descriptive title. Add some comments describing what is the purpose of the PR.
|
||||
|
||||
__BUT before you do that!__
|
||||
|
||||
Make sure you pass this list of requirements.
|
||||
|
||||
- You've run `go fmt`.
|
||||
- You've run `golint`.
|
||||
- You've added test cases for your changes.
|
||||
- You've updated [the changelog](CHANGELOG.md).
|
||||
- Your tests pass.
|
||||
|
||||
+7
-11
@@ -1,16 +1,12 @@
|
||||
FROM golang:1.11.6 AS build
|
||||
FROM golang:1.17 AS build
|
||||
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||
COPY . .
|
||||
RUN GO111MODULE=on CGO_ENABLED=0 go build -o bin/gitleaks *.go
|
||||
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
||||
GO111MODULE=on CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
|
||||
|
||||
FROM alpine:3.7
|
||||
RUN apk add --no-cache bash git openssh
|
||||
FROM alpine:3.14.2
|
||||
RUN adduser -D gitleaks && \
|
||||
apk add --no-cache bash git openssh-client
|
||||
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
||||
USER gitleaks
|
||||
ENTRYPOINT ["gitleaks"]
|
||||
|
||||
# How to use me :
|
||||
|
||||
# docker build -t gitleaks .
|
||||
# docker run --rm --name=gitleaks gitleaks --repo=https://github.com/zricethezav/gitleaks
|
||||
|
||||
# This will check for secrets in https://github.com/zricethezav/gitleaks
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Zachary Rice
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-674
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,22 +1,26 @@
|
||||
.PHONY: test build-all deploy
|
||||
.PHONY: test test-cover
|
||||
|
||||
test:
|
||||
go get golang.org/x/lint/golint
|
||||
go fmt
|
||||
golint
|
||||
go test --race --cover github.com/zricethezav/gitleaks/src -v
|
||||
deploy:
|
||||
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
|
||||
docker build -f Dockerfile -t $(REPO):$(TAG) .
|
||||
echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
|
||||
docker push $(REPO)
|
||||
build-all:
|
||||
rm -rf build
|
||||
mkdir build
|
||||
env GOOS="windows" GOARCH="amd64" go build -o "build/gitleaks-windows-amd64.exe"
|
||||
env GOOS="windows" GOARCH="386" go build -o "build/gitleaks-windows-386.exe"
|
||||
env GOOS="linux" GOARCH="amd64" go build -o "build/gitleaks-linux-amd64"
|
||||
env GOOS="linux" GOARCH="arm" go build -o "build/gitleaks-linux-arm"
|
||||
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
|
||||
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
|
||||
env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64"
|
||||
PKG=github.com/zricethezav/gitleaks
|
||||
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
||||
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v8/cmd.Version=$(VERSION)"
|
||||
COVER=--cover --coverprofile=cover.out
|
||||
|
||||
test-cover:
|
||||
go test ./... --race $(COVER) $(PKG) -v
|
||||
go tool cover -html=cover.out
|
||||
|
||||
format:
|
||||
go fmt ./...
|
||||
|
||||
test: format
|
||||
go vet ./...
|
||||
go test ./... --race $(PKG) -v
|
||||
|
||||
build: format
|
||||
go vet ./...
|
||||
go mod tidy
|
||||
go build $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
find . -type f -name '*.got.*' -delete
|
||||
find . -type f -name '*.out' -delete
|
||||
@@ -1,127 +1,302 @@
|
||||
Gitleaks
|
||||
--------
|
||||
|
||||
```
|
||||
○
|
||||
│╲
|
||||
│ ○
|
||||
○ ░
|
||||
░ gitleaks
|
||||
```
|
||||
|
||||
|
||||
<p align="left">
|
||||
<a href="https://travis-ci.org/zricethezav/gitleaks"><img alt="Travis" src="https://img.shields.io/travis/zricethezav/gitleaks/master.svg?style=flat-square"></a>
|
||||
<p align="left">
|
||||
<a href="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml">
|
||||
<img alt="Github Test" src="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml/badge.svg">
|
||||
</a>
|
||||
<a href="https://hub.docker.com/r/zricethezav/gitleaks">
|
||||
<img src="https://img.shields.io/docker/pulls/zricethezav/gitleaks.svg" />
|
||||
</a>
|
||||
<a href="https://twitter.com/intent/follow?screen_name=zricethezav">
|
||||
<img src="https://img.shields.io/twitter/follow/zricethezav?label=Follow%20zricethezav&style=social&color=blue" alt="Follow @zricethezav" />
|
||||
</a>
|
||||
</p>
|
||||
Audit git repos for secrets. Gitleaks provides a way for you to find unencrypted secrets and other unwanted data types in git source code repositories. As part of it's core functionality, it provides;
|
||||
|
||||
* Github and Gitlab support including support for bulk organization and repository owner (user) repository scans, as well as pull request scanning for use in common CI workflows.
|
||||
* Support for private repository scans, and repositories that require key based authentication
|
||||
* Output in CSV and JSON formats for consumption in other reporting tools and frameworks
|
||||
* Externalised configuration for environment specific customisation including regex rules
|
||||
* Customizable repository name, file type, commit ID, branchname and regex whitelisting to reduce false positives
|
||||
* High performance through the use of src-d's [go-git](https://github.com/src-d/go-git) framework
|
||||
|
||||
|
||||
It has been sucessfully used in a number of different scenarios, including;
|
||||
* Adhoc scans of local and remote repositories by filesystem path or clone URL
|
||||
* Automated scans of github users and organizations (Both public and enterprise platforms)
|
||||
* As part of a CICD workflow to identify secrets before they make it deeper into your codebase
|
||||
* As part of a wider secrets auditing automation capability for git data in large environments
|
||||
|
||||
|
||||
### Example execution
|
||||
|
||||
|
||||
<p align="left">
|
||||
<img src="https://cdn.rawgit.com/zricethezav/5bf8259b7fea0170becffc06b8588edb/raw/f762769fe20ef3669bff34612b1bede6457631e6/termtosvg_je8bp82s.svg">
|
||||
</p>
|
||||
|
||||
#### Installation
|
||||
Written in Go, gitleaks is available in binary form for many popular platforms and OS types from the [releases page](https://github.com/zricethezav/gitleaks/releases). Alternatively, executed via Docker or it can be installed using Go directly, as per the below;
|
||||
Gitleaks is a SAST tool for **detecting** and **preventing** hardcoded secrets like passwords, api keys, and tokens in git repos. Gitleaks is an **easy-to-use, all-in-one solution** for detecting secrets, past or present, in your code.
|
||||
|
||||
##### MacOS
|
||||
```
|
||||
[](https://asciinema.org/a/455683)
|
||||
|
||||
## Getting Started
|
||||
Gitleaks can be installed using Homebrew, Docker, or Go. Gitleaks is also available in binary form for many popular platforms and OS types on the [releases page](https://github.com/zricethezav/gitleaks/releases). In addition, Gitleaks can be implemented as a pre-commit hook directly in your repo.
|
||||
|
||||
### MacOS
|
||||
|
||||
```bash
|
||||
brew install gitleaks
|
||||
```
|
||||
|
||||
##### Docker
|
||||
|
||||
### Docker
|
||||
#### DockerHub
|
||||
```bash
|
||||
# Run gitleaks against a public repository
|
||||
docker run --rm --name=gitleaks zricethezav/gitleaks -v -r https://github.com/zricethezav/gitleaks.git
|
||||
|
||||
# Run gitleaks against a local repository already cloned into /tmp/
|
||||
docker run --rm --name=gitleaks -v /tmp/:/code/ zricethezav/gitleaks -v --repo-path=/code/gitleaks
|
||||
|
||||
# Run gitleaks against a specific Github Pull request
|
||||
docker run --rm --name=gitleaks -e GITHUB_TOKEN={your token} zricethezav/gitleaks --github-pr=https://github.com/owner/repo/pull/9000
|
||||
docker pull zricethezav/gitleaks:latest
|
||||
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||
```
|
||||
#### ghrc.io
|
||||
```bash
|
||||
docker pull ghcr.io/zricethezav/gitleaks:latest
|
||||
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||
```
|
||||
|
||||
##### Go
|
||||
|
||||
### From Source
|
||||
1. Download and install Go from https://golang.org/dl/
|
||||
2. Clone the repo
|
||||
```bash
|
||||
go get -u github.com/zricethezav/gitleaks
|
||||
git clone https://github.com/zricethezav/gitleaks.git
|
||||
```
|
||||
3. Build the binary
|
||||
```bash
|
||||
cd gitleaks
|
||||
make build
|
||||
```
|
||||
|
||||
#### Usage and Options
|
||||
gitleaks has a wide range of configuration options that can be adjusted at runtime or via a configuration file based on your specific requirements.
|
||||
|
||||
### Pre-Commit
|
||||
1. Install pre-commit from https://pre-commit.com/#install
|
||||
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
|
||||
```
|
||||
repos:
|
||||
- repo: https://github.com/zricethezav/gitleaks
|
||||
rev: v8.2.0
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
```
|
||||
3. Install with `pre-commit install`
|
||||
4. Now you're all set!
|
||||
```
|
||||
➜ git commit -m "this commit contains a secret"
|
||||
Detect hardcoded secrets.................................................Failed
|
||||
```
|
||||
Note: to disable the gitleaks pre-commit hook you can prepend `SKIP=gitleaks` to the commit command
|
||||
and it will skip running gitleaks
|
||||
```
|
||||
➜ SKIP=gitleaks git commit -m "skip gitleaks check"
|
||||
Detect hardcoded secrets................................................Skipped
|
||||
```
|
||||
|
||||
## Usage
|
||||
```
|
||||
Usage:
|
||||
gitleaks [OPTIONS]
|
||||
gitleaks [command]
|
||||
|
||||
Application Options:
|
||||
-r, --repo= Repo url to audit
|
||||
--github-user= Github user to audit
|
||||
--github-org= Github organization to audit
|
||||
--github-url= GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/ (default: https://api.github.com/)
|
||||
--github-pr= Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set
|
||||
--gitlab-user= GitLab user ID to audit
|
||||
--gitlab-org= GitLab group ID to audit
|
||||
--commit-stop= sha of commit to stop at
|
||||
--commit= sha of commit to audit
|
||||
--depth= maximum commit depth
|
||||
--repo-path= Path to repo
|
||||
--owner-path= Path to owner directory (repos discovered)
|
||||
--threads= Maximum number of threads gitleaks spawns
|
||||
--disk Clones repo(s) to disk
|
||||
--config= path to gitleaks config
|
||||
--ssh-key= path to ssh key
|
||||
--exclude-forks exclude forks for organization/user audits
|
||||
--repo-config Load config from target repo. Config file must be ".gitleaks.toml"
|
||||
--branch= Branch to audit
|
||||
-l, --log= log level
|
||||
-v, --verbose Show verbose output from gitleaks audit
|
||||
--report= path to write report file
|
||||
--redact redact secrets from log messages and report
|
||||
--version version number
|
||||
--sample-config prints a sample config file
|
||||
Available Commands:
|
||||
completion generate the autocompletion script for the specified shell
|
||||
detect Detect secrets in code
|
||||
help Help about any command
|
||||
protect Protect secrets in code
|
||||
version Display gitleaks version
|
||||
|
||||
Help Options:
|
||||
-h, --help Show this help message
|
||||
Flags:
|
||||
-c, --config string config file path
|
||||
order of precedence:
|
||||
1. --config/-c
|
||||
2. env var GITLEAKS_CONFIG
|
||||
3. (--source/-s)/.gitleaks.toml
|
||||
If none of the three options are used, then gitleaks will use the default config
|
||||
--exit-code string exit code when leaks have been encountered (default: 1)
|
||||
-h, --help help for gitleaks
|
||||
-l, --log-level string log level (debug, info, warn, error, fatal) (default "info")
|
||||
--redact redact secrets from logs and stdout
|
||||
-f, --report-format string output format (json, csv, sarif)
|
||||
-r, --report-path string report file
|
||||
-s, --source string path to source (git repo, directory, file)
|
||||
-v, --verbose show verbose output from scan
|
||||
|
||||
Use "gitleaks [command] --help" for more information about a command.
|
||||
```
|
||||
|
||||
#### Exit Codes
|
||||
Gitleaks provides consistent exist codes to assist in automation workflows such as CICD platforms and bulk scanning.
|
||||
### Commands
|
||||
There are two commands you will use to detect secrets; `detect` and `protect`.
|
||||
#### Detect
|
||||
The `detect` command is used to scan repos, directories, and files. This comand can be used on developer machines and in CI environments.
|
||||
|
||||
These can be effectively used in conjunction with the report output file to detect and return meaningful data back to the user or external system about if leaks have been detected, and where they reside.
|
||||
When running `detect` on a git repository, gitleaks will parse the output of a `git log -p` command (you can see how this executed
|
||||
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L17-L25)).
|
||||
[`git log -p` generates patches](https://git-scm.com/docs/git-log#_generating_patch_text_with_p) which gitleaks will use to detect secrets.
|
||||
You can configure what commits `git log` will range over by using the `--log-opts` flag. `--log-opts` accepts any option for `git log -p`.
|
||||
For example, if you wanted to run gitleaks on a range of commits you could use the following command: `gitleaks --source . --log-opts="--all commitA..commitB"`.
|
||||
See the `git log` [documentation](https://git-scm.com/docs/git-log) for more information.
|
||||
|
||||
The code return codes are:
|
||||
You can scan files and directories by using the `--no-git` option.
|
||||
|
||||
#### Protect
|
||||
The `protect` command is used to uncommitted changes in a git repo. This command should be used on developer machines in accordance with
|
||||
[shifting left on security](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security).
|
||||
When running `protect` on a git repository, gitleaks will parse the output of a `git diff` command (you can see how this executed
|
||||
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L48-L49)). You can set the
|
||||
`--staged` flag to check for changes in commits that have been `git add`ed. The `--staged` flag should be used when running Gitleaks
|
||||
as a pre-commit.
|
||||
|
||||
**NOTE**: the `protect` command can only be used on git repos, running `protect` on files or directories will result in an error message.
|
||||
|
||||
### Verify Findings
|
||||
You can verify a finding found by gitleaks using a `git log` command.
|
||||
Example output:
|
||||
```
|
||||
{
|
||||
"Description": "AWS",
|
||||
"StartLine": 37,
|
||||
"EndLine": 37,
|
||||
"StartColumn": 19,
|
||||
"EndColumn": 38,
|
||||
"Match": "\t\t\"aws_secret= \\\"AKIAIMNOJVGFDXXXE4OA\\\"\": true,",
|
||||
"Secret": "AKIAIMNOJVGFDXXXE4OA",
|
||||
"File": "checks_test.go",
|
||||
"Commit": "ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29",
|
||||
"Entropy": 0,
|
||||
"Author": "zricethezav",
|
||||
"Email": "thisispublicanyways@gmail.com",
|
||||
"Date": "2018-01-28 17:39:00 -0500 -0500",
|
||||
"Message": "[update] entropy check",
|
||||
"Tags": [],
|
||||
"RuleID": "aws-access-token"
|
||||
}
|
||||
|
||||
```
|
||||
0: no leaks
|
||||
1: leaks present
|
||||
2: error encountered
|
||||
We can use the following format to verify the leak:
|
||||
|
||||
```
|
||||
git log -L {StartLine,EndLine}:{File} {Commit}
|
||||
```
|
||||
So in this example it would look like:
|
||||
```
|
||||
git log -L 37,37:checks_test.go ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
|
||||
```
|
||||
Which gives us:
|
||||
|
||||
```
|
||||
commit ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
|
||||
Author: zricethezav <thisispublicanyways@gmail.com>
|
||||
Date: Sun Jan 28 17:39:00 2018 -0500
|
||||
|
||||
[update] entropy check
|
||||
|
||||
diff --git a/checks_test.go b/checks_test.go
|
||||
--- a/checks_test.go
|
||||
+++ b/checks_test.go
|
||||
@@ -28,0 +37,1 @@
|
||||
+ "aws_secret= \"AKIAIMNOJVGFDXXXE4OA\"": true,
|
||||
|
||||
```
|
||||
|
||||
### Additional information
|
||||
* Additional documentation about how gitleaks functions can be found on the [wiki page](https://github.com/zricethezav/gitleaks/wiki)
|
||||
* The below links detail the various approaches to remediating unwanted data in git repos
|
||||
* [Removing sensitive data from a repository (github.com)](https://help.github.com/articles/removing-sensitive-data-from-a-repository/)
|
||||
* [Removing sensitive files from commit history (atlassian.com)](https://community.atlassian.com/t5/Bitbucket-questions/Remove-sensitive-files-from-commit-history/qaq-p/243807)
|
||||
* [Rewrite git history with the BFG (theguardian.com)](https://www.theguardian.com/info/developer-blog/2013/apr/29/rewrite-git-history-with-the-bfg)
|
||||
* [Auditing Bitbucket Server Data for Credentials in AWS (sourcedgroup.com)](https://www.sourcedgroup.com/blog/auditing-bitbucket-server-data-credentials-in-aws)
|
||||
## Pre-Commit hook
|
||||
You can run Gitleaks as a pre-commit hook by copying the example `pre-commit.py` script into
|
||||
your `.git/hooks/` directory.
|
||||
|
||||
This blog post details how gitleaks was used to audit data in Atlassian Bitbucket server when hosted on AWS and visualise the results in a compliance dashboard using Splunk.
|
||||
## Configuration
|
||||
Gitleaks offers a configuration format you can follow to write your own secret detection rules:
|
||||
```toml
|
||||
# Title for the gitleaks configuration file.
|
||||
title = "Gitleaks title"
|
||||
|
||||
* How does gitleaks differ to Github token scanning?
|
||||
* [Github recently announced](https://blog.github.com/2018-10-16-future-of-software/#github-token-scanning-for-public-repositories-public-beta) a new capability to their cloud platform that detects exposed credentials for a number of common services and platforms and automatically notifies the provider for revocation or similar action. Gitleaks provides a similar detection capability for non-Github cloud users, in which repositories can be easily audited and results provided in a number of formats.
|
||||
# An array of tables that contain information that define instructions
|
||||
# on how to detect secrets
|
||||
[[rules]]
|
||||
# Unique identifier for this rule
|
||||
id = "awesome-rule-1"
|
||||
# Short human readable description of the rule.
|
||||
description = "awsome rule 1"
|
||||
# Golang regular expression used to detect secrets. Note Golang's regex engine
|
||||
# does not support lookaheads.
|
||||
regex = '''one-go-style-regex-for-this-rule'''
|
||||
# Golang regular expression used to match paths. This can be used as a standalone rule or it can be used
|
||||
# in conjunction with a valid `regex` entry.
|
||||
path = '''a-file-path-regex'''
|
||||
# Array of strings used for metadata and reporting purposes.
|
||||
tags = ["tag","another tag"]
|
||||
# Int used to extract secret from regex match and used as the group that will have
|
||||
# its entropy checked if `entropy` is set.
|
||||
secretGroup = 3
|
||||
# Float representing the minimum shannon entropy a regex group must have to be considered a secret.
|
||||
entropy = 3.5
|
||||
# You can include an allowlist table for a single rule to reduce false positives or ignore commits
|
||||
# with known/rotated secrets
|
||||
[rules.allowlist]
|
||||
description = "ignore commit A"
|
||||
commits = [ "commit-A", "commit-B"]
|
||||
paths = ['''one-file-path-regex''']
|
||||
regexes = ['''one-regex-within-the-already-matched-regex''']
|
||||
|
||||
### Give Thanks
|
||||
If using gitleaks has made you job easier consider donating to an organization, C-U at Home, that does vital work for those who most need it in the community of Champaign-Urbana, IL (my home).
|
||||
# This is a global allowlist which has a higher order of precendence than rule-specific allowlists.
|
||||
# If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
|
||||
# secrets will be detected for said commit. The same logic applies for regexes and paths.
|
||||
[allowlist]
|
||||
description = "ignore commit A"
|
||||
commits = [ "commit-A", "commit-B"]
|
||||
paths = ['''one-file-path-regex''']
|
||||
regexes = ['''one-regex-within-the-already-matched-regex''']
|
||||
```
|
||||
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples and advice on writing regular expressions for secret detection.
|
||||
|
||||
Donate: https://www.cuathome.us/give/
|
||||
### Tips on Writing Regular Expressions
|
||||
Gitleaks rules are defined by regular expressions and entropy ranges.
|
||||
Some secrets have unique signatures which make detecting those secrets easy.
|
||||
Examples of those secrets would be Gitlab Personal Access Tokens, AWS keys, and Github Access Tokens.
|
||||
All these examples have defined prefixes like `glpat`, `AKIA`, `ghp_`, etc.
|
||||
|
||||
Other secrets might just be a hash which means we need to write more complex rules to verify
|
||||
that what we are matching is a secret.
|
||||
|
||||
Here is an example of a semi-generic secret
|
||||
```
|
||||
discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"
|
||||
```
|
||||
We can write a regular expression to capture the variable name (identifier),
|
||||
the assignment symbol (like '=' or ':='), and finally the actual secret.
|
||||
The structure of a rule to match this example secret is below:
|
||||
|
||||
Beginning string
|
||||
quotation
|
||||
│ End string quotation
|
||||
│ │
|
||||
▼ ▼
|
||||
(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]
|
||||
|
||||
▲ ▲ ▲
|
||||
│ │ │
|
||||
│ │ │
|
||||
identifier assignment symbol
|
||||
Secret
|
||||
|
||||
|
||||
#### A Note on Generic Secrets
|
||||
Let's continue with the example `discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"`.
|
||||
This secret would match both the `discord-client-secret` rule and the `generic-api-key` rule in the default config.
|
||||
```
|
||||
[[rules]]
|
||||
id = "discord-client-secret"
|
||||
description = "Discord client secret"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "generic-api-key"
|
||||
description = "Generic API Key"
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
entropy = 3.7
|
||||
secretGroup = 4
|
||||
```
|
||||
If gitleaks encountered `discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"`, only the `discord` rule would report a finding because
|
||||
the generic rule has the string `generic` somewhere in the rule's `id`. If a secret is encountered and both a `generic` and non-generic rule have discovered the same secret, the non-generic
|
||||
will be given precedence.
|
||||
|
||||
|
||||
## Sponsorships
|
||||
[](https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks)
|
||||
|
||||
|
||||
## Exit Codes
|
||||
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
|
||||
```
|
||||
0 - no leaks present
|
||||
1 - leaks or error encountered
|
||||
126 - unknown flag
|
||||
```
|
||||
@@ -0,0 +1,93 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/detect"
|
||||
"github.com/zricethezav/gitleaks/v8/git"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(detectCmd)
|
||||
detectCmd.Flags().String("log-opts", "", "git log options")
|
||||
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
|
||||
}
|
||||
|
||||
var detectCmd = &cobra.Command{
|
||||
Use: "detect",
|
||||
Short: "detect secrets in code",
|
||||
Run: runDetect,
|
||||
}
|
||||
|
||||
func runDetect(cmd *cobra.Command, args []string) {
|
||||
initConfig()
|
||||
var (
|
||||
vc config.ViperConfig
|
||||
findings []report.Finding
|
||||
err error
|
||||
)
|
||||
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, err := vc.Translate()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to load config")
|
||||
}
|
||||
|
||||
cfg.Path, _ = cmd.Flags().GetString("config")
|
||||
source, _ := cmd.Flags().GetString("source")
|
||||
logOpts, _ := cmd.Flags().GetString("log-opts")
|
||||
verbose, _ := cmd.Flags().GetBool("verbose")
|
||||
redact, _ := cmd.Flags().GetBool("redact")
|
||||
noGit, _ := cmd.Flags().GetBool("no-git")
|
||||
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
||||
if cfg.Path == "" {
|
||||
cfg.Path = filepath.Join(source, ".gitleaks.toml")
|
||||
}
|
||||
start := time.Now()
|
||||
|
||||
if noGit {
|
||||
if logOpts != "" {
|
||||
log.Fatal().Err(err).Msg("--log-opts cannot be used with --no-git")
|
||||
}
|
||||
findings, err = detect.FromFiles(source, cfg, detect.Options{
|
||||
Verbose: verbose,
|
||||
Redact: redact,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to scan files")
|
||||
}
|
||||
} else {
|
||||
files, err := git.GitLog(source, logOpts)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to get git log")
|
||||
}
|
||||
|
||||
findings = detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact})
|
||||
}
|
||||
|
||||
if len(findings) != 0 {
|
||||
log.Warn().Msgf("leaks found: %d", len(findings))
|
||||
} else {
|
||||
log.Info().Msg("no leaks found")
|
||||
}
|
||||
|
||||
log.Info().Msgf("scan completed in %s", time.Since(start))
|
||||
|
||||
reportPath, _ := cmd.Flags().GetString("report-path")
|
||||
ext, _ := cmd.Flags().GetString("report-format")
|
||||
if reportPath != "" {
|
||||
report.Write(findings, cfg, ext, reportPath)
|
||||
}
|
||||
|
||||
if len(findings) != 0 {
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/detect"
|
||||
"github.com/zricethezav/gitleaks/v8/git"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
func init() {
|
||||
protectCmd.Flags().Bool("staged", false, "detect secrets in a --staged state")
|
||||
rootCmd.AddCommand(protectCmd)
|
||||
}
|
||||
|
||||
var protectCmd = &cobra.Command{
|
||||
Use: "protect",
|
||||
Short: "protect secrets in code",
|
||||
Run: runProtect,
|
||||
}
|
||||
|
||||
func runProtect(cmd *cobra.Command, args []string) {
|
||||
initConfig()
|
||||
var vc config.ViperConfig
|
||||
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, err := vc.Translate()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to load config")
|
||||
}
|
||||
|
||||
cfg.Path, _ = cmd.Flags().GetString("config")
|
||||
source, _ := cmd.Flags().GetString("source")
|
||||
verbose, _ := cmd.Flags().GetBool("verbose")
|
||||
redact, _ := cmd.Flags().GetBool("redact")
|
||||
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
||||
staged, _ := cmd.Flags().GetBool("staged")
|
||||
if cfg.Path == "" {
|
||||
cfg.Path = filepath.Join(source, ".gitleaks.toml")
|
||||
}
|
||||
start := time.Now()
|
||||
|
||||
files, err := git.GitDiff(source, staged)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to get git log")
|
||||
}
|
||||
|
||||
findings := detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact})
|
||||
if len(findings) != 0 {
|
||||
log.Warn().Msgf("leaks found: %d", len(findings))
|
||||
} else {
|
||||
log.Info().Msg("no leaks found")
|
||||
}
|
||||
|
||||
log.Info().Msgf("scan duration: %s", time.Since(start))
|
||||
|
||||
reportPath, _ := cmd.Flags().GetString("report-path")
|
||||
ext, _ := cmd.Flags().GetString("report-format")
|
||||
if reportPath != "" {
|
||||
report.Write(findings, cfg, ext, reportPath)
|
||||
}
|
||||
if len(findings) != 0 {
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
const banner = `
|
||||
○
|
||||
│╲
|
||||
│ ○
|
||||
○ ░
|
||||
░ gitleaks
|
||||
|
||||
`
|
||||
|
||||
const configDescription = `config file path
|
||||
order of precedence:
|
||||
1. --config/-c
|
||||
2. env var GITLEAKS_CONFIG
|
||||
3. (--source/-s)/.gitleaks.toml
|
||||
If none of the three options are used, then gitleaks will use the default config`
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "gitleaks",
|
||||
Short: "Gitleaks scans code, past or present, for secrets",
|
||||
}
|
||||
|
||||
func init() {
|
||||
cobra.OnInitialize(initLog)
|
||||
rootCmd.PersistentFlags().StringP("config", "c", "", configDescription)
|
||||
rootCmd.PersistentFlags().Int("exit-code", 1, "exit code when leaks have been encountered")
|
||||
rootCmd.PersistentFlags().StringP("source", "s", ".", "path to source (default: $PWD)")
|
||||
rootCmd.PersistentFlags().StringP("report-path", "r", "", "report file")
|
||||
rootCmd.PersistentFlags().StringP("report-format", "f", "json", "output format (json, csv, sarif)")
|
||||
rootCmd.PersistentFlags().StringP("log-level", "l", "info", "log level (debug, info, warn, error, fatal)")
|
||||
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "show verbose output from scan")
|
||||
rootCmd.PersistentFlags().Bool("redact", false, "redact secrets from logs and stdout")
|
||||
viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))
|
||||
}
|
||||
|
||||
func initLog() {
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
ll, err := rootCmd.Flags().GetString("log-level")
|
||||
if err != nil {
|
||||
log.Fatal().Msg(err.Error())
|
||||
}
|
||||
switch strings.ToLower(ll) {
|
||||
case "debug":
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
case "info":
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
case "warn":
|
||||
zerolog.SetGlobalLevel(zerolog.WarnLevel)
|
||||
case "err", "error":
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
case "fatal":
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
default:
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
}
|
||||
}
|
||||
|
||||
func initConfig() {
|
||||
fmt.Fprintf(os.Stderr, banner)
|
||||
cfgPath, err := rootCmd.Flags().GetString("config")
|
||||
if err != nil {
|
||||
log.Fatal().Msg(err.Error())
|
||||
}
|
||||
if cfgPath != "" {
|
||||
viper.SetConfigFile(cfgPath)
|
||||
log.Debug().Msgf("Using gitleaks config %s from `--config`", cfgPath)
|
||||
} else if os.Getenv("GITLEAKS_CONFIG") != "" {
|
||||
envPath := os.Getenv("GITLEAKS_CONFIG")
|
||||
viper.SetConfigFile(envPath)
|
||||
log.Debug().Msgf("Using gitleaks config from GITLEAKS_CONFIG env var: %s", envPath)
|
||||
} else {
|
||||
source, err := rootCmd.Flags().GetString("source")
|
||||
if err != nil {
|
||||
log.Fatal().Msg(err.Error())
|
||||
}
|
||||
fileInfo, err := os.Stat(source)
|
||||
if err != nil {
|
||||
log.Fatal().Msg(err.Error())
|
||||
}
|
||||
|
||||
if !fileInfo.IsDir() {
|
||||
log.Debug().Msgf("Unable to load gitleaks config from %s since --source=%s is a file, using default config",
|
||||
filepath.Join(source, ".gitleaks.toml"), source)
|
||||
viper.SetConfigType("toml")
|
||||
viper.ReadConfig(strings.NewReader(config.DefaultConfig))
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := os.Stat(filepath.Join(source, ".gitleaks.toml")); os.IsNotExist(err) {
|
||||
log.Debug().Msgf("No gitleaks config found in path %s, using default gitleaks config", filepath.Join(source, ".gitleaks.toml"))
|
||||
viper.SetConfigType("toml")
|
||||
viper.ReadConfig(strings.NewReader(config.DefaultConfig))
|
||||
return
|
||||
} else {
|
||||
log.Debug().Msgf("Using existing gitleaks config %s from `(--source)/.gitleaks.toml`", filepath.Join(source, ".gitleaks.toml"))
|
||||
}
|
||||
|
||||
viper.AddConfigPath(source)
|
||||
viper.SetConfigName(".gitleaks")
|
||||
viper.SetConfigType("toml")
|
||||
}
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
log.Fatal().Msgf("Unable to load gitleaks config, err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
if strings.Contains(err.Error(), "unknown flag") {
|
||||
// exit code 126: Command invoked cannot execute
|
||||
os.Exit(126)
|
||||
}
|
||||
log.Fatal().Msg(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Version = "version is set by build process"
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "display gitleaks version",
|
||||
Run: runVersion,
|
||||
}
|
||||
|
||||
func runVersion(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(Version)
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package config
|
||||
|
||||
import "regexp"
|
||||
|
||||
type Allowlist struct {
|
||||
Description string
|
||||
Regexes []*regexp.Regexp
|
||||
Paths []*regexp.Regexp
|
||||
Commits []string
|
||||
}
|
||||
|
||||
func (a *Allowlist) CommitAllowed(c string) bool {
|
||||
if c == "" {
|
||||
return false
|
||||
}
|
||||
for _, commit := range a.Commits {
|
||||
if commit == c {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *Allowlist) PathAllowed(path string) bool {
|
||||
if anyRegexMatch(path, a.Paths) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *Allowlist) RegexAllowed(s string) bool {
|
||||
if anyRegexMatch(s, a.Regexes) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCommitAllowed(t *testing.T) {
|
||||
tests := []struct {
|
||||
allowlist Allowlist
|
||||
commit string
|
||||
commitAllowed bool
|
||||
}{
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Commits: []string{"commitA"},
|
||||
},
|
||||
commit: "commitA",
|
||||
commitAllowed: true,
|
||||
},
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Commits: []string{"commitB"},
|
||||
},
|
||||
commit: "commitA",
|
||||
commitAllowed: false,
|
||||
},
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Commits: []string{"commitB"},
|
||||
},
|
||||
commit: "",
|
||||
commitAllowed: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
assert.Equal(t, tt.commitAllowed, tt.allowlist.CommitAllowed(tt.commit))
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegexAllowed(t *testing.T) {
|
||||
tests := []struct {
|
||||
allowlist Allowlist
|
||||
secret string
|
||||
regexAllowed bool
|
||||
}{
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Regexes: []*regexp.Regexp{regexp.MustCompile("matchthis")},
|
||||
},
|
||||
secret: "a secret: matchthis, done",
|
||||
regexAllowed: true,
|
||||
},
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Regexes: []*regexp.Regexp{regexp.MustCompile("matchthis")},
|
||||
},
|
||||
secret: "a secret",
|
||||
regexAllowed: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
assert.Equal(t, tt.regexAllowed, tt.allowlist.RegexAllowed(tt.secret))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathAllowed(t *testing.T) {
|
||||
tests := []struct {
|
||||
allowlist Allowlist
|
||||
path string
|
||||
pathAllowed bool
|
||||
}{
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Paths: []*regexp.Regexp{regexp.MustCompile("path")},
|
||||
},
|
||||
path: "a path",
|
||||
pathAllowed: true,
|
||||
},
|
||||
{
|
||||
allowlist: Allowlist{
|
||||
Paths: []*regexp.Regexp{regexp.MustCompile("path")},
|
||||
},
|
||||
path: "a ???",
|
||||
pathAllowed: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
assert.Equal(t, tt.pathAllowed, tt.allowlist.PathAllowed(tt.path))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
//go:embed gitleaks.toml
|
||||
var DefaultConfig string
|
||||
|
||||
// ViperConfig is the config struct used by the Viper config package
|
||||
// to parse the config file. This struct does not include regular expressions.
|
||||
// It is used as an intermediary to convert the Viper config to the Config struct.
|
||||
type ViperConfig struct {
|
||||
Description string
|
||||
Rules []struct {
|
||||
ID string
|
||||
Description string
|
||||
Entropy float64
|
||||
SecretGroup int
|
||||
Regex string
|
||||
Path string
|
||||
Tags []string
|
||||
|
||||
Allowlist struct {
|
||||
Regexes []string
|
||||
Paths []string
|
||||
Commits []string
|
||||
}
|
||||
}
|
||||
Allowlist struct {
|
||||
Regexes []string
|
||||
Paths []string
|
||||
Commits []string
|
||||
}
|
||||
}
|
||||
|
||||
// Config is a configuration struct that contains rules and an allowlist if present.
|
||||
type Config struct {
|
||||
Path string
|
||||
Description string
|
||||
Rules []*Rule
|
||||
Allowlist Allowlist
|
||||
}
|
||||
|
||||
func (vc *ViperConfig) Translate() (Config, error) {
|
||||
var rules []*Rule
|
||||
for _, r := range vc.Rules {
|
||||
var allowlistRegexes []*regexp.Regexp
|
||||
for _, a := range r.Allowlist.Regexes {
|
||||
allowlistRegexes = append(allowlistRegexes, regexp.MustCompile(a))
|
||||
}
|
||||
var allowlistPaths []*regexp.Regexp
|
||||
for _, a := range r.Allowlist.Paths {
|
||||
allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
|
||||
}
|
||||
|
||||
if r.Tags == nil {
|
||||
r.Tags = []string{}
|
||||
}
|
||||
|
||||
var configRegex *regexp.Regexp
|
||||
var configPathRegex *regexp.Regexp
|
||||
if r.Regex == "" {
|
||||
configRegex = nil
|
||||
} else {
|
||||
configRegex = regexp.MustCompile(r.Regex)
|
||||
}
|
||||
if r.Path == "" {
|
||||
configPathRegex = nil
|
||||
} else {
|
||||
configPathRegex = regexp.MustCompile(r.Path)
|
||||
}
|
||||
r := &Rule{
|
||||
Description: r.Description,
|
||||
RuleID: r.ID,
|
||||
Regex: configRegex,
|
||||
Path: configPathRegex,
|
||||
SecretGroup: r.SecretGroup,
|
||||
Entropy: r.Entropy,
|
||||
Tags: r.Tags,
|
||||
Allowlist: Allowlist{
|
||||
Regexes: allowlistRegexes,
|
||||
Paths: allowlistPaths,
|
||||
Commits: r.Allowlist.Commits,
|
||||
},
|
||||
}
|
||||
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
|
||||
return Config{}, fmt.Errorf("%s invalid regex secret group %d, max regex secret group %d", r.Description, r.SecretGroup, r.Regex.NumSubexp())
|
||||
}
|
||||
rules = append(rules, r)
|
||||
|
||||
}
|
||||
var allowlistRegexes []*regexp.Regexp
|
||||
for _, a := range vc.Allowlist.Regexes {
|
||||
allowlistRegexes = append(allowlistRegexes, regexp.MustCompile(a))
|
||||
}
|
||||
var allowlistPaths []*regexp.Regexp
|
||||
for _, a := range vc.Allowlist.Paths {
|
||||
allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
|
||||
}
|
||||
return Config{
|
||||
Description: vc.Description,
|
||||
Rules: rules,
|
||||
Allowlist: Allowlist{
|
||||
Regexes: allowlistRegexes,
|
||||
Paths: allowlistPaths,
|
||||
Commits: vc.Allowlist.Commits,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const configPath = "../testdata/config/"
|
||||
|
||||
func TestTranslate(t *testing.T) {
|
||||
tests := []struct {
|
||||
cfgName string
|
||||
cfg Config
|
||||
wantError error
|
||||
}{
|
||||
{
|
||||
cfgName: "allow_aws_re",
|
||||
cfg: Config{
|
||||
Rules: []*Rule{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||
Tags: []string{"key", "AWS"},
|
||||
RuleID: "aws-access-key",
|
||||
Allowlist: Allowlist{
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile("AKIALALEMEL33243OLIA"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_commit",
|
||||
cfg: Config{
|
||||
Rules: []*Rule{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||
Tags: []string{"key", "AWS"},
|
||||
RuleID: "aws-access-key",
|
||||
Allowlist: Allowlist{
|
||||
Commits: []string{"allowthiscommit"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_path",
|
||||
cfg: Config{
|
||||
Rules: []*Rule{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||
Tags: []string{"key", "AWS"},
|
||||
RuleID: "aws-access-key",
|
||||
Allowlist: Allowlist{
|
||||
Paths: []*regexp.Regexp{
|
||||
regexp.MustCompile(".go"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "entropy_group",
|
||||
cfg: Config{
|
||||
Rules: []*Rule{
|
||||
{
|
||||
Description: "Discord API key",
|
||||
Regex: regexp.MustCompile(`(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]`),
|
||||
RuleID: "discord-api-key",
|
||||
Allowlist: Allowlist{},
|
||||
Entropy: 3.5,
|
||||
SecretGroup: 3,
|
||||
Tags: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "bad_entropy_group",
|
||||
cfg: Config{},
|
||||
wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
viper.Reset()
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName(tt.cfgName)
|
||||
viper.SetConfigType("toml")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var vc ViperConfig
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, err := vc.Translate()
|
||||
if tt.wantError != nil {
|
||||
if err == nil {
|
||||
t.Errorf("expected error")
|
||||
}
|
||||
assert.Equal(t, tt.wantError, err)
|
||||
}
|
||||
|
||||
assert.Equal(t, cfg.Rules, tt.cfg.Rules)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIncludeEntropy(t *testing.T) {
|
||||
tests := []struct {
|
||||
rule Rule
|
||||
secret string
|
||||
entropy float32
|
||||
include bool
|
||||
}{
|
||||
{
|
||||
rule: Rule{
|
||||
RuleID: "generic-api-key",
|
||||
SecretGroup: 4,
|
||||
Entropy: 3.5,
|
||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||
},
|
||||
secret: `e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5`,
|
||||
entropy: 3.7906235872459746,
|
||||
include: true,
|
||||
},
|
||||
{
|
||||
rule: Rule{
|
||||
RuleID: "generic-api-key",
|
||||
SecretGroup: 4,
|
||||
Entropy: 4,
|
||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||
},
|
||||
secret: `e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5`,
|
||||
entropy: 3.7906235872459746,
|
||||
include: false,
|
||||
},
|
||||
{
|
||||
rule: Rule{
|
||||
RuleID: "generic-api-key",
|
||||
SecretGroup: 4,
|
||||
Entropy: 3.0,
|
||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||
},
|
||||
secret: `ssh-keyboard-interactive`,
|
||||
entropy: 0,
|
||||
include: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
include, entropy := tt.rule.IncludeEntropy(tt.secret)
|
||||
assert.Equal(t, true, tt.rule.EntropySet())
|
||||
assert.Equal(t, tt.entropy, float32(entropy))
|
||||
assert.Equal(t, tt.include, include)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,549 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
# Gitleaks rules are defined by regular expressions and entropy ranges.
|
||||
# Some secrets have unique signatures which make detecting those secrets easy.
|
||||
# Examples of those secrets would be Gitlab Personal Access Tokens, AWS keys, and Github Access Tokens.
|
||||
# All these examples have defined prefixes like `glpat`, `AKIA`, `ghp_`, etc.
|
||||
#
|
||||
# Other secrets might just be a hash which means we need to write more complex rules to verify
|
||||
# that what we are matching is a secret.
|
||||
#
|
||||
# Here is an example of a semi-generic secret
|
||||
#
|
||||
# discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"
|
||||
#
|
||||
# We can write a regular expression to capture the variable name (identifier),
|
||||
# the assignment symbol (like '=' or ':='), and finally the actual secret.
|
||||
# The structure of a rule to match this example secret is below:
|
||||
#
|
||||
# Beginning string
|
||||
# quotation
|
||||
# │ End string quotation
|
||||
# │ │
|
||||
# ▼ ▼
|
||||
# (?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]
|
||||
#
|
||||
# ▲ ▲ ▲
|
||||
# │ │ │
|
||||
# │ │ │
|
||||
# identifier assignment symbol
|
||||
# Secret
|
||||
#
|
||||
[[rules]]
|
||||
id = "gitlab-pat"
|
||||
description = "GitLab Personal Access Token"
|
||||
regex = '''glpat-[0-9a-zA-Z\-]{20}'''
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-token"
|
||||
description = "AWS"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
|
||||
# Cryptographic keys
|
||||
[[rules]]
|
||||
id = "PKCS8-PK"
|
||||
description = "PKCS8 private key"
|
||||
regex = '''-----BEGIN PRIVATE KEY-----'''
|
||||
|
||||
[[rules]]
|
||||
id = "RSA-PK"
|
||||
description = "RSA private key"
|
||||
regex = '''-----BEGIN RSA PRIVATE KEY-----'''
|
||||
|
||||
[[rules]]
|
||||
id = "OPENSSH-PK"
|
||||
description = "SSH private key"
|
||||
regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
||||
|
||||
[[rules]]
|
||||
id = "PGP-PK"
|
||||
description = "PGP private key"
|
||||
regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
|
||||
|
||||
[[rules]]
|
||||
id = "github-pat"
|
||||
description = "Github Personal Access Token"
|
||||
regex = '''ghp_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[rules]]
|
||||
id = "github-oauth"
|
||||
description = "Github OAuth Access Token"
|
||||
regex = '''gho_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[rules]]
|
||||
id = "SSH-DSA-PK"
|
||||
description = "SSH (DSA) private key"
|
||||
regex = '''-----BEGIN DSA PRIVATE KEY-----'''
|
||||
|
||||
[[rules]]
|
||||
id = "SSH-EC-PK"
|
||||
description = "SSH (EC) private key"
|
||||
regex = '''-----BEGIN EC PRIVATE KEY-----'''
|
||||
|
||||
|
||||
[[rules]]
|
||||
id = "github-app-token"
|
||||
description = "Github App Token"
|
||||
regex = '''(ghu|ghs)_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[rules]]
|
||||
id = "github-refresh-token"
|
||||
description = "Github Refresh Token"
|
||||
regex = '''ghr_[0-9a-zA-Z]{76}'''
|
||||
|
||||
[[rules]]
|
||||
id = "shopify-shared-secret"
|
||||
description = "Shopify shared secret"
|
||||
regex = '''shpss_[a-fA-F0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "shopify-access-token"
|
||||
description = "Shopify access token"
|
||||
regex = '''shpat_[a-fA-F0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "shopify-custom-access-token"
|
||||
description = "Shopify custom app access token"
|
||||
regex = '''shpca_[a-fA-F0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "shopify-private-app-access-token"
|
||||
description = "Shopify private app access token"
|
||||
regex = '''shppa_[a-fA-F0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "slack-access-token"
|
||||
description = "Slack token"
|
||||
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
|
||||
|
||||
[[rules]]
|
||||
id = "stripe-access-token"
|
||||
description = "Stripe"
|
||||
regex = '''(?i)(sk|pk)_(test|live)_[0-9a-z]{10,32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "pypi-upload-token"
|
||||
description = "PyPI upload token"
|
||||
regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}'''
|
||||
|
||||
[[rules]]
|
||||
id = "gcp-service-account"
|
||||
description = "Google (GCP) Service-account"
|
||||
regex = '''\"type\": \"service_account\"'''
|
||||
|
||||
[[rules]]
|
||||
id = "heroku-api-key"
|
||||
description = "Heroku API Key"
|
||||
regex = ''' (?i)(heroku[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "slack-web-hook"
|
||||
description = "Slack Webhook"
|
||||
regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{24}'''
|
||||
|
||||
[[rules]]
|
||||
id = "twilio-api-key"
|
||||
description = "Twilio API Key"
|
||||
regex = '''SK[0-9a-fA-F]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "age-secret-key"
|
||||
description = "Age secret key"
|
||||
regex = '''AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}'''
|
||||
|
||||
[[rules]]
|
||||
id = "facebook-token"
|
||||
description = "Facebook token"
|
||||
regex = '''(?i)(facebook[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "twitter-token"
|
||||
description = "Twitter token"
|
||||
regex = '''(?i)(twitter[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{35,44})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "adobe-client-id"
|
||||
description = "Adobe Client ID (Oauth Web)"
|
||||
regex = '''(?i)(adobe[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "adobe-client-secret"
|
||||
description = "Adobe Client Secret"
|
||||
regex = '''(p8e-)(?i)[a-z0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "alibaba-access-key-id"
|
||||
description = "Alibaba AccessKey ID"
|
||||
regex = '''(LTAI)(?i)[a-z0-9]{20}'''
|
||||
|
||||
[[rules]]
|
||||
id = "alibaba-secret-key"
|
||||
description = "Alibaba Secret Key"
|
||||
regex = '''(?i)(alibaba[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "asana-client-id"
|
||||
description = "Asana Client ID"
|
||||
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{16})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "asana-client-secret"
|
||||
description = "Asana Client Secret"
|
||||
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "atlassian-api-token"
|
||||
description = "Atlassian API token"
|
||||
regex = '''(?i)(atlassian[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{24})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "bitbucket-client-id"
|
||||
description = "Bitbucket client ID"
|
||||
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "bitbucket-client-secret"
|
||||
description = "Bitbucket client secret"
|
||||
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9_\-]{64})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "beamer-api-token"
|
||||
description = "Beamer API token"
|
||||
regex = '''(?i)(beamer[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](b_[a-z0-9=_\-]{44})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "clojars-api-token"
|
||||
description = "Clojars API token"
|
||||
regex = '''(CLOJARS_)(?i)[a-z0-9]{60}'''
|
||||
|
||||
[[rules]]
|
||||
id = "contentful-delivery-api-token"
|
||||
description = "Contentful delivery API token"
|
||||
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "contentful-preview-api-token"
|
||||
description = "Contentful preview API token"
|
||||
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "databricks-api-token"
|
||||
description = "Databricks API token"
|
||||
regex = '''dapi[a-h0-9]{32}'''
|
||||
|
||||
[[rules]]
|
||||
id = "discord-api-token"
|
||||
description = "Discord API key"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "discord-client-id"
|
||||
description = "Discord client ID"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{18})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "discord-client-secret"
|
||||
description = "Discord client secret"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "doppler-api-token"
|
||||
description = "Doppler API token"
|
||||
regex = '''['\"](dp\.pt\.)(?i)[a-z0-9]{43}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "dropbox-api-secret"
|
||||
description = "Dropbox API secret/key"
|
||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{15})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "dropbox--api-key"
|
||||
description = "Dropbox API secret/key"
|
||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{15})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "dropbox-short-lived-api-token"
|
||||
description = "Dropbox short lived API token"
|
||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](sl\.[a-z0-9\-=_]{135})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "dropbox-long-lived-api-token"
|
||||
description = "Dropbox long lived API token"
|
||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"][a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "duffel-api-token"
|
||||
description = "Duffel API token"
|
||||
regex = '''['\"]duffel_(test|live)_(?i)[a-z0-9_-]{43}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "dynatrace-api-token"
|
||||
description = "Dynatrace API token"
|
||||
regex = '''['\"]dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "easypost-api-token"
|
||||
description = "EasyPost API token"
|
||||
regex = '''['\"]EZAK(?i)[a-z0-9]{54}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "easypost-test-api-token"
|
||||
description = "EasyPost test API token"
|
||||
regex = '''['\"]EZTK(?i)[a-z0-9]{54}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "fastly-api-token"
|
||||
description = "Fastly API token"
|
||||
regex = '''(?i)(fastly[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "finicity-client-secret"
|
||||
description = "Finicity client secret"
|
||||
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{20})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "finicity-api-token"
|
||||
description = "Finicity API token"
|
||||
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "flutterweave-public-key"
|
||||
description = "Flutterweave public key"
|
||||
regex = '''FLWPUBK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||
|
||||
[[rules]]
|
||||
id = "flutterweave-secret-key"
|
||||
description = "Flutterweave secret key"
|
||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||
|
||||
[[rules]]
|
||||
id = "flutterweave-enc-key"
|
||||
description = "Flutterweave encrypted key"
|
||||
regex = '''FLWSECK_TEST[a-h0-9]{12}'''
|
||||
|
||||
[[rules]]
|
||||
id = "frameio-api-token"
|
||||
description = "Frame.io API token"
|
||||
regex = '''fio-u-(?i)[a-z0-9-_=]{64}'''
|
||||
|
||||
[[rules]]
|
||||
id = "gocardless-api-token"
|
||||
description = "GoCardless API token"
|
||||
regex = '''['\"]live_(?i)[a-z0-9-_=]{40}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "grafana-api-token"
|
||||
description = "Grafana API token"
|
||||
regex = '''['\"]eyJrIjoi(?i)[a-z0-9-_=]{72,92}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "hashicorp-tf-api-token"
|
||||
description = "Hashicorp Terraform user/org API token"
|
||||
regex = '''['\"](?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9-_=]{60,70}['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "hubspot-api-token"
|
||||
description = "Hubspot API token"
|
||||
regex = '''(?i)(hubspot[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "intercom-api-token"
|
||||
description = "Intercom API token"
|
||||
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_]{60})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "intercom-client-secret"
|
||||
description = "Intercom client secret/ID"
|
||||
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "ionic-api-token"
|
||||
description = "Ionic API token"
|
||||
regex = '''(?i)(ionic[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](ion_[a-z0-9]{42})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "linear-api-token"
|
||||
description = "Linear API token"
|
||||
regex = '''lin_api_(?i)[a-z0-9]{40}'''
|
||||
|
||||
[[rules]]
|
||||
id = "linear-client-secret"
|
||||
description = "Linear client secret/ID"
|
||||
regex = '''(?i)(linear[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "lob-api-key"
|
||||
description = "Lob API Key"
|
||||
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((live|test)_[a-f0-9]{35})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "lob-pub-api-key"
|
||||
description = "Lob Publishable API Key"
|
||||
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((test|live)_pub_[a-f0-9]{31})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "mailchimp-api-key"
|
||||
description = "Mailchimp API key"
|
||||
regex = '''(?i)(mailchimp[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32}-us20)['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "mailgun-private-api-token"
|
||||
description = "Mailgun private API token"
|
||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](key-[a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "mailgun-pub-key"
|
||||
description = "Mailgun public validation key"
|
||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](pubkey-[a-f0-9]{32})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "mailgun-signing-key"
|
||||
description = "Mailgun webhook signing key"
|
||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "mapbox-api-token"
|
||||
description = "Mapbox API token"
|
||||
regex = '''(?i)(pk\.[a-z0-9]{60}\.[a-z0-9]{22})'''
|
||||
|
||||
[[rules]]
|
||||
id = "messagebird-api-token"
|
||||
description = "MessageBird API token"
|
||||
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{25})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "messagebird-client-id"
|
||||
description = "MessageBird API client ID"
|
||||
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "new-relic-user-api-key"
|
||||
description = "New Relic user API Key"
|
||||
regex = '''['\"](NRAK-[A-Z0-9]{27})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "new-relic-user-api-id"
|
||||
description = "New Relic user API ID"
|
||||
regex = '''(?i)(newrelic[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([A-Z0-9]{64})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "new-relic-browser-api-token"
|
||||
description = "New Relic ingest browser API token"
|
||||
regex = '''['\"](NRJS-[a-f0-9]{19})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "npm-access-token"
|
||||
description = "npm access token"
|
||||
regex = '''['\"](npm_(?i)[a-z0-9]{36})['\"]'''
|
||||
|
||||
[[rules]]
|
||||
id = "planetscale-password"
|
||||
description = "Planetscale password"
|
||||
regex = '''pscale_pw_(?i)[a-z0-9\-_\.]{43}'''
|
||||
|
||||
[[rules]]
|
||||
id = "planetscale-api-token"
|
||||
description = "Planetscale API token"
|
||||
regex = '''pscale_tkn_(?i)[a-z0-9\-_\.]{43}'''
|
||||
|
||||
[[rules]]
|
||||
id = "postman-api-token"
|
||||
description = "Postman API token"
|
||||
regex = '''PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}'''
|
||||
|
||||
[[rules]]
|
||||
id = "pulumi-api-token"
|
||||
description = "Pulumi API token"
|
||||
regex = '''pul-[a-f0-9]{40}'''
|
||||
|
||||
[[rules]]
|
||||
id = "rubygems-api-token"
|
||||
description = "Rubygem API token"
|
||||
regex = '''rubygems_[a-f0-9]{48}'''
|
||||
|
||||
[[rules]]
|
||||
id = "sendgrid-api-token"
|
||||
description = "Sendgrid API token"
|
||||
regex = '''SG\.(?i)[a-z0-9_\-\.]{66}'''
|
||||
|
||||
[[rules]]
|
||||
id = "sendinblue-api-token"
|
||||
description = "Sendinblue API token"
|
||||
regex = '''xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}'''
|
||||
|
||||
[[rules]]
|
||||
id = "shippo-api-token"
|
||||
description = "Shippo API token"
|
||||
regex = '''shippo_(live|test)_[a-f0-9]{40}'''
|
||||
|
||||
[[rules]]
|
||||
id = "linedin-client-secret"
|
||||
description = "Linkedin Client secret"
|
||||
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z]{16})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "linedin-client-id"
|
||||
description = "Linkedin Client ID"
|
||||
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{14})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "twitch-api-token"
|
||||
description = "Twitch API token"
|
||||
regex = '''(?i)(twitch[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "typeform-api-token"
|
||||
description = "Typeform API token"
|
||||
regex = '''(?i)(typeform[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}(tfp_[a-z0-9\-_\.=]{59})'''
|
||||
secretGroup = 3
|
||||
|
||||
[[rules]]
|
||||
id = "generic-api-key"
|
||||
description = "Generic API Key"
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
entropy = 3.7
|
||||
secretGroup = 4
|
||||
|
||||
|
||||
[allowlist]
|
||||
description = "global allow lists"
|
||||
regexes = ['''219-09-9999''', '''078-05-1120''', '''(9[0-9]{2}|666)-\d{2}-\d{4}''']
|
||||
paths = [
|
||||
'''gitleaks.toml''',
|
||||
'''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$'''
|
||||
]
|
||||
@@ -0,0 +1,45 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Rule struct {
|
||||
Description string
|
||||
RuleID string
|
||||
Entropy float64
|
||||
SecretGroup int
|
||||
Regex *regexp.Regexp
|
||||
Path *regexp.Regexp
|
||||
Tags []string
|
||||
Allowlist Allowlist
|
||||
}
|
||||
|
||||
func (r *Rule) IncludeEntropy(secret string) (bool, float64) {
|
||||
// NOTE: this is a goofy hack to get around the fact there golang's regex engine
|
||||
// does not support positive lookaheads. Ideally we would want to add a
|
||||
// restriction on generic rules regex that requires the secret match group
|
||||
// contains both numbers and alphabetical characters. What this bit of code does is
|
||||
// check if the ruleid is prepended with "generic" and enforces the
|
||||
// secret contains both digits and alphabetical characters.
|
||||
if strings.HasPrefix(r.RuleID, "generic") {
|
||||
if !containsDigit(secret) {
|
||||
return false, 0.0
|
||||
}
|
||||
}
|
||||
// group = 0 will check the entropy of the whole regex match
|
||||
e := shannonEntropy(secret)
|
||||
if e > r.Entropy {
|
||||
return true, e
|
||||
}
|
||||
|
||||
return false, e
|
||||
}
|
||||
|
||||
func (r *Rule) EntropySet() bool {
|
||||
if r.Entropy == 0.0 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"math"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func anyRegexMatch(f string, res []*regexp.Regexp) bool {
|
||||
for _, re := range res {
|
||||
if regexMatched(f, re) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func regexMatched(f string, re *regexp.Regexp) bool {
|
||||
if re == nil {
|
||||
return false
|
||||
}
|
||||
if re.FindString(f) != "" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func containsDigit(s string) bool {
|
||||
for _, c := range s {
|
||||
switch c {
|
||||
case '1', '2', '3', '4', '5', '6', '7', '8', '9':
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// shannonEntropy calculates the entropy of data using the formula defined here:
|
||||
// https://en.wiktionary.org/wiki/Shannon_entropy
|
||||
// Another way to think about what this is doing is calculating the number of bits
|
||||
// needed to on average encode the data. So, the higher the entropy, the more random the data, the
|
||||
// more bits needed to encode that data.
|
||||
func shannonEntropy(data string) (entropy float64) {
|
||||
if data == "" {
|
||||
return 0
|
||||
}
|
||||
|
||||
charCounts := make(map[rune]int)
|
||||
for _, char := range data {
|
||||
charCounts[char]++
|
||||
}
|
||||
|
||||
invLength := 1.0 / float64(len(data))
|
||||
for _, count := range charCounts {
|
||||
freq := float64(count) * invLength
|
||||
entropy -= freq * math.Log2(freq)
|
||||
}
|
||||
|
||||
return entropy
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
Verbose bool
|
||||
Redact bool
|
||||
}
|
||||
|
||||
func DetectFindings(cfg config.Config, b []byte, filePath string, commit string) []report.Finding {
|
||||
var findings []report.Finding
|
||||
linePairs := regexp.MustCompile("\n").FindAllIndex(b, -1)
|
||||
|
||||
// check if we should skip file based on the global allowlist or if the file is the same as the gitleaks config
|
||||
if cfg.Allowlist.PathAllowed(filePath) || filePath == cfg.Path {
|
||||
return findings
|
||||
}
|
||||
|
||||
for _, r := range cfg.Rules {
|
||||
pathSkip := false
|
||||
if r.Allowlist.CommitAllowed(commit) {
|
||||
continue
|
||||
}
|
||||
if r.Allowlist.PathAllowed(filePath) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if path should be considered
|
||||
if r.Path != nil {
|
||||
if r.Path.Match([]byte(filePath)) {
|
||||
if r.Regex == nil {
|
||||
// This is a path only rule
|
||||
f := report.Finding{
|
||||
Description: r.Description,
|
||||
File: filePath,
|
||||
RuleID: r.RuleID,
|
||||
Match: fmt.Sprintf("file detected: %s", filePath),
|
||||
Tags: r.Tags,
|
||||
}
|
||||
findings = append(findings, f)
|
||||
pathSkip = true
|
||||
}
|
||||
} else {
|
||||
pathSkip = true
|
||||
}
|
||||
}
|
||||
if pathSkip {
|
||||
continue
|
||||
}
|
||||
|
||||
matchIndices := r.Regex.FindAllIndex(b, -1)
|
||||
for _, m := range matchIndices {
|
||||
location := getLocation(linePairs, m[0], m[1])
|
||||
secret := strings.Trim(string(b[m[0]:m[1]]), "\n")
|
||||
f := report.Finding{
|
||||
Description: r.Description,
|
||||
File: filePath,
|
||||
RuleID: r.RuleID,
|
||||
StartLine: location.startLine,
|
||||
EndLine: location.endLine,
|
||||
StartColumn: location.startColumn,
|
||||
EndColumn: location.endColumn,
|
||||
Secret: secret,
|
||||
Match: secret,
|
||||
Tags: r.Tags,
|
||||
}
|
||||
|
||||
if r.Allowlist.RegexAllowed(f.Secret) || cfg.Allowlist.RegexAllowed(f.Secret) {
|
||||
continue
|
||||
}
|
||||
|
||||
// extract secret from secret group if set
|
||||
if r.SecretGroup != 0 {
|
||||
groups := r.Regex.FindStringSubmatch(secret)
|
||||
if len(groups)-1 > r.SecretGroup || len(groups) == 0 {
|
||||
// Config validation should prevent this
|
||||
break
|
||||
}
|
||||
secret = groups[r.SecretGroup]
|
||||
f.Secret = secret
|
||||
}
|
||||
|
||||
// extract secret from secret group if set
|
||||
if r.EntropySet() {
|
||||
include, entropy := r.IncludeEntropy(secret)
|
||||
if include {
|
||||
f.Entropy = float32(entropy)
|
||||
findings = append(findings, f)
|
||||
}
|
||||
} else {
|
||||
findings = append(findings, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dedupe(findings)
|
||||
}
|
||||
|
||||
func limit(s string) string {
|
||||
if len(s) > 500 {
|
||||
return s[:500] + "..."
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func printFinding(f report.Finding) {
|
||||
var b []byte
|
||||
b, _ = json.MarshalIndent(f, "", " ")
|
||||
fmt.Println(string(b))
|
||||
}
|
||||
|
||||
func dedupe(findings []report.Finding) []report.Finding {
|
||||
var retFindings []report.Finding
|
||||
for _, f := range findings {
|
||||
include := true
|
||||
if strings.Contains(strings.ToLower(f.RuleID), "generic") {
|
||||
for _, fPrime := range findings {
|
||||
if f.StartLine == fPrime.StartLine &&
|
||||
f.EndLine == fPrime.EndLine &&
|
||||
f.Commit == fPrime.Commit &&
|
||||
f.RuleID != fPrime.RuleID &&
|
||||
strings.Contains(fPrime.Secret, f.Secret) &&
|
||||
!strings.Contains(strings.ToLower(fPrime.RuleID), "generic") {
|
||||
|
||||
genericMatch := strings.Replace(f.Match, f.Secret, "REDACTED", -1)
|
||||
betterMatch := strings.Replace(fPrime.Match, fPrime.Secret, "REDACTED", -1)
|
||||
log.Debug().Msgf("skipping %s finding (%s), %s rule takes precendence (%s)", f.RuleID, genericMatch, fPrime.RuleID, betterMatch)
|
||||
include = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if include {
|
||||
retFindings = append(retFindings, f)
|
||||
}
|
||||
}
|
||||
|
||||
return retFindings
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
func TestDetectFindings(t *testing.T) {
|
||||
tests := []struct {
|
||||
cfgName string
|
||||
opts Options
|
||||
filePath string
|
||||
bytes []byte
|
||||
commit string
|
||||
expectedFindings []report.Finding
|
||||
wantError error
|
||||
}{
|
||||
{
|
||||
cfgName: "simple",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
File: "tmp.go",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartColumn: 15,
|
||||
EndColumn: 34,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_aws_re",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_path",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_commit",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
commit: "allowthiscommit",
|
||||
},
|
||||
{
|
||||
cfgName: "entropy_group",
|
||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "Discord API key",
|
||||
Match: "Discord_Public_Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
||||
Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
|
||||
File: "tmp.go",
|
||||
RuleID: "discord-api-key",
|
||||
Tags: []string{},
|
||||
Entropy: 3.7906237,
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartColumn: 7,
|
||||
EndColumn: 93,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "generic_with_py_path",
|
||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
{
|
||||
cfgName: "generic_with_py_path",
|
||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||
filePath: "tmp.py",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "Generic API Key",
|
||||
Match: "Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
||||
Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
|
||||
File: "tmp.py",
|
||||
RuleID: "generic-api-key",
|
||||
Tags: []string{},
|
||||
Entropy: 3.7906237,
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartColumn: 22,
|
||||
EndColumn: 93,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "path_only",
|
||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||
filePath: "tmp.py",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "Python Files",
|
||||
Match: "file detected: tmp.py",
|
||||
File: "tmp.py",
|
||||
RuleID: "python-files-only",
|
||||
Tags: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
cfgName: "bad_entropy_group",
|
||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
|
||||
},
|
||||
{
|
||||
cfgName: "simple",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: filepath.Join(configPath, "simple.toml"),
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
{
|
||||
cfgName: "allow_global_aws_re",
|
||||
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||
filePath: "tmp.go",
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
viper.Reset()
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName(tt.cfgName)
|
||||
viper.SetConfigType("toml")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var vc config.ViperConfig
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, err := vc.Translate()
|
||||
cfg.Path = filepath.Join(configPath, tt.cfgName+".toml")
|
||||
if tt.wantError != nil {
|
||||
if err == nil {
|
||||
t.Errorf("expected error")
|
||||
}
|
||||
assert.Equal(t, tt.wantError, err)
|
||||
}
|
||||
|
||||
findings := DetectFindings(cfg, tt.bytes, tt.filePath, tt.commit)
|
||||
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
godocutil "golang.org/x/tools/godoc/util"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
// FromFiles opens the directory or file specified in source and checks each file against the rules
|
||||
// from the configuration. If any secrets are found, they are added to the list of findings.
|
||||
func FromFiles(source string, cfg config.Config, outputOptions Options) ([]report.Finding, error) {
|
||||
var (
|
||||
findings []report.Finding
|
||||
mu sync.Mutex
|
||||
)
|
||||
g, _ := errgroup.WithContext(context.Background())
|
||||
paths := make(chan string)
|
||||
g.Go(func() error {
|
||||
defer close(paths)
|
||||
return filepath.Walk(source,
|
||||
func(path string, fInfo os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if fInfo.Name() == ".git" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
if fInfo.Mode().IsRegular() {
|
||||
paths <- path
|
||||
}
|
||||
return nil
|
||||
})
|
||||
})
|
||||
for pa := range paths {
|
||||
p := pa
|
||||
g.Go(func() error {
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !godocutil.IsText(b) {
|
||||
return nil
|
||||
}
|
||||
fis := DetectFindings(cfg, b, p, "")
|
||||
for _, fi := range fis {
|
||||
// need to add 1 since line counting starts at 1
|
||||
fi.StartLine++
|
||||
fi.EndLine++
|
||||
|
||||
if outputOptions.Redact {
|
||||
fi.Redact()
|
||||
}
|
||||
if outputOptions.Verbose {
|
||||
printFinding(fi)
|
||||
}
|
||||
mu.Lock()
|
||||
findings = append(findings, fi)
|
||||
mu.Unlock()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
if err := g.Wait(); err != nil {
|
||||
return findings, err
|
||||
}
|
||||
|
||||
return findings, nil
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
// TestFromGit tests the FromGit function
|
||||
func TestFromFiles(t *testing.T) {
|
||||
tests := []struct {
|
||||
cfgName string
|
||||
opts Options
|
||||
source string
|
||||
expectedFindings []report.Finding
|
||||
}{
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "nogit"),
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 20,
|
||||
EndLine: 20,
|
||||
StartColumn: 16,
|
||||
EndColumn: 35,
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
File: "../testdata/repos/nogit/main.go",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "nogit", "main.go"),
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 20,
|
||||
EndLine: 20,
|
||||
StartColumn: 16,
|
||||
EndColumn: 35,
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
File: "../testdata/repos/nogit/main.go",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName("simple")
|
||||
viper.SetConfigType("toml")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var vc config.ViperConfig
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, _ := vc.Translate()
|
||||
|
||||
findings, err := FromFiles(tt.source, cfg, tt.opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
godocutil "golang.org/x/tools/godoc/util"
|
||||
)
|
||||
|
||||
// FromGit accepts a gitdiff.File channel (structure output from `git log -p`) and a configuration
|
||||
// struct. Files from the gitdiff.File channel are then checked against each rule in the configuration to
|
||||
// check for secrets. If any secrets are found, they are added to the list of findings.
|
||||
func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Options) []report.Finding {
|
||||
var findings []report.Finding
|
||||
mu := sync.Mutex{}
|
||||
wg := sync.WaitGroup{}
|
||||
commitMap := make(map[string]bool)
|
||||
for f := range files {
|
||||
// keep track of commits for logging
|
||||
if f.PatchHeader != nil {
|
||||
commitMap[f.PatchHeader.SHA] = true
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
go func(f *gitdiff.File) {
|
||||
defer wg.Done()
|
||||
if f.IsBinary {
|
||||
return
|
||||
}
|
||||
|
||||
if f.IsDelete {
|
||||
return
|
||||
}
|
||||
|
||||
commitSHA := ""
|
||||
|
||||
// Check if commit is allowed
|
||||
if f.PatchHeader != nil {
|
||||
commitSHA = f.PatchHeader.SHA
|
||||
if cfg.Allowlist.CommitAllowed(f.PatchHeader.SHA) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for _, tf := range f.TextFragments {
|
||||
if f.TextFragments == nil {
|
||||
// TODO fix this in gitleaks gitdiff fork
|
||||
// https://github.com/gitleaks/gitleaks/issues/11
|
||||
continue
|
||||
}
|
||||
|
||||
if !godocutil.IsText([]byte(tf.Raw(gitdiff.OpAdd))) {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, fi := range DetectFindings(cfg, []byte(tf.Raw(gitdiff.OpAdd)), f.NewName, commitSHA) {
|
||||
// don't add to start/end lines if finding is from a file only rule
|
||||
if !strings.HasPrefix(fi.Match, "file detected") {
|
||||
fi.StartLine += int(tf.NewPosition)
|
||||
fi.EndLine += int(tf.NewPosition)
|
||||
}
|
||||
if f.PatchHeader != nil {
|
||||
fi.Commit = f.PatchHeader.SHA
|
||||
fi.Message = f.PatchHeader.Message()
|
||||
if f.PatchHeader.Author != nil {
|
||||
fi.Author = f.PatchHeader.Author.Name
|
||||
fi.Email = f.PatchHeader.Author.Email
|
||||
}
|
||||
fi.Date = f.PatchHeader.AuthorDate.UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
if outputOptions.Redact {
|
||||
fi.Redact()
|
||||
}
|
||||
|
||||
if outputOptions.Verbose {
|
||||
printFinding(fi)
|
||||
}
|
||||
mu.Lock()
|
||||
findings = append(findings, fi)
|
||||
mu.Unlock()
|
||||
|
||||
}
|
||||
}
|
||||
}(f)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
log.Debug().Msgf("%d commits scanned. Note: this number might be smaller than expected due to commits with no additions", len(commitMap))
|
||||
return findings
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/git"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
)
|
||||
|
||||
const repoBasePath = "../testdata/repos/"
|
||||
const expectPath = "../testdata/expected/"
|
||||
const configPath = "../testdata/config/"
|
||||
|
||||
// TestFromGit tests the FromGit function
|
||||
func TestFromGit(t *testing.T) {
|
||||
tests := []struct {
|
||||
cfgName string
|
||||
opts Options
|
||||
source string
|
||||
logOpts string
|
||||
expected string
|
||||
expectedFindings []report.Finding
|
||||
}{
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "small"),
|
||||
expected: filepath.Join(expectPath, "git", "small.txt"),
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 20,
|
||||
EndLine: 20,
|
||||
StartColumn: 19,
|
||||
EndColumn: 38,
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
File: "main.go",
|
||||
Date: "2021-11-02T23:37:53Z",
|
||||
Commit: "1b6da43b82b22e4eaa10bcf8ee591e91abbfc587",
|
||||
Author: "Zachary Rice",
|
||||
Email: "zricer@protonmail.com",
|
||||
Message: "Accidentally add a secret",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
},
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 9,
|
||||
EndLine: 9,
|
||||
StartColumn: 17,
|
||||
EndColumn: 36,
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
File: "foo/foo.go",
|
||||
Date: "2021-11-02T23:48:06Z",
|
||||
Commit: "491504d5a31946ce75e22554cc34203d8e5ff3ca",
|
||||
Author: "Zach Rice",
|
||||
Email: "zricer@protonmail.com",
|
||||
Message: "adding foo package with secret",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "small"),
|
||||
expected: filepath.Join(expectPath, "git", "small-branch-foo.txt"),
|
||||
logOpts: "--all foo...",
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 9,
|
||||
EndLine: 9,
|
||||
StartColumn: 17,
|
||||
EndColumn: 36,
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
Date: "2021-11-02T23:48:06Z",
|
||||
File: "foo/foo.go",
|
||||
Commit: "491504d5a31946ce75e22554cc34203d8e5ff3ca",
|
||||
Author: "Zach Rice",
|
||||
Email: "zricer@protonmail.com",
|
||||
Message: "adding foo package with secret",
|
||||
RuleID: "aws-access-key",
|
||||
Tags: []string{"key", "AWS"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := moveDotGit("dotGit", ".git")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer moveDotGit(".git", "dotGit")
|
||||
|
||||
for _, tt := range tests {
|
||||
files, err := git.GitLog(tt.source, tt.logOpts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName("simple")
|
||||
viper.SetConfigType("toml")
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var vc config.ViperConfig
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, _ := vc.Translate()
|
||||
|
||||
findings := FromGit(files, cfg, tt.opts)
|
||||
for _, f := range findings {
|
||||
f.Match = "" // remove lines cause copying and pasting them has some wack formatting
|
||||
}
|
||||
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
||||
}
|
||||
}
|
||||
|
||||
func moveDotGit(from, to string) error {
|
||||
repoDirs, err := os.ReadDir("../testdata/repos")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, dir := range repoDirs {
|
||||
if to == ".git" {
|
||||
_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), "dotGit"))
|
||||
if os.IsNotExist(err) {
|
||||
// dont want to delete the only copy of .git accidentally
|
||||
continue
|
||||
}
|
||||
os.RemoveAll(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), ".git"))
|
||||
}
|
||||
if !dir.IsDir() {
|
||||
continue
|
||||
}
|
||||
_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from))
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
|
||||
err = os.Rename(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from),
|
||||
fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), to))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package detect
|
||||
|
||||
// Location represents a location in a file
|
||||
type Location struct {
|
||||
startLine int
|
||||
endLine int
|
||||
startColumn int
|
||||
endColumn int
|
||||
startLineIndex int
|
||||
endLineIndex int
|
||||
}
|
||||
|
||||
func getLocation(linePairs [][]int, start int, end int) Location {
|
||||
var (
|
||||
prevNewLine int
|
||||
location Location
|
||||
lineSet bool
|
||||
_lineNum int
|
||||
)
|
||||
|
||||
for lineNum, pair := range linePairs {
|
||||
_lineNum = lineNum
|
||||
newLineByteIndex := pair[0]
|
||||
if prevNewLine <= start && start < newLineByteIndex {
|
||||
lineSet = true
|
||||
location.startLine = lineNum
|
||||
location.endLine = lineNum
|
||||
location.startColumn = (start - prevNewLine) + 1 // +1 because counting starts at 1
|
||||
location.startLineIndex = prevNewLine
|
||||
location.endLineIndex = newLineByteIndex
|
||||
}
|
||||
if prevNewLine < end && end <= newLineByteIndex {
|
||||
location.endLine = lineNum
|
||||
location.endColumn = (end - prevNewLine)
|
||||
location.endLineIndex = newLineByteIndex
|
||||
}
|
||||
prevNewLine = pair[0]
|
||||
}
|
||||
|
||||
if !lineSet {
|
||||
// if lines never get set then that means the secret is most likely
|
||||
// on the last line of the diff output and the diff output does not have
|
||||
// a newline
|
||||
location.startColumn = (start - prevNewLine) + 1 // +1 because counting starts at 1
|
||||
location.endColumn = (end - prevNewLine)
|
||||
location.startLine = _lineNum + 1
|
||||
location.endLine = _lineNum + 1
|
||||
}
|
||||
return location
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestGetLocation tests the getLocation function.
|
||||
func TestGetLocation(t *testing.T) {
|
||||
tests := []struct {
|
||||
linePairs [][]int
|
||||
start int
|
||||
end int
|
||||
wantLocation Location
|
||||
}{
|
||||
{
|
||||
linePairs: [][]int{
|
||||
{0, 39},
|
||||
{40, 55},
|
||||
{56, 57},
|
||||
},
|
||||
start: 35,
|
||||
end: 38,
|
||||
wantLocation: Location{
|
||||
startLine: 1,
|
||||
startColumn: 36,
|
||||
endLine: 1,
|
||||
endColumn: 38,
|
||||
startLineIndex: 0,
|
||||
endLineIndex: 40,
|
||||
},
|
||||
},
|
||||
{
|
||||
linePairs: [][]int{
|
||||
{0, 39},
|
||||
{40, 55},
|
||||
{56, 57},
|
||||
},
|
||||
start: 40,
|
||||
end: 44,
|
||||
wantLocation: Location{
|
||||
startLine: 2,
|
||||
startColumn: 1,
|
||||
endLine: 2,
|
||||
endColumn: 4,
|
||||
startLineIndex: 40,
|
||||
endLineIndex: 56,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
loc := getLocation(test.linePairs, test.start, test.end)
|
||||
if loc != test.wantLocation {
|
||||
t.Errorf("\nstartLine %d\nstartColumn: %d\nendLine: %d\nendColumn: %d\nstartLineIndex: %d\nendlineIndex %d",
|
||||
loc.startLine, loc.startColumn, loc.endLine, loc.endColumn, loc.startLineIndex, loc.endLineIndex)
|
||||
|
||||
t.Error("got", loc, "want", test.wantLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// GitLog returns a channel of gitdiff.File objects from the
|
||||
// git log -p command for the given source.
|
||||
func GitLog(source string, logOpts string) (<-chan *gitdiff.File, error) {
|
||||
sourceClean := filepath.Clean(source)
|
||||
var cmd *exec.Cmd
|
||||
if logOpts != "" {
|
||||
args := []string{"-C", sourceClean, "log", "-p", "-U0"}
|
||||
args = append(args, strings.Split(logOpts, " ")...)
|
||||
cmd = exec.Command("git", args...)
|
||||
} else {
|
||||
cmd = exec.Command("git", "-C", sourceClean, "log", "-p", "-U0",
|
||||
"--full-history", "--all")
|
||||
}
|
||||
|
||||
log.Debug().Msgf("executing: %s", cmd.String())
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stderr, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go listenForStdErr(stderr)
|
||||
// HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
return gitdiff.Parse(stdout)
|
||||
}
|
||||
|
||||
// GitDiff returns a channel of gitdiff.File objects from
|
||||
// the git diff command for the given source.
|
||||
func GitDiff(source string, staged bool) (<-chan *gitdiff.File, error) {
|
||||
sourceClean := filepath.Clean(source)
|
||||
var cmd *exec.Cmd
|
||||
cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0", ".")
|
||||
if staged {
|
||||
cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0",
|
||||
"--staged", ".")
|
||||
}
|
||||
log.Debug().Msgf("executing: %s", cmd.String())
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stderr, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go listenForStdErr(stderr)
|
||||
// HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
return gitdiff.Parse(stdout)
|
||||
}
|
||||
|
||||
// listenForStdErr listens for stderr output from git and prints it to stdout
|
||||
// then exits with exit code 1
|
||||
func listenForStdErr(stderr io.ReadCloser) {
|
||||
scanner := bufio.NewScanner(stderr)
|
||||
errEncountered := false
|
||||
for scanner.Scan() {
|
||||
// if git throws the following error:
|
||||
//
|
||||
// exhaustive rename detection was skipped due to too many files.
|
||||
// you may want to set your diff.renameLimit variable to at least
|
||||
// (some large number) and retry the command.
|
||||
//
|
||||
// we skip exiting the program as git log -p/git diff will continue
|
||||
// to send data to stdout and finish executing. This next bit of
|
||||
// code prevents gitleaks from stopping mid scan if this error is
|
||||
// encountered
|
||||
if strings.Contains(scanner.Text(),
|
||||
"exhaustive rename detection was skipped") ||
|
||||
strings.Contains(scanner.Text(),
|
||||
"you may want to set your diff.renameLimit") {
|
||||
|
||||
log.Warn().Msg(scanner.Text())
|
||||
} else {
|
||||
log.Error().Msg(scanner.Text())
|
||||
errEncountered = true
|
||||
}
|
||||
}
|
||||
if errEncountered {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package git_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||
"github.com/zricethezav/gitleaks/v8/git"
|
||||
)
|
||||
|
||||
const repoBasePath = "../testdata/repos/"
|
||||
const expectPath = "../testdata/expected/"
|
||||
|
||||
func TestGitLog(t *testing.T) {
|
||||
tests := []struct {
|
||||
source string
|
||||
logOpts string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "small"),
|
||||
expected: filepath.Join(expectPath, "git", "small.txt"),
|
||||
},
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "small"),
|
||||
expected: filepath.Join(expectPath, "git", "small-branch-foo.txt"),
|
||||
logOpts: "--all foo...",
|
||||
},
|
||||
}
|
||||
|
||||
err := moveDotGit("dotGit", ".git")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer moveDotGit(".git", "dotGit")
|
||||
|
||||
for _, tt := range tests {
|
||||
files, err := git.GitLog(tt.source, tt.logOpts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var diffSb strings.Builder
|
||||
for f := range files {
|
||||
for _, tf := range f.TextFragments {
|
||||
diffSb.WriteString(tf.Raw(gitdiff.OpAdd))
|
||||
}
|
||||
}
|
||||
|
||||
expectedBytes, err := os.ReadFile(tt.expected)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
expected := string(expectedBytes)
|
||||
if expected != diffSb.String() {
|
||||
// write string builder to .got file using os.Create
|
||||
err = os.WriteFile(strings.Replace(tt.expected, ".txt", ".got.txt", 1), []byte(diffSb.String()), 0644)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Error("expected: ", expected, "got: ", diffSb.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGitDiff(t *testing.T) {
|
||||
tests := []struct {
|
||||
source string
|
||||
expected string
|
||||
additions string
|
||||
target string
|
||||
}{
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "small"),
|
||||
expected: "this line is added\nand another one",
|
||||
additions: "this line is added\nand another one",
|
||||
target: filepath.Join(repoBasePath, "small", "main.go"),
|
||||
},
|
||||
}
|
||||
|
||||
err := moveDotGit("dotGit", ".git")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer moveDotGit(".git", "dotGit")
|
||||
|
||||
for _, tt := range tests {
|
||||
noChanges, err := os.ReadFile(tt.target)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
err = os.WriteFile(tt.target, []byte(tt.additions), 0644)
|
||||
if err != nil {
|
||||
restore(tt.target, noChanges, t)
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
files, err := git.GitDiff(tt.source, false)
|
||||
if err != nil {
|
||||
restore(tt.target, noChanges, t)
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
for f := range files {
|
||||
sb := strings.Builder{}
|
||||
for _, tf := range f.TextFragments {
|
||||
sb.WriteString(tf.Raw(gitdiff.OpAdd))
|
||||
}
|
||||
if sb.String() != tt.expected {
|
||||
restore(tt.target, noChanges, t)
|
||||
t.Error("expected: ", tt.expected, "got: ", sb.String())
|
||||
}
|
||||
}
|
||||
restore(tt.target, noChanges, t)
|
||||
}
|
||||
}
|
||||
|
||||
func restore(path string, data []byte, t *testing.T) {
|
||||
err := os.WriteFile(path, data, 0644)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func moveDotGit(from, to string) error {
|
||||
repoDirs, err := os.ReadDir("../testdata/repos")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, dir := range repoDirs {
|
||||
if to == ".git" {
|
||||
_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), "dotGit"))
|
||||
if os.IsNotExist(err) {
|
||||
// dont want to delete the only copy of .git accidentally
|
||||
continue
|
||||
}
|
||||
os.RemoveAll(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), ".git"))
|
||||
}
|
||||
if !dir.IsDir() {
|
||||
continue
|
||||
}
|
||||
_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from))
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
|
||||
err = os.Rename(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from),
|
||||
fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), to))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
title = "sample gitleaks config"
|
||||
|
||||
# This is a sample config file for gitleaks. You can configure gitleaks what to search for and what to whitelist.
|
||||
# The output you are seeing here is the default gitleaks config. If GITLEAKS_CONFIG environment variable
|
||||
# is set, gitleaks will load configurations from that path. If option --config-path is set, gitleaks will load
|
||||
# configurations from that path. Gitleaks does not whitelist anything by default.
|
||||
[[rules]]
|
||||
description = "AWS Key"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
|
||||
[[rules]]
|
||||
description = "PKCS8"
|
||||
regex = '''-----BEGIN PRIVATE KEY-----'''
|
||||
tags = ["key", "PKCS8"]
|
||||
|
||||
[[rules]]
|
||||
description = "RSA"
|
||||
regex = '''-----BEGIN RSA PRIVATE KEY-----'''
|
||||
tags = ["key", "RSA"]
|
||||
|
||||
[[rules]]
|
||||
description = "SSH"
|
||||
regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
||||
tags = ["key", "SSH"]
|
||||
|
||||
[[rules]]
|
||||
description = "PGP"
|
||||
regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
|
||||
tags = ["key", "PGP"]
|
||||
|
||||
[[rules]]
|
||||
description = "Facebook"
|
||||
regex = '''(?i)facebook(.{0,4})?['\"][0-9a-f]{32}['\"]'''
|
||||
tags = ["key", "Facebook"]
|
||||
|
||||
[[rules]]
|
||||
description = "Twitter"
|
||||
regex = '''(?i)twitter(.{0,4})?['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||
tags = ["key", "Twitter"]
|
||||
|
||||
[[rules]]
|
||||
description = "Github"
|
||||
regex = '''(?i)github(.{0,4})?['\"][0-9a-zA-Z]{35,40}['\"]'''
|
||||
tags = ["key", "Github"]
|
||||
|
||||
[[rules]]
|
||||
description = "Slack"
|
||||
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
|
||||
tags = ["key", "Slack"]
|
||||
|
||||
[whitelist]
|
||||
files = [
|
||||
"(.*?)(jpg|gif|doc|pdf|bin)$"
|
||||
]
|
||||
#commits = [
|
||||
# "whitelisted-commit1",
|
||||
# "whitelisted-commit2",
|
||||
#]
|
||||
#repos = [
|
||||
# "whitelisted-repo"
|
||||
#]
|
||||
|
||||
# Additional Examples
|
||||
|
||||
# [[rules]]
|
||||
# description = "Generic Key"
|
||||
# regex = '''(?i)key(.{0,6})?(:|=|=>|:=)'''
|
||||
# entropies = [
|
||||
# "4.1-4.3",
|
||||
# "5.5-6.3",
|
||||
# ]
|
||||
# entropyROI = "line"
|
||||
# filetypes = [".go", ".py", ".c"]
|
||||
# tags = ["key"]
|
||||
# severity = "8"
|
||||
#
|
||||
#
|
||||
# [[rules]]
|
||||
# description = "Generic Key"
|
||||
# regex = '''(?i)key(.{0,6})?(:|=|=>|:=)'''
|
||||
# entropies = ["4.1-4.3"]
|
||||
# filetypes = [".gee"]
|
||||
# entropyROI = "line"
|
||||
# tags = ["key"]
|
||||
# severity = "medium"
|
||||
|
||||
# [[rules]]
|
||||
# description = "Any pem file"
|
||||
# filetypes = [".key"]
|
||||
# tags = ["pem"]
|
||||
# severity = "high"
|
||||
@@ -1,26 +1,15 @@
|
||||
module github.com/zricethezav/gitleaks
|
||||
module github.com/zricethezav/gitleaks/v8
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727
|
||||
github.com/google/go-github v15.0.0+incompatible
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead
|
||||
github.com/ipfs/go-ipfs v0.4.19 // indirect
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
github.com/onsi/ginkgo v1.8.0 // indirect
|
||||
github.com/onsi/gomega v1.5.0 // indirect
|
||||
github.com/sirupsen/logrus v1.0.6
|
||||
github.com/xanzy/go-gitlab v0.11.3
|
||||
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b // indirect
|
||||
golang.org/x/net v0.0.0-20180925072008-f04abc6bdfa7 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 // indirect
|
||||
golang.org/x/sys v0.0.0-20180925112736-b09afc3d579e // indirect
|
||||
google.golang.org/appengine v1.2.0 // indirect
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
|
||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect
|
||||
gopkg.in/src-d/go-git.v4 v4.9.1
|
||||
github.com/gitleaks/go-gitdiff v0.7.4
|
||||
github.com/rs/zerolog v1.25.0
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/viper v1.8.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 // indirect
|
||||
golang.org/x/tools v0.1.5
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
)
|
||||
@@ -1,111 +1,602 @@
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emirpasic/gods v1.9.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727 h1:eouy4stZdUKn7n98c1+rdUTxWMg+jvhP+oHt0K8fiug=
|
||||
github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gliderlabs/ssh v0.1.1 h1:j3L6gSLQalDETeEg/Jg0mGY0/y/N6zI2xX1978P0Uqw=
|
||||
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gitleaks/go-gitdiff v0.7.4 h1:8vICc4moyRR2poklblThdQ0ckMet22mEvFJSxPsiDlk=
|
||||
github.com/gitleaks/go-gitdiff v0.7.4/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-github v15.0.0+incompatible h1:jlPg2Cpsxb/FyEV/MFiIE9tW/2RAevQNZDPeHbf5a94=
|
||||
github.com/google/go-github v15.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead h1:Y9WOGZY2nw5ksbEf5AIpk+vK52Tdg/VN/rHFRfEeeGQ=
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ipfs/go-ipfs v0.4.19 h1:ioUvuv1L3Zb9XgPi6S8selFMMlTa5AntQzVGvaoYHXM=
|
||||
github.com/ipfs/go-ipfs v0.4.19/go.mod h1:iXzbK+Wa6eePj3jQg/uY6Uoq5iOwY+GToD/bgaRadto=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
|
||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA=
|
||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
|
||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
||||
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sirupsen/logrus v1.0.6 h1:hcP1GmhGigz/O7h1WVUM5KklBp1JoNS9FggWKdj/j3s=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4=
|
||||
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II=
|
||||
github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
|
||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
|
||||
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44=
|
||||
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/xanzy/go-gitlab v0.11.3 h1:gSYcSb+pCx3fco6/O3w784/omQVTcrgxRzyf14SBvUQ=
|
||||
github.com/xanzy/go-gitlab v0.11.3/go.mod h1:CRKHkvFWNU6C3AEfqLWjnCNnAs4nj8Zk95rX2S3X6Mw=
|
||||
github.com/xanzy/ssh-agent v0.2.0 h1:Adglfbi5p9Z0BmK2oKU9nTG+zKfniSfnaMYB+ULd+Ro=
|
||||
github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b h1:2b9XGzhjiYsYPnKXoEfL7klWZQIt8IfyRCz62gCqqlQ=
|
||||
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
|
||||
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180925072008-f04abc6bdfa7 h1:zKzVgSQ8WOSHzD7I4k8LQjrHUUCNOlBsgc0PcYLVNnY=
|
||||
golang.org/x/net v0.0.0-20180925072008-f04abc6bdfa7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180925112736-b09afc3d579e h1:LSlw/Dbj0MkNvPYAAkGinYmGliq+aqS7eKPYlE4oWC4=
|
||||
golang.org/x/sys v0.0.0-20180925112736-b09afc3d579e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 h1:WecRHqgE09JBkh/584XIE6PMz5KKE/vER4izNUi30AQ=
|
||||
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
||||
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
|
||||
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
|
||||
google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0=
|
||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
|
||||
gopkg.in/src-d/go-billy.v4 v4.2.1/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek=
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
|
||||
gopkg.in/src-d/go-git-fixtures.v3 v3.1.1 h1:XWW/s5W18RaJpmo1l0IYGqXKuJITWRFuA45iOf1dKJs=
|
||||
gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
|
||||
gopkg.in/src-d/go-git.v4 v4.9.1 h1:0oKHJZY8tM7B71378cfTg2c5jmWyNlXvestTT6WfY+4=
|
||||
gopkg.in/src-d/go-git.v4 v4.9.1/go.mod h1:Vtut8izDyrM8BUVQnzJ+YvmNcem2J89EmfZYCkLokZk=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
@@ -2,22 +2,27 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/zricethezav/gitleaks/src"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
report, err := gitleaks.Run(gitleaks.ParseOpts())
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
os.Exit(gitleaks.ErrExit)
|
||||
}
|
||||
// send all logs to stdout
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||
|
||||
if len(report.Leaks) != 0 {
|
||||
log.Warnf("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
|
||||
os.Exit(gitleaks.LeakExit)
|
||||
} else {
|
||||
log.Infof("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
|
||||
}
|
||||
// this block sets up a go routine to listen for an interrupt signal
|
||||
// which will immediately exit gitleaks
|
||||
stopChan := make(chan os.Signal, 1)
|
||||
signal.Notify(stopChan, os.Interrupt)
|
||||
go listenForInterrupt(stopChan)
|
||||
|
||||
cmd.Execute()
|
||||
}
|
||||
|
||||
func listenForInterrupt(stopScan chan os.Signal) {
|
||||
<-stopScan
|
||||
log.Fatal().Msg("Interrupt signal received. Exiting...")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package report
|
||||
|
||||
const version = "v8.0.0"
|
||||
const driver = "gitleaks"
|
||||
const driverURL = "https://github.com/zricethezav/gitleaks"
|
||||
@@ -0,0 +1,55 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"io"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// writeCsv writes the list of findings to a writeCloser.
|
||||
func writeCsv(f []Finding, w io.WriteCloser) error {
|
||||
if len(f) == 0 {
|
||||
return nil
|
||||
}
|
||||
defer w.Close()
|
||||
cw := csv.NewWriter(w)
|
||||
err := cw.Write([]string{"RuleID",
|
||||
"Commit",
|
||||
"File",
|
||||
"Secret",
|
||||
"Match",
|
||||
"StartLine",
|
||||
"EndLine",
|
||||
"StartColumn",
|
||||
"EndColumn",
|
||||
"Author",
|
||||
"Message",
|
||||
"Date",
|
||||
"Email",
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, f := range f {
|
||||
err = cw.Write([]string{f.RuleID,
|
||||
f.Commit,
|
||||
f.File,
|
||||
f.Secret,
|
||||
f.Match,
|
||||
strconv.Itoa(f.StartLine),
|
||||
strconv.Itoa(f.EndLine),
|
||||
strconv.Itoa(f.StartColumn),
|
||||
strconv.Itoa(f.EndColumn),
|
||||
f.Author,
|
||||
f.Message,
|
||||
f.Date,
|
||||
f.Email,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cw.Flush()
|
||||
return cw.Error()
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWriteCSV(t *testing.T) {
|
||||
tests := []struct {
|
||||
findings []Finding
|
||||
testReportName string
|
||||
expected string
|
||||
wantEmpty bool
|
||||
}{
|
||||
{
|
||||
testReportName: "simple",
|
||||
expected: filepath.Join(expectPath, "report", "csv_simple.csv"),
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
StartColumn: 1,
|
||||
EndColumn: 2,
|
||||
Message: "opps",
|
||||
File: "auth.py",
|
||||
Commit: "0000000000000000",
|
||||
Author: "John Doe",
|
||||
Email: "johndoe@gmail.com",
|
||||
Date: "10-19-2003",
|
||||
},
|
||||
}},
|
||||
{
|
||||
|
||||
wantEmpty: true,
|
||||
testReportName: "empty",
|
||||
expected: filepath.Join(expectPath, "report", "this_should_not_exist.csv"),
|
||||
findings: []Finding{}},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".csv"))
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
err = writeCsv(test.findings, tmpfile)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
got, err := os.ReadFile(tmpfile.Name())
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
if test.wantEmpty {
|
||||
if len(got) > 0 {
|
||||
t.Errorf("Expected empty file, got %s", got)
|
||||
}
|
||||
os.Remove(tmpfile.Name())
|
||||
continue
|
||||
}
|
||||
want, err := os.ReadFile(test.expected)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if string(got) != string(want) {
|
||||
err = os.WriteFile(strings.Replace(test.expected, ".csv", ".got.csv", 1), got, 0644)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Errorf("got %s, want %s", string(got), string(want))
|
||||
}
|
||||
|
||||
os.Remove(tmpfile.Name())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Finding contains information about strings that
|
||||
// have been captured by a tree-sitter query.
|
||||
type Finding struct {
|
||||
Description string
|
||||
StartLine int
|
||||
EndLine int
|
||||
StartColumn int
|
||||
EndColumn int
|
||||
|
||||
Match string
|
||||
|
||||
// Secret contains the full content of what is matched in
|
||||
// the tree-sitter query.
|
||||
Secret string
|
||||
|
||||
// File is the name of the file containing the finding
|
||||
File string
|
||||
|
||||
Commit string
|
||||
|
||||
// Entropy is the shannon entropy of Value
|
||||
Entropy float32
|
||||
|
||||
Author string
|
||||
Email string
|
||||
Date string
|
||||
Message string
|
||||
Tags []string
|
||||
|
||||
// Rule is the name of the rule that was matched
|
||||
RuleID string
|
||||
}
|
||||
|
||||
// Redact removes sensitive information from a finding.
|
||||
func (f *Finding) Redact() {
|
||||
f.Match = strings.Replace(f.Match, f.Secret, "REDACTED", -1)
|
||||
f.Secret = "REDACT"
|
||||
}
|
||||
|
||||
func (f *Finding) Hash() string {
|
||||
return f.Secret + f.Commit +
|
||||
strconv.Itoa(f.EndLine) +
|
||||
strconv.Itoa(f.StartLine)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package report
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRedact(t *testing.T) {
|
||||
tests := []struct {
|
||||
findings []Finding
|
||||
redact bool
|
||||
}{
|
||||
{
|
||||
redact: true,
|
||||
findings: []Finding{
|
||||
{
|
||||
Secret: "line containing secret",
|
||||
Match: "secret",
|
||||
},
|
||||
}},
|
||||
}
|
||||
for _, test := range tests {
|
||||
for _, f := range test.findings {
|
||||
f.Redact()
|
||||
if f.Secret != "REDACT" {
|
||||
t.Error("redact not redacting: ", f.Secret)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
)
|
||||
|
||||
func writeJson(findings []Finding, w io.WriteCloser) error {
|
||||
if len(findings) == 0 {
|
||||
return nil
|
||||
}
|
||||
encoder := json.NewEncoder(w)
|
||||
encoder.SetIndent("", " ")
|
||||
return encoder.Encode(findings)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWriteJSON(t *testing.T) {
|
||||
tests := []struct {
|
||||
findings []Finding
|
||||
testReportName string
|
||||
expected string
|
||||
wantEmpty bool
|
||||
}{
|
||||
{
|
||||
testReportName: "simple",
|
||||
expected: filepath.Join(expectPath, "report", "json_simple.json"),
|
||||
findings: []Finding{
|
||||
{
|
||||
|
||||
Description: "",
|
||||
RuleID: "test-rule",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
StartColumn: 1,
|
||||
EndColumn: 2,
|
||||
Message: "opps",
|
||||
File: "auth.py",
|
||||
Commit: "0000000000000000",
|
||||
Author: "John Doe",
|
||||
Email: "johndoe@gmail.com",
|
||||
Date: "10-19-2003",
|
||||
Tags: []string{},
|
||||
},
|
||||
}},
|
||||
{
|
||||
|
||||
wantEmpty: true,
|
||||
testReportName: "empty",
|
||||
expected: filepath.Join(expectPath, "report", "this_should_not_exist.json"),
|
||||
findings: []Finding{}},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
// create tmp file using os.TempDir()
|
||||
tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".json"))
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
err = writeJson(test.findings, tmpfile)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
got, err := os.ReadFile(tmpfile.Name())
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
if test.wantEmpty {
|
||||
if len(got) > 0 {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Errorf("Expected empty file, got %s", got)
|
||||
}
|
||||
os.Remove(tmpfile.Name())
|
||||
continue
|
||||
}
|
||||
want, err := os.ReadFile(test.expected)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if string(got) != string(want) {
|
||||
err = os.WriteFile(strings.Replace(test.expected, ".json", ".got.json", 1), got, 0644)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Errorf("got %s, want %s", string(got), string(want))
|
||||
}
|
||||
|
||||
os.Remove(tmpfile.Name())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
const (
|
||||
// https://cwe.mitre.org/data/definitions/798.html
|
||||
CWE = "CWE-798"
|
||||
CWE_DESCRIPTION = "Use of Hard-coded Credentials"
|
||||
)
|
||||
|
||||
func Write(findings []Finding, cfg config.Config, ext string, reportPath string) error {
|
||||
if len(findings) == 0 {
|
||||
return nil
|
||||
}
|
||||
file, err := os.Create(reportPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ext = strings.ToLower(ext)
|
||||
switch ext {
|
||||
case ".json", "json":
|
||||
writeJson(findings, file)
|
||||
case ".csv", "csv":
|
||||
writeCsv(findings, file)
|
||||
case ".sarif", "sarif":
|
||||
writeSarif(cfg, findings, file)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
const (
|
||||
expectPath = "../testdata/expected/"
|
||||
tmpPath = "../testdata/tmp"
|
||||
)
|
||||
|
||||
func TestReport(t *testing.T) {
|
||||
tests := []struct {
|
||||
findings []Finding
|
||||
ext string
|
||||
wantEmpty bool
|
||||
}{
|
||||
{
|
||||
ext: "json",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ext: ".json",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ext: ".jsonj",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
wantEmpty: true,
|
||||
},
|
||||
{
|
||||
ext: ".csv",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ext: "csv",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ext: "CSV",
|
||||
findings: []Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// ext: "SARIF",
|
||||
// findings: []Finding{
|
||||
// {
|
||||
// RuleID: "test-rule",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
tmpfile, err := os.Create(filepath.Join(tmpPath, strconv.Itoa(i)+test.ext))
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
err = Write(test.findings, config.Config{}, test.ext, tmpfile.Name())
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
got, err := os.ReadFile(tmpfile.Name())
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
os.Remove(tmpfile.Name())
|
||||
|
||||
if len(got) == 0 && !test.wantEmpty {
|
||||
t.Errorf("got empty file with extension " + test.ext)
|
||||
}
|
||||
|
||||
if test.wantEmpty {
|
||||
if len(got) > 0 {
|
||||
t.Errorf("Expected empty file, got %s", got)
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
|
||||
sarif := Sarif{
|
||||
Schema: "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
||||
Version: "2.1.0",
|
||||
Runs: getRuns(cfg, findings),
|
||||
}
|
||||
|
||||
encoder := json.NewEncoder(w)
|
||||
encoder.SetIndent("", " ")
|
||||
return encoder.Encode(sarif)
|
||||
}
|
||||
|
||||
func getRuns(cfg config.Config, findings []Finding) []Runs {
|
||||
return []Runs{
|
||||
{
|
||||
Tool: getTool(cfg),
|
||||
Results: getResults(findings),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getTool(cfg config.Config) Tool {
|
||||
return Tool{
|
||||
Driver: Driver{
|
||||
Name: driver,
|
||||
SemanticVersion: version,
|
||||
Rules: getRules(cfg),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getRules(cfg config.Config) []Rules {
|
||||
// TODO for _, rule := range cfg.Rules {
|
||||
var rules []Rules
|
||||
for _, rule := range cfg.Rules {
|
||||
rules = append(rules, Rules{
|
||||
ID: rule.RuleID,
|
||||
Name: rule.Description,
|
||||
Description: ShortDescription{
|
||||
Text: rule.Regex.String(),
|
||||
},
|
||||
})
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func messageText(f Finding) string {
|
||||
if f.Commit == "" {
|
||||
return fmt.Sprintf("%s has detected secret for file %s.", f.RuleID, f.File)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s has detected secret for file %s at commit %s.", f.RuleID, f.File, f.Commit)
|
||||
|
||||
}
|
||||
|
||||
func getResults(findings []Finding) []Results {
|
||||
var results []Results
|
||||
for _, f := range findings {
|
||||
r := Results{
|
||||
Message: Message{
|
||||
Text: messageText(f),
|
||||
},
|
||||
RuleId: f.RuleID,
|
||||
Locations: getLocation(f),
|
||||
// This information goes in partial fingerprings until revision
|
||||
// data can be added somewhere else
|
||||
PartialFingerPrints: PartialFingerPrints{
|
||||
CommitSha: f.Commit,
|
||||
Email: f.Email,
|
||||
CommitMessage: f.Message,
|
||||
Date: f.Date,
|
||||
Author: f.Author,
|
||||
},
|
||||
}
|
||||
results = append(results, r)
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
func getLocation(f Finding) []Locations {
|
||||
return []Locations{
|
||||
{
|
||||
PhysicalLocation: PhysicalLocation{
|
||||
ArtifactLocation: ArtifactLocation{
|
||||
URI: f.File,
|
||||
},
|
||||
Region: Region{
|
||||
StartLine: f.StartLine,
|
||||
EndLine: f.EndLine,
|
||||
StartColumn: f.StartColumn,
|
||||
EndColumn: f.EndColumn,
|
||||
Snippet: Snippet{
|
||||
Text: f.Secret,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type PartialFingerPrints struct {
|
||||
CommitSha string `json:"commitSha"`
|
||||
Email string `json:"email"`
|
||||
Author string `json:"author"`
|
||||
Date string `json:"date"`
|
||||
CommitMessage string `json:"commitMessage"`
|
||||
}
|
||||
|
||||
type Sarif struct {
|
||||
Schema string `json:"$schema"`
|
||||
Version string `json:"version"`
|
||||
Runs []Runs `json:"runs"`
|
||||
}
|
||||
|
||||
type ShortDescription struct {
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
type FullDescription struct {
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
type Rules struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description ShortDescription `json:"shortDescription"`
|
||||
}
|
||||
|
||||
type Driver struct {
|
||||
Name string `json:"name"`
|
||||
SemanticVersion string `json:"semanticVersion"`
|
||||
Rules []Rules `json:"rules"`
|
||||
}
|
||||
|
||||
type Tool struct {
|
||||
Driver Driver `json:"driver"`
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
type ArtifactLocation struct {
|
||||
URI string `json:"uri"`
|
||||
}
|
||||
|
||||
type Region struct {
|
||||
StartLine int `json:"startLine"`
|
||||
StartColumn int `json:"startColumn"`
|
||||
EndLine int `json:"endLine"`
|
||||
EndColumn int `json:"endColumn"`
|
||||
Snippet Snippet `json:"snippet"`
|
||||
}
|
||||
|
||||
type Snippet struct {
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
type PhysicalLocation struct {
|
||||
ArtifactLocation ArtifactLocation `json:"artifactLocation"`
|
||||
Region Region `json:"region"`
|
||||
}
|
||||
|
||||
type Locations struct {
|
||||
PhysicalLocation PhysicalLocation `json:"physicalLocation"`
|
||||
}
|
||||
|
||||
type Results struct {
|
||||
Message Message `json:"message"`
|
||||
RuleId string `json:"ruleId"`
|
||||
Locations []Locations `json:"locations"`
|
||||
PartialFingerPrints `json:"partialFingerprints"`
|
||||
}
|
||||
|
||||
type Runs struct {
|
||||
Tool Tool `json:"tool"`
|
||||
Results []Results `json:"results"`
|
||||
}
|
||||
|
||||
func configToRules(cfg config.Config) []Rules {
|
||||
var rules []Rules
|
||||
for _, rule := range cfg.Rules {
|
||||
rules = append(rules, Rules{
|
||||
ID: rule.RuleID,
|
||||
Name: rule.Description,
|
||||
})
|
||||
}
|
||||
return rules
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
const configPath = "../testdata/config/"
|
||||
|
||||
func TestWriteSarif(t *testing.T) {
|
||||
tests := []struct {
|
||||
findings []Finding
|
||||
testReportName string
|
||||
expected string
|
||||
wantEmpty bool
|
||||
cfgName string
|
||||
}{
|
||||
{
|
||||
cfgName: "simple",
|
||||
testReportName: "simple",
|
||||
expected: filepath.Join(expectPath, "report", "sarif_simple.sarif"),
|
||||
findings: []Finding{
|
||||
{
|
||||
|
||||
Description: "",
|
||||
RuleID: "test-rule",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
StartColumn: 1,
|
||||
EndColumn: 2,
|
||||
Message: "opps",
|
||||
File: "auth.py",
|
||||
Commit: "0000000000000000",
|
||||
Author: "John Doe",
|
||||
Email: "johndoe@gmail.com",
|
||||
Date: "10-19-2003",
|
||||
Tags: []string{},
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
// create tmp file using os.TempDir()
|
||||
tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".json"))
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
viper.Reset()
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName(test.cfgName)
|
||||
viper.SetConfigType("toml")
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var vc config.ViperConfig
|
||||
viper.Unmarshal(&vc)
|
||||
cfg, err := vc.Translate()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
err = writeSarif(cfg, test.findings, tmpfile)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
got, err := os.ReadFile(tmpfile.Name())
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
if test.wantEmpty {
|
||||
if len(got) > 0 {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Errorf("Expected empty file, got %s", got)
|
||||
}
|
||||
os.Remove(tmpfile.Name())
|
||||
continue
|
||||
}
|
||||
want, err := os.ReadFile(test.expected)
|
||||
if err != nil {
|
||||
os.Remove(tmpfile.Name())
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if string(got) != string(want) {
|
||||
err = os.WriteFile(strings.Replace(test.expected, ".sarif", ".got.sarif", 1), got, 0644)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Errorf("got %s, want %s", string(got), string(want))
|
||||
}
|
||||
|
||||
os.Remove(tmpfile.Name())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
import os,sys
|
||||
import subprocess
|
||||
|
||||
def gitleaksEnabled():
|
||||
out = subprocess.getoutput("git config --bool hooks.gitleaks")
|
||||
if out == "false":
|
||||
return False
|
||||
return True
|
||||
|
||||
if gitleaksEnabled():
|
||||
exitCode = os.WEXITSTATUS(os.system('gitleaks protect -v --staged'))
|
||||
if exitCode == 1:
|
||||
print('''Warning: gitleaks has detected sensitive information in your changes.
|
||||
To disable the gitleaks precommit hook run the following command:
|
||||
|
||||
git config hooks.gitleaks false
|
||||
''')
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('gitleaks precommit disabled (enable with `git config hooks.gitleaks true`)')
|
||||
|
||||
-236
@@ -1,236 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
|
||||
)
|
||||
|
||||
type entropyRange struct {
|
||||
v1 float64
|
||||
v2 float64
|
||||
}
|
||||
|
||||
// Rule instructs how gitleaks should audit each line of code
|
||||
type Rule struct {
|
||||
description string
|
||||
regex *regexp.Regexp
|
||||
severity string
|
||||
tags []string
|
||||
entropies []*entropyRange
|
||||
entropyROI string
|
||||
fileTypes []*regexp.Regexp
|
||||
}
|
||||
|
||||
// TomlConfig is used for loading gitleaks configs from a toml file
|
||||
type TomlConfig struct {
|
||||
Rules []struct {
|
||||
Description string
|
||||
Regex string
|
||||
Entropies []string
|
||||
Tags []string
|
||||
Severity string
|
||||
EntropyROI string
|
||||
FileTypes []string
|
||||
}
|
||||
Whitelist struct {
|
||||
Files []string
|
||||
Regexes []string
|
||||
Commits []string
|
||||
Repos []string
|
||||
}
|
||||
}
|
||||
|
||||
// Config contains gitleaks config
|
||||
type Config struct {
|
||||
Rules []*Rule
|
||||
WhiteList struct {
|
||||
regexes []*regexp.Regexp
|
||||
files []*regexp.Regexp
|
||||
commits map[string]bool
|
||||
repos []*regexp.Regexp
|
||||
}
|
||||
FileRules []*Rule
|
||||
sshAuth *ssh.PublicKeys
|
||||
}
|
||||
|
||||
// loadToml loads of the toml config containing regexes and whitelists.
|
||||
// This function will first look if the configPath is set and load the config
|
||||
// from that file. Otherwise will then look for the path set by the GITHLEAKS_CONIFG
|
||||
// env var. If that is not set, then gitleaks will continue with the default configs
|
||||
// specified by the const var at the top `defaultConfig`
|
||||
func newConfig() (*Config, error) {
|
||||
var (
|
||||
tomlConfig TomlConfig
|
||||
configPath string
|
||||
config Config
|
||||
)
|
||||
|
||||
if opts.ConfigPath != "" {
|
||||
configPath = opts.ConfigPath
|
||||
_, err := os.Stat(configPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("no gitleaks config at %s", configPath)
|
||||
}
|
||||
} else {
|
||||
configPath = os.Getenv("GITLEAKS_CONFIG")
|
||||
}
|
||||
|
||||
if configPath != "" {
|
||||
if _, err := toml.DecodeFile(configPath, &tomlConfig); err != nil {
|
||||
return nil, fmt.Errorf("problem loading config: %v", err)
|
||||
}
|
||||
} else {
|
||||
_, err := toml.Decode(defaultConfig, &tomlConfig)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("problem loading default config: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
sshAuth, err := getSSHAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.sshAuth = sshAuth
|
||||
|
||||
err = config.update(tomlConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &config, err
|
||||
}
|
||||
|
||||
// updateConfig will update a the global config values
|
||||
func (config *Config) update(tomlConfig TomlConfig) error {
|
||||
for _, rule := range tomlConfig.Rules {
|
||||
re := regexp.MustCompile(rule.Regex)
|
||||
ranges, err := getEntropyRanges(rule.Entropies)
|
||||
var fileTypes = []*regexp.Regexp{}
|
||||
for _, regex := range rule.FileTypes {
|
||||
fileTypes = append(fileTypes, regexp.MustCompile(regex))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("could not create entropy range for %s, skipping rule", rule.Description)
|
||||
continue
|
||||
}
|
||||
|
||||
r := &Rule{
|
||||
description: rule.Description,
|
||||
regex: re,
|
||||
severity: rule.Severity,
|
||||
tags: rule.Tags,
|
||||
entropies: ranges,
|
||||
entropyROI: rule.EntropyROI,
|
||||
fileTypes: fileTypes,
|
||||
}
|
||||
|
||||
if len(rule.Entropies) == 0 && rule.Regex == "" && len(fileTypes) != 0 {
|
||||
config.FileRules = append(config.FileRules, r)
|
||||
}
|
||||
config.Rules = append(config.Rules, r)
|
||||
|
||||
}
|
||||
|
||||
// set whitelists
|
||||
config.WhiteList.commits = make(map[string]bool)
|
||||
for _, commit := range tomlConfig.Whitelist.Commits {
|
||||
config.WhiteList.commits[commit] = true
|
||||
}
|
||||
for _, regex := range tomlConfig.Whitelist.Files {
|
||||
config.WhiteList.files = append(config.WhiteList.files, regexp.MustCompile(regex))
|
||||
}
|
||||
for _, regex := range tomlConfig.Whitelist.Regexes {
|
||||
config.WhiteList.regexes = append(config.WhiteList.regexes, regexp.MustCompile(regex))
|
||||
}
|
||||
for _, regex := range tomlConfig.Whitelist.Repos {
|
||||
config.WhiteList.repos = append(config.WhiteList.repos, regexp.MustCompile(regex))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// entropyRanges hydrates entropyRanges which allows for fine tuning entropy checking
|
||||
func getEntropyRanges(entropyLimitStr []string) ([]*entropyRange, error) {
|
||||
var ranges []*entropyRange
|
||||
for _, span := range entropyLimitStr {
|
||||
split := strings.Split(span, "-")
|
||||
v1, err := strconv.ParseFloat(split[0], 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v2, err := strconv.ParseFloat(split[1], 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if v1 > v2 {
|
||||
return nil, fmt.Errorf("entropy range must be ascending")
|
||||
}
|
||||
r := &entropyRange{
|
||||
v1: v1,
|
||||
v2: v2,
|
||||
}
|
||||
if r.v1 > 8.0 || r.v1 < 0.0 || r.v2 > 8.0 || r.v2 < 0.0 {
|
||||
return nil, fmt.Errorf("invalid entropy ranges, must be within 0.0-8.0")
|
||||
}
|
||||
ranges = append(ranges, r)
|
||||
}
|
||||
return ranges, nil
|
||||
}
|
||||
|
||||
// externalConfig will attempt to load a pinned ".gitleaks.toml" configuration file
|
||||
// from a remote or local repo. Use the --repo-config option to trigger this.
|
||||
func (config *Config) updateFromRepo(repo *RepoInfo) error {
|
||||
var tomlConfig TomlConfig
|
||||
wt, err := repo.repository.Worktree()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := wt.Filesystem.Open(".gitleaks.toml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := toml.DecodeReader(f, &config); err != nil {
|
||||
return fmt.Errorf("problem loading config: %v", err)
|
||||
}
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return config.update(tomlConfig)
|
||||
}
|
||||
|
||||
// getSSHAuth return an ssh auth use by go-git to clone repos behind authentication.
|
||||
// If --ssh-key is set then it will attempt to load the key from that path. If not,
|
||||
// gitleaks will use the default $HOME/.ssh/id_rsa key
|
||||
func getSSHAuth() (*ssh.PublicKeys, error) {
|
||||
var (
|
||||
sshKeyPath string
|
||||
)
|
||||
if opts.SSHKey != "" {
|
||||
sshKeyPath = opts.SSHKey
|
||||
} else {
|
||||
// try grabbing default
|
||||
c, err := user.Current()
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
sshKeyPath = fmt.Sprintf("%s/.ssh/id_rsa", c.HomeDir)
|
||||
}
|
||||
sshAuth, err := ssh.NewPublicKeysFromFile("git", sshKeyPath, "")
|
||||
if err != nil {
|
||||
if strings.HasPrefix(opts.Repo, "git") {
|
||||
// if you are attempting to clone a git repo via ssh and supply a bad ssh key,
|
||||
// the clone will fail.
|
||||
return nil, fmt.Errorf("unable to generate ssh key: %v", err)
|
||||
}
|
||||
}
|
||||
return sshAuth, nil
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
const version = "2.0.0"
|
||||
|
||||
const defaultGithubURL = "https://api.github.com/"
|
||||
const defaultThreadNum = 1
|
||||
|
||||
// ErrExit used to signal an error during gitleaks execution
|
||||
const ErrExit = 2
|
||||
|
||||
// LeakExit used to signal leaks present in audit
|
||||
const LeakExit = 1
|
||||
|
||||
const defaultConfig = `
|
||||
# This is a sample config file for gitleaks. You can configure gitleaks what to search for and what to whitelist.
|
||||
# The output you are seeing here is the default gitleaks config. If GITLEAKS_CONFIG environment variable
|
||||
# is set, gitleaks will load configurations from that path. If option --config is set, gitleaks will load
|
||||
# configurations from that path. Gitleaks does not whitelist anything by default.
|
||||
|
||||
title = "gitleaks config"
|
||||
[[rules]]
|
||||
description = "AWS Key"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
severity = "high"
|
||||
|
||||
[[rules]]
|
||||
description = "PKCS8"
|
||||
regex = '''-----BEGIN PRIVATE KEY-----'''
|
||||
tags = ["key", "PKCS8"]
|
||||
|
||||
[[rules]]
|
||||
description = "RSA"
|
||||
regex = '''-----BEGIN RSA PRIVATE KEY-----'''
|
||||
tags = ["key", "RSA"]
|
||||
|
||||
[[rules]]
|
||||
description = "SSH"
|
||||
regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
||||
tags = ["key", "SSH"]
|
||||
|
||||
[[rules]]
|
||||
description = "PGP"
|
||||
regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
|
||||
tags = ["key", "PGP"]
|
||||
|
||||
[[rules]]
|
||||
description = "Facebook"
|
||||
regex = '''(?i)facebook(.{0,4})?['\"][0-9a-f]{32}['\"]'''
|
||||
tags = ["key", "Facebook"]
|
||||
|
||||
[[rules]]
|
||||
description = "Twitter"
|
||||
regex = '''(?i)twitter(.{0,4})?['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||
tags = ["key", "Twitter"]
|
||||
|
||||
[[rules]]
|
||||
description = "Github"
|
||||
regex = '''(?i)github(.{0,4})?['\"][0-9a-zA-Z]{35,40}['\"]'''
|
||||
tags = ["key", "Github"]
|
||||
|
||||
[[rules]]
|
||||
description = "Slack"
|
||||
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
|
||||
tags = ["key", "Slack"]
|
||||
|
||||
[whitelist]
|
||||
files = [
|
||||
"(.*?)(jpg|gif|doc|pdf|bin)$"
|
||||
]
|
||||
|
||||
#commits = [
|
||||
# "whitelisted-commit1",
|
||||
# "whitelisted-commit2",
|
||||
#]
|
||||
#repos = [
|
||||
# "whitelisted-repo"
|
||||
#]
|
||||
`
|
||||
@@ -1,123 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
)
|
||||
|
||||
const testWhitelistCommit = `
|
||||
[[rules]]
|
||||
description = "AWS"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
|
||||
[whitelist]
|
||||
commits = [
|
||||
"eaeffdc65b4c73ccb67e75d96bd8743be2c85973",
|
||||
]
|
||||
`
|
||||
const testWhitelistFile = `
|
||||
[[rules]]
|
||||
description = "AWS"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
|
||||
[whitelist]
|
||||
files = [
|
||||
".go",
|
||||
]
|
||||
`
|
||||
|
||||
const testWhitelistRegex = `
|
||||
[[rules]]
|
||||
description = "AWS"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
|
||||
[whitelist]
|
||||
regexes= [
|
||||
"AKIA",
|
||||
]
|
||||
`
|
||||
|
||||
const testWhitelistRepo = `
|
||||
[[rules]]
|
||||
description = "AWS"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
|
||||
[whitelist]
|
||||
repos = [
|
||||
"gronit",
|
||||
]
|
||||
`
|
||||
|
||||
const testEntropyRange = `
|
||||
[[rules]]
|
||||
description = "Entropy ranges"
|
||||
entropies = [
|
||||
"7.5-8.0",
|
||||
"3.2-3.4",
|
||||
]
|
||||
`
|
||||
const testBadEntropyRange = `
|
||||
[[rules]]
|
||||
description = "Bad entropy ranges"
|
||||
entropies = [
|
||||
"8.0-3.0",
|
||||
]
|
||||
`
|
||||
const testBadEntropyRange2 = `
|
||||
[[rules]]
|
||||
description = "Bad entropy ranges"
|
||||
entropies = [
|
||||
"8.0-8.9",
|
||||
]
|
||||
`
|
||||
|
||||
const testEntropyWordRegexRange = `
|
||||
[[rules]]
|
||||
description = "test entropy regex ranges"
|
||||
regex = '''(?i)key(.{0,6})?(:|=|=>|:=)'''
|
||||
entropies = [
|
||||
"4.1-4.3",
|
||||
]
|
||||
entropyROI="word"
|
||||
`
|
||||
|
||||
const testEntropyRegexRange = `
|
||||
[[rules]]
|
||||
description = "test entropy regex ranges"
|
||||
regex = '''(?i)key(.{0,6})?(:|=|=>|:=)'''
|
||||
entropies = [
|
||||
"4.1-4.3",
|
||||
]
|
||||
`
|
||||
|
||||
const testMDFileType = `
|
||||
[[rules]]
|
||||
description = "test only markdown"
|
||||
filetypes = [".md"]
|
||||
`
|
||||
|
||||
const testEntropyRegexRangeGoFilter = `
|
||||
[[rules]]
|
||||
description = "test entropy regex ranges"
|
||||
regex = '''(?i)key(.{0,6})?(:|=|=>|:=)'''
|
||||
entropies = [
|
||||
"4.1-4.3",
|
||||
]
|
||||
filetypes = [".go"]
|
||||
`
|
||||
|
||||
func testTomlLoader() string {
|
||||
tmpDir, _ := ioutil.TempDir("", "whiteListConfigs")
|
||||
ioutil.WriteFile(path.Join(tmpDir, "regex"), []byte(testWhitelistRegex), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "entropyWordRegex"), []byte(testEntropyWordRegexRange), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "entropyRegex"), []byte(testEntropyRegexRange), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "commit"), []byte(testWhitelistCommit), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "file"), []byte(testWhitelistFile), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "repo"), []byte(testWhitelistRepo), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "entropy"), []byte(testEntropyRange), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "badEntropy"), []byte(testBadEntropyRange), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "badEntropy2"), []byte(testBadEntropyRange2), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "mdFiles"), []byte(testMDFileType), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "entropyRegexGo"), []byte(testEntropyRegexRangeGoFilter), 0644)
|
||||
return tmpDir
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hako/durafmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
opts *Options
|
||||
config *Config
|
||||
dir string
|
||||
threads int
|
||||
totalCommits int64
|
||||
commitMap = make(map[string]bool)
|
||||
auditDone bool
|
||||
mutex = &sync.Mutex{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetOutput(os.Stdout)
|
||||
threads = defaultThreadNum
|
||||
}
|
||||
|
||||
// Report can be exported as a json or csv. Used for logging informationn
|
||||
// about the audit, (duration and # of commits)
|
||||
type Report struct {
|
||||
Leaks []Leak
|
||||
Duration string
|
||||
Commits int64
|
||||
}
|
||||
|
||||
// Run is the entry point for gitleaks
|
||||
func Run(optsL *Options) (*Report, error) {
|
||||
var (
|
||||
leaks []Leak
|
||||
err error
|
||||
)
|
||||
|
||||
now := time.Now()
|
||||
opts = optsL
|
||||
config, err = newConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opts.Disk {
|
||||
// temporary directory where all the gitleaks plain clones will reside
|
||||
dir, err = ioutil.TempDir("", "gitleaks")
|
||||
defer os.RemoveAll(dir)
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
}
|
||||
|
||||
// start audits
|
||||
if opts.Repo != "" || opts.RepoPath != "" {
|
||||
repoInfo, err := newRepoInfo()
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
err = repoInfo.clone()
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
leaks, err = repoInfo.audit()
|
||||
} else if opts.OwnerPath != "" {
|
||||
repoDs, err := discoverRepos(opts.OwnerPath)
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
for _, repoInfo := range repoDs {
|
||||
err = repoInfo.clone()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
leaksFromRepo, err := repoInfo.audit()
|
||||
|
||||
if err != nil {
|
||||
log.Warnf("error occured auditing repo: %s, continuing", repoInfo.name)
|
||||
}
|
||||
leaks = append(leaksFromRepo, leaks...)
|
||||
}
|
||||
} else if opts.GithubOrg != "" || opts.GithubUser != "" {
|
||||
leaks, err = auditGithubRepos()
|
||||
} else if opts.GitLabOrg != "" || opts.GitLabUser != "" {
|
||||
leaks, err = auditGitlabRepos()
|
||||
} else if opts.GithubPR != "" {
|
||||
leaks, err = auditGithubPR()
|
||||
}
|
||||
|
||||
postAudit:
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "whitelisted") {
|
||||
log.Info(err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Error(err)
|
||||
os.Exit(ErrExit)
|
||||
}
|
||||
|
||||
if opts.Report != "" {
|
||||
writeReport(leaks)
|
||||
}
|
||||
|
||||
return &Report{
|
||||
Leaks: leaks,
|
||||
Duration: durafmt.Parse(time.Now().Sub(now)).String(),
|
||||
Commits: totalCommits,
|
||||
}, err
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
// getShannonEntropy https://en.wiktionary.org/wiki/Shannon_entropy
|
||||
func getShannonEntropy(data string) (entropy float64) {
|
||||
if data == "" {
|
||||
return 0
|
||||
}
|
||||
|
||||
charCounts := make(map[rune]int)
|
||||
for _, char := range data {
|
||||
charCounts[char]++
|
||||
}
|
||||
|
||||
invLength := 1.0 / float64(len(data))
|
||||
for _, count := range charCounts {
|
||||
freq := float64(count) * invLength
|
||||
entropy -= freq * math.Log2(freq)
|
||||
}
|
||||
|
||||
return entropy
|
||||
}
|
||||
-268
@@ -1,268 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/oauth2"
|
||||
git "gopkg.in/src-d/go-git.v4"
|
||||
gitHttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
|
||||
"gopkg.in/src-d/go-git.v4/storage/memory"
|
||||
)
|
||||
|
||||
var githubPages = 100
|
||||
|
||||
// auditPR audits a single github PR
|
||||
func auditGithubPR() ([]Leak, error) {
|
||||
var leaks []Leak
|
||||
ctx := context.Background()
|
||||
githubClient := github.NewClient(githubToken())
|
||||
splits := strings.Split(opts.GithubPR, "/")
|
||||
owner := splits[len(splits)-4]
|
||||
repo := splits[len(splits)-3]
|
||||
prNum, err := strconv.Atoi(splits[len(splits)-1])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
page := 1
|
||||
for {
|
||||
commits, resp, err := githubClient.PullRequests.ListCommits(ctx, owner, repo, prNum, &github.ListOptions{
|
||||
PerPage: githubPages,
|
||||
Page: page,
|
||||
})
|
||||
if err != nil {
|
||||
return leaks, err
|
||||
}
|
||||
|
||||
for _, c := range commits {
|
||||
totalCommits = totalCommits + 1
|
||||
c, _, err := githubClient.Repositories.GetCommit(ctx, owner, repo, *c.SHA)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
files := c.Files
|
||||
for _, f := range files {
|
||||
skipFile := false
|
||||
if f.Patch == nil || f.Filename == nil {
|
||||
continue
|
||||
}
|
||||
for _, re := range config.WhiteList.files {
|
||||
if re.FindString(f.GetFilename()) != "" {
|
||||
log.Infof("skipping whitelisted file (matched regex '%s'): %s", re.String(), f.GetFilename())
|
||||
skipFile = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if skipFile {
|
||||
continue
|
||||
}
|
||||
|
||||
commit := &commitInfo{
|
||||
sha: c.GetSHA(),
|
||||
content: *f.Patch,
|
||||
filePath: *f.Filename,
|
||||
repoName: repo,
|
||||
author: c.GetCommitter().GetLogin(),
|
||||
message: *c.Commit.Message,
|
||||
date: *c.Commit.Committer.Date,
|
||||
}
|
||||
leaks = append(leaks, inspect(commit)...)
|
||||
}
|
||||
}
|
||||
page = resp.NextPage
|
||||
if resp.LastPage == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return leaks, nil
|
||||
}
|
||||
|
||||
// auditGithubRepos kicks off audits if --github-user or --github-org options are set.
|
||||
// First, we gather all the github repositories from the github api (this doesnt actually clone the repo).
|
||||
// After all the repos have been pulled from github's api we proceed to audit the repos by calling auditGithubRepo.
|
||||
// If an error occurs during an audit of a repo, that error is logged but won't break the execution cycle.
|
||||
func auditGithubRepos() ([]Leak, error) {
|
||||
var (
|
||||
err error
|
||||
githubRepos []*github.Repository
|
||||
pagedGithubRepos []*github.Repository
|
||||
resp *github.Response
|
||||
githubOrgOptions *github.RepositoryListByOrgOptions
|
||||
githubOptions *github.RepositoryListOptions
|
||||
done bool
|
||||
leaks []Leak
|
||||
ownerDir string
|
||||
)
|
||||
ctx := context.Background()
|
||||
githubClient := github.NewClient(githubToken())
|
||||
|
||||
if opts.GithubOrg != "" {
|
||||
if opts.GithubURL != "" && opts.GithubURL != defaultGithubURL {
|
||||
ghURL, _ := url.Parse(opts.GithubURL)
|
||||
githubClient.BaseURL = ghURL
|
||||
}
|
||||
githubOrgOptions = &github.RepositoryListByOrgOptions{
|
||||
ListOptions: github.ListOptions{PerPage: 100},
|
||||
}
|
||||
} else if opts.GithubUser != "" {
|
||||
if opts.GithubURL != "" && opts.GithubURL != defaultGithubURL {
|
||||
ghURL, _ := url.Parse(opts.GithubURL)
|
||||
githubClient.BaseURL = ghURL
|
||||
}
|
||||
|
||||
githubOptions = &github.RepositoryListOptions{
|
||||
Affiliation: "owner",
|
||||
ListOptions: github.ListOptions{
|
||||
PerPage: 100,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
for {
|
||||
if done {
|
||||
break
|
||||
}
|
||||
if opts.GithubUser != "" {
|
||||
pagedGithubRepos, resp, err = githubClient.Repositories.List(ctx, opts.GithubUser, githubOptions)
|
||||
if err != nil {
|
||||
done = true
|
||||
}
|
||||
githubOptions.Page = resp.NextPage
|
||||
githubRepos = append(githubRepos, pagedGithubRepos...)
|
||||
if resp.NextPage == 0 {
|
||||
done = true
|
||||
}
|
||||
} else if opts.GithubOrg != "" {
|
||||
pagedGithubRepos, resp, err = githubClient.Repositories.ListByOrg(ctx, opts.GithubOrg, githubOrgOptions)
|
||||
if err != nil {
|
||||
done = true
|
||||
}
|
||||
githubOrgOptions.Page = resp.NextPage
|
||||
githubRepos = append(githubRepos, pagedGithubRepos...)
|
||||
if resp.NextPage == 0 {
|
||||
done = true
|
||||
}
|
||||
}
|
||||
if opts.Log == "Debug" || opts.Log == "debug" {
|
||||
for _, githubRepo := range pagedGithubRepos {
|
||||
log.Debugf("staging repos %s", *githubRepo.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if opts.Disk {
|
||||
ownerDir, _ = ioutil.TempDir(dir, opts.GithubUser)
|
||||
}
|
||||
for _, githubRepo := range githubRepos {
|
||||
repoD, err := cloneGithubRepo(githubRepo)
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
continue
|
||||
}
|
||||
leaksFromRepo, err := repoD.audit()
|
||||
if opts.Disk {
|
||||
os.RemoveAll(fmt.Sprintf("%s/%s", ownerDir, *githubRepo.Name))
|
||||
}
|
||||
if len(leaksFromRepo) == 0 {
|
||||
log.Infof("no leaks found for repo %s", *githubRepo.Name)
|
||||
} else {
|
||||
log.Warnf("leaks found for repo %s", *githubRepo.Name)
|
||||
}
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
leaks = append(leaks, leaksFromRepo...)
|
||||
}
|
||||
return leaks, nil
|
||||
}
|
||||
|
||||
// cloneGithubRepo clones a repo from the url parsed from a github repo. The repo
|
||||
// will be cloned to disk if --disk is set.
|
||||
func cloneGithubRepo(githubRepo *github.Repository) (*RepoInfo, error) {
|
||||
var (
|
||||
repo *git.Repository
|
||||
err error
|
||||
)
|
||||
githubToken := os.Getenv("GITHUB_TOKEN")
|
||||
if opts.ExcludeForks && githubRepo.GetFork() {
|
||||
return nil, fmt.Errorf("skipping %s, excluding forks", *githubRepo.Name)
|
||||
}
|
||||
for _, re := range config.WhiteList.repos {
|
||||
if re.FindString(*githubRepo.Name) != "" {
|
||||
return nil, fmt.Errorf("skipping %s, whitelisted", *githubRepo.Name)
|
||||
}
|
||||
}
|
||||
log.Infof("cloning: %s", *githubRepo.Name)
|
||||
if opts.Disk {
|
||||
ownerDir, err := ioutil.TempDir(dir, opts.GithubUser)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to generater owner temp dir: %v", err)
|
||||
}
|
||||
if config.sshAuth != nil && githubToken == "" {
|
||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%s", ownerDir, *githubRepo.Name), false, &git.CloneOptions{
|
||||
URL: *githubRepo.SSHURL,
|
||||
Auth: config.sshAuth,
|
||||
})
|
||||
} else if githubToken != "" {
|
||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%s", ownerDir, *githubRepo.Name), false, &git.CloneOptions{
|
||||
URL: *githubRepo.CloneURL,
|
||||
Auth: &gitHttp.BasicAuth{
|
||||
Username: "fakeUsername", // yes, this can be anything except an empty string
|
||||
Password: githubToken,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%s", ownerDir, *githubRepo.Name), false, &git.CloneOptions{
|
||||
URL: *githubRepo.CloneURL,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if config.sshAuth != nil && githubToken == "" {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: *githubRepo.SSHURL,
|
||||
Auth: config.sshAuth,
|
||||
})
|
||||
} else if githubToken != "" {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: *githubRepo.CloneURL,
|
||||
Auth: &gitHttp.BasicAuth{
|
||||
Username: "fakeUsername", // yes, this can be anything except an empty string
|
||||
Password: githubToken,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: *githubRepo.CloneURL,
|
||||
})
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &RepoInfo{
|
||||
repository: repo,
|
||||
name: *githubRepo.Name,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// githubToken returns an oauth2 client for the github api to consume. This token is necessary
|
||||
// if you are running audits with --github-user or --github-org
|
||||
func githubToken() *http.Client {
|
||||
githubToken := os.Getenv("GITHUB_TOKEN")
|
||||
if githubToken == "" {
|
||||
return nil
|
||||
}
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: githubToken},
|
||||
)
|
||||
return oauth2.NewClient(context.Background(), ts)
|
||||
}
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/xanzy/go-gitlab"
|
||||
"gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/storage/memory"
|
||||
)
|
||||
|
||||
// gitlabPages number of records per request
|
||||
const gitlabPages = 100
|
||||
|
||||
// auditGitlabRepos kicks off audits if --gitlab-user or --gitlab-org options are set.
|
||||
// Getting all repositories from the GitLab API and run audit. If an error occurs during an audit of a repo,
|
||||
// that error is logged.
|
||||
func auditGitlabRepos() ([]Leak, error) {
|
||||
var (
|
||||
ps []*gitlab.Project
|
||||
resp *gitlab.Response
|
||||
leaks []Leak
|
||||
tempDir string
|
||||
err error
|
||||
)
|
||||
|
||||
repos := make([]*gitlab.Project, 0, gitlabPages)
|
||||
page := 1
|
||||
cl := gitlab.NewClient(nil, os.Getenv("GITLAB_TOKEN"))
|
||||
|
||||
// if self hosted GitLab server
|
||||
if url := os.Getenv("GITLAB_URL"); url != "" {
|
||||
cl.SetBaseURL(url)
|
||||
}
|
||||
|
||||
for {
|
||||
if opts.GitLabOrg != "" {
|
||||
opt := &gitlab.ListGroupProjectsOptions{
|
||||
ListOptions: gitlab.ListOptions{
|
||||
PerPage: gitlabPages,
|
||||
Page: page,
|
||||
},
|
||||
}
|
||||
|
||||
ps, resp, err = cl.Groups.ListGroupProjects(opts.GitLabOrg, opt)
|
||||
} else if opts.GitLabUser != "" {
|
||||
opt := &gitlab.ListProjectsOptions{
|
||||
ListOptions: gitlab.ListOptions{
|
||||
PerPage: gitlabPages,
|
||||
Page: page,
|
||||
},
|
||||
}
|
||||
|
||||
ps, resp, err = cl.Projects.ListUserProjects(opts.GitLabUser, opt)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// exit when can't make API call
|
||||
log.Fatal("error listing projects: ", err)
|
||||
}
|
||||
|
||||
repos = append(repos, ps...)
|
||||
|
||||
if page >= resp.TotalPages {
|
||||
// exit when we've seen all pages
|
||||
break
|
||||
}
|
||||
|
||||
page = resp.NextPage
|
||||
}
|
||||
|
||||
log.Debugf("found projects: %d", len(repos))
|
||||
|
||||
if opts.Disk {
|
||||
if tempDir, err = createGitlabTempDir(); err != nil {
|
||||
log.Fatal("error creating temp directory: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range repos {
|
||||
repoInfo, err := cloneGitlabRepo(tempDir, p)
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
continue
|
||||
}
|
||||
|
||||
leaksFromRepo, err := repoInfo.audit()
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
|
||||
if opts.Disk {
|
||||
os.RemoveAll(fmt.Sprintf("%s/%d", tempDir, p.ID))
|
||||
}
|
||||
|
||||
if len(leaksFromRepo) == 0 {
|
||||
log.Infof("no leaks found for repo %s", p.Name)
|
||||
} else {
|
||||
log.Warnf("leaks found for repo %s", p.Name)
|
||||
}
|
||||
|
||||
leaks = append(leaks, leaksFromRepo...)
|
||||
}
|
||||
|
||||
return leaks, nil
|
||||
}
|
||||
|
||||
func createGitlabTempDir() (string, error) {
|
||||
pathName := opts.GitLabUser
|
||||
if opts.GitLabOrg != "" {
|
||||
pathName = opts.GitLabOrg
|
||||
}
|
||||
|
||||
os.RemoveAll(fmt.Sprintf("%s/%s", dir, pathName))
|
||||
|
||||
ownerDir, err := ioutil.TempDir(dir, pathName)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return ownerDir, nil
|
||||
}
|
||||
|
||||
func cloneGitlabRepo(tempDir string, p *gitlab.Project) (*RepoInfo, error) {
|
||||
var (
|
||||
repo *git.Repository
|
||||
err error
|
||||
)
|
||||
if opts.ExcludeForks && p.ForkedFromProject != nil {
|
||||
return nil, fmt.Errorf("skipping %s, excluding forks", p.Name)
|
||||
}
|
||||
|
||||
for _, re := range config.WhiteList.repos {
|
||||
if re.FindString(p.Name) != "" {
|
||||
return nil, fmt.Errorf("skipping %s, whitelisted", p.Name)
|
||||
}
|
||||
}
|
||||
|
||||
opt := &git.CloneOptions{
|
||||
URL: p.HTTPURLToRepo,
|
||||
}
|
||||
|
||||
if config.sshAuth != nil {
|
||||
opt.URL = p.SSHURLToRepo
|
||||
opt.Auth = config.sshAuth
|
||||
}
|
||||
|
||||
log.Infof("cloning: %s", p.Name)
|
||||
|
||||
if opts.Disk {
|
||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%d", tempDir, p.ID), false, opt)
|
||||
} else {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, opt)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &RepoInfo{
|
||||
repository: repo,
|
||||
name: p.Name,
|
||||
}, nil
|
||||
}
|
||||
@@ -1,775 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
git "gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/storage/memory"
|
||||
)
|
||||
|
||||
func TestGetRepo(t *testing.T) {
|
||||
var err error
|
||||
dir, err = ioutil.TempDir("", "gitleaksTestRepo")
|
||||
defer os.RemoveAll(dir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_, err = git.PlainClone(dir, false, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/gronit",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
testOpts *Options
|
||||
description string
|
||||
expectedErrMsg string
|
||||
}{
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/gronit",
|
||||
},
|
||||
description: "test plain clone remote repo",
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/gronit",
|
||||
Disk: true,
|
||||
},
|
||||
description: "test on disk clone remote repo",
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
RepoPath: dir,
|
||||
},
|
||||
description: "test local clone repo",
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/nope",
|
||||
},
|
||||
description: "test no repo",
|
||||
expectedErrMsg: "authentication required",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/private",
|
||||
},
|
||||
description: "test private repo",
|
||||
expectedErrMsg: "authentication required",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/private",
|
||||
Disk: true,
|
||||
},
|
||||
description: "test private repo",
|
||||
expectedErrMsg: "authentication required",
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestGetRepo", func() {
|
||||
g.It(test.description, func() {
|
||||
opts = test.testOpts
|
||||
config, err = newConfig()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
repo, _ := newRepoInfo()
|
||||
err := repo.clone()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRun(t *testing.T) {
|
||||
var err error
|
||||
configsDir := testTomlLoader()
|
||||
|
||||
dir, err = ioutil.TempDir("", "gitleaksTestOwner")
|
||||
defer os.RemoveAll(dir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
git.PlainClone(dir+"/gronit", false, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/gronit",
|
||||
})
|
||||
git.PlainClone(dir+"/h1domains", false, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/h1domains",
|
||||
})
|
||||
var tests = []struct {
|
||||
testOpts *Options
|
||||
description string
|
||||
expectedErrMsg string
|
||||
whiteListRepos []string
|
||||
whiteListFiles []*regexp.Regexp
|
||||
numLeaks int
|
||||
configPath string
|
||||
commitPerPage int
|
||||
}{
|
||||
{
|
||||
testOpts: &Options{
|
||||
GitLabUser: "gitleakstest",
|
||||
},
|
||||
description: "test gitlab user",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubUser: "gitleakstest",
|
||||
},
|
||||
description: "test github user",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubUser: "gitleakstest",
|
||||
Disk: true,
|
||||
},
|
||||
description: "test github user on disk ",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
},
|
||||
description: "test github org",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
Disk: true,
|
||||
},
|
||||
description: "test org on disk",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
OwnerPath: dir,
|
||||
},
|
||||
description: "test owner path",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "git@github.com:gitleakstest/gronit.git",
|
||||
SSHKey: "trash",
|
||||
},
|
||||
description: "test leak",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "unable to generate ssh key: open trash: no such file or directory",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/gronit.git",
|
||||
},
|
||||
description: "test leak",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/h1domains.git",
|
||||
},
|
||||
description: "test clean",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
Repo: "https://github.com/gitleakstest/empty.git",
|
||||
},
|
||||
description: "test empty",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "reference not found",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
},
|
||||
description: "test github org, whitelist repo",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
configPath: path.Join(configsDir, "repo"),
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
ExcludeForks: true,
|
||||
},
|
||||
description: "test github org, exclude forks",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubPR: "https://github.com/gitleakstest/gronit/pull/1",
|
||||
},
|
||||
description: "test github pr",
|
||||
numLeaks: 4,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubPR: "https://github.com/gitleakstest/gronit/pull/1",
|
||||
},
|
||||
description: "test github pr",
|
||||
numLeaks: 4,
|
||||
expectedErrMsg: "",
|
||||
commitPerPage: 1,
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubPR: "https://github.com/gitleakstest/gronit/pull/1",
|
||||
},
|
||||
description: "test github pr with whitelisted files",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
commitPerPage: 1,
|
||||
configPath: path.Join(configsDir, "file"),
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubPR: "https://github.com/gitleakstest/gronit/pull/2",
|
||||
},
|
||||
description: "test github pr with commits without patch info",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
commitPerPage: 1,
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestRun", func() {
|
||||
g.It(test.description, func() {
|
||||
if test.configPath != "" {
|
||||
os.Setenv("GITLEAKS_CONFIG", test.configPath)
|
||||
}
|
||||
if test.commitPerPage != 0 {
|
||||
githubPages = test.commitPerPage
|
||||
}
|
||||
report, err := Run(test.testOpts)
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
} else {
|
||||
g.Assert(len(report.Leaks)).Equal(test.numLeaks)
|
||||
}
|
||||
githubPages = 100
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteReport(t *testing.T) {
|
||||
tmpDir, _ := ioutil.TempDir("", "reportDir")
|
||||
reportJSON := path.Join(tmpDir, "report.json")
|
||||
reportJASON := path.Join(tmpDir, "report.jason")
|
||||
reportVOID := path.Join("thereIsNoWay", "thisReportWillGetWritten.json")
|
||||
reportCSV := path.Join(tmpDir, "report.csv")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
leaks := []Leak{
|
||||
{
|
||||
Line: "eat",
|
||||
Commit: "your",
|
||||
Offender: "veggies",
|
||||
Rule: "and",
|
||||
Message: "get",
|
||||
Author: "some",
|
||||
File: "sleep",
|
||||
Date: time.Now(),
|
||||
},
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
leaks []Leak
|
||||
reportFile string
|
||||
fileName string
|
||||
description string
|
||||
testOpts Options
|
||||
expectedErrMsg string
|
||||
}{
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportJSON,
|
||||
fileName: "report.json",
|
||||
description: "can we write a json file",
|
||||
testOpts: Options{
|
||||
Report: reportJSON,
|
||||
},
|
||||
},
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportCSV,
|
||||
fileName: "report.csv",
|
||||
description: "can we write a csv file",
|
||||
testOpts: Options{
|
||||
Report: reportCSV,
|
||||
},
|
||||
},
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportJASON,
|
||||
fileName: "report.jason",
|
||||
description: "bad file",
|
||||
expectedErrMsg: "Report should be a .json or .csv file",
|
||||
testOpts: Options{
|
||||
Report: reportJASON,
|
||||
},
|
||||
},
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportVOID,
|
||||
fileName: "report.jason",
|
||||
description: "bad dir",
|
||||
expectedErrMsg: "thereIsNoWay does not exist",
|
||||
testOpts: Options{
|
||||
Report: reportVOID,
|
||||
},
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestWriteReport", func() {
|
||||
g.It(test.description, func() {
|
||||
opts = &(test.testOpts)
|
||||
err := opts.guard()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
} else {
|
||||
writeReport(test.leaks)
|
||||
f, _ := os.Stat(test.reportFile)
|
||||
g.Assert(f.Name()).Equal(test.fileName)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAuditRepo(t *testing.T) {
|
||||
var leaks []Leak
|
||||
configsDir := testTomlLoader()
|
||||
defer os.RemoveAll(configsDir)
|
||||
|
||||
leaksR, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/gronit.git",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
leaksRepo := &RepoInfo{
|
||||
repository: leaksR,
|
||||
name: "gronit",
|
||||
}
|
||||
|
||||
cleanR, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/h1domains.git",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
cleanRepo := &RepoInfo{
|
||||
repository: cleanR,
|
||||
name: "h1domains",
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
testOpts *Options
|
||||
description string
|
||||
expectedErrMsg string
|
||||
numLeaks int
|
||||
repo *RepoInfo
|
||||
whiteListFiles []*regexp.Regexp
|
||||
whiteListCommits map[string]bool
|
||||
whiteListRepos []*regexp.Regexp
|
||||
whiteListRegexes []*regexp.Regexp
|
||||
configPath string
|
||||
}{
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "pinned config",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{
|
||||
RepoConfig: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 1, one leak",
|
||||
numLeaks: 1,
|
||||
testOpts: &Options{
|
||||
Depth: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "no leaks present on branch",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{
|
||||
Branch: "dev",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present limit goroutines",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{
|
||||
Threads: 4,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present whitelist AWS.. no leaks",
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "regex"),
|
||||
numLeaks: 0,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present limit goroutines",
|
||||
testOpts: &Options{
|
||||
Threads: 2,
|
||||
},
|
||||
numLeaks: 2,
|
||||
},
|
||||
{
|
||||
repo: cleanRepo,
|
||||
description: "no leaks present",
|
||||
testOpts: &Options{},
|
||||
numLeaks: 0,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present whitelist go files",
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "file"),
|
||||
numLeaks: 0,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present whitelist bad commit",
|
||||
configPath: path.Join(configsDir, "commit"),
|
||||
testOpts: &Options{},
|
||||
numLeaks: 1,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "redact",
|
||||
testOpts: &Options{
|
||||
Redact: true,
|
||||
},
|
||||
numLeaks: 2,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "Audit a specific commit",
|
||||
numLeaks: 1,
|
||||
testOpts: &Options{
|
||||
Commit: "cb5599aeed261b2c038aa4729e2d53ca050a4988",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "Audit a specific commit no leaks",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{
|
||||
Commit: "2b033e012eee364fc41b4ab7c5db1497399b8e67",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml whitelist regex",
|
||||
configPath: path.Join(configsDir, "regex"),
|
||||
testOpts: &Options{},
|
||||
numLeaks: 0,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml whitelist file",
|
||||
configPath: path.Join(configsDir, "file"),
|
||||
testOpts: &Options{},
|
||||
numLeaks: 0,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml whitelist commit",
|
||||
configPath: path.Join(configsDir, "commit"),
|
||||
testOpts: &Options{},
|
||||
numLeaks: 1,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "audit whitelist repo",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "repo"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml whitelist repo",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "repo"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "Audit until specific commit",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{
|
||||
CommitStop: "f6839959b7bbdcd23008f1fb16f797f35bcd3a0c",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 2, two leaks",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{
|
||||
Depth: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml entropy range from opts",
|
||||
numLeaks: 266,
|
||||
testOpts: &Options{
|
||||
ConfigPath: path.Join(configsDir, "entropy"),
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml entropy regex word range",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "entropyWordRegex"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml entropy regex range",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "entropyRegex"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml bad entropy range",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "badEntropy"),
|
||||
expectedErrMsg: "entropy range must be ascending",
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml bad entropy2 range",
|
||||
numLeaks: 0,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "badEntropy2"),
|
||||
expectedErrMsg: "invalid entropy ranges, must be within 0.0-8.0",
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml md files",
|
||||
numLeaks: 5,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "mdFiles"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml entropys line regex go",
|
||||
numLeaks: 2,
|
||||
testOpts: &Options{},
|
||||
configPath: path.Join(configsDir, "entropyRegexGo"),
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestAuditRepo", func() {
|
||||
g.It(test.description, func() {
|
||||
auditDone = false
|
||||
opts = test.testOpts
|
||||
|
||||
config, err = newConfig()
|
||||
// config paths
|
||||
if test.configPath != "" {
|
||||
os.Setenv("GITLEAKS_CONFIG", test.configPath)
|
||||
config, err = newConfig()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
goto next
|
||||
}
|
||||
}
|
||||
leaks, err = test.repo.audit()
|
||||
if opts.Redact {
|
||||
g.Assert(leaks[0].Offender).Equal("REDACTED")
|
||||
}
|
||||
g.Assert(len(leaks)).Equal(test.numLeaks)
|
||||
next:
|
||||
os.Setenv("GITLEAKS_CONFIG", "")
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestOptionGuard(t *testing.T) {
|
||||
var tests = []struct {
|
||||
testOpts *Options
|
||||
githubToken bool
|
||||
description string
|
||||
expectedErrMsg string
|
||||
expectedErrMsgFuzzy string
|
||||
}{
|
||||
{
|
||||
testOpts: &Options{},
|
||||
description: "default no opts",
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubUser: "fakeUser",
|
||||
GithubOrg: "fakeOrg",
|
||||
},
|
||||
description: "double owner",
|
||||
expectedErrMsg: "github user and organization set",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubOrg: "fakeOrg",
|
||||
OwnerPath: "/dev/null",
|
||||
},
|
||||
description: "local and remote target",
|
||||
expectedErrMsg: "github organization set and local owner path",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
GithubUser: "fakeUser",
|
||||
OwnerPath: "/dev/null",
|
||||
},
|
||||
description: "local and remote target",
|
||||
expectedErrMsg: "github user set and local owner path",
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("Test Option Gaurd", func() {
|
||||
g.It(test.description, func() {
|
||||
os.Clearenv()
|
||||
opts = test.testOpts
|
||||
if test.githubToken {
|
||||
os.Setenv("GITHUB_TOKEN", "fakeToken")
|
||||
}
|
||||
err := opts.guard()
|
||||
if err != nil {
|
||||
if test.expectedErrMsgFuzzy != "" {
|
||||
g.Assert(strings.Contains(err.Error(), test.expectedErrMsgFuzzy)).Equal(true)
|
||||
} else {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
}
|
||||
} else {
|
||||
g.Assert("").Equal(test.expectedErrMsg)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadToml(t *testing.T) {
|
||||
tmpDir, _ := ioutil.TempDir("", "gitleaksTestConfigDir")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
err := ioutil.WriteFile(path.Join(tmpDir, "gitleaksConfig"), []byte(defaultConfig), 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
configPath := path.Join(tmpDir, "gitleaksConfig")
|
||||
noConfigPath := path.Join(tmpDir, "gitleaksConfigNope")
|
||||
|
||||
var tests = []struct {
|
||||
testOpts *Options
|
||||
description string
|
||||
configPath string
|
||||
expectedErrMsg string
|
||||
singleSearch bool
|
||||
}{
|
||||
{
|
||||
testOpts: &Options{
|
||||
ConfigPath: configPath,
|
||||
},
|
||||
description: "path to config",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{},
|
||||
description: "env var path to no config",
|
||||
singleSearch: true,
|
||||
},
|
||||
{
|
||||
testOpts: &Options{
|
||||
ConfigPath: noConfigPath,
|
||||
},
|
||||
description: "no path to config",
|
||||
expectedErrMsg: fmt.Sprintf("no gitleaks config at %s", noConfigPath),
|
||||
},
|
||||
{
|
||||
testOpts: &Options{},
|
||||
description: "env var path to config",
|
||||
configPath: configPath,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: &Options{},
|
||||
description: "env var path to no config",
|
||||
configPath: noConfigPath,
|
||||
expectedErrMsg: fmt.Sprintf("problem loading config: open %s: no such file or directory", noConfigPath),
|
||||
},
|
||||
}
|
||||
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestLoadToml", func() {
|
||||
g.It(test.description, func() {
|
||||
opts = test.testOpts
|
||||
if test.configPath != "" {
|
||||
os.Setenv("GITLEAKS_CONFIG", test.configPath)
|
||||
} else {
|
||||
os.Clearenv()
|
||||
}
|
||||
_, err = newConfig()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
} else {
|
||||
g.Assert("").Equal(test.expectedErrMsg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
-155
@@ -1,155 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Options for gitleaks
|
||||
type Options struct {
|
||||
// remote target options
|
||||
Repo string `short:"r" long:"repo" description:"Repo url to audit"`
|
||||
GithubUser string `long:"github-user" description:"Github user to audit"`
|
||||
GithubOrg string `long:"github-org" description:"Github organization to audit"`
|
||||
GithubURL string `long:"github-url" default:"https://api.github.com/" description:"GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/"`
|
||||
GithubPR string `long:"github-pr" description:"Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set"`
|
||||
|
||||
GitLabUser string `long:"gitlab-user" description:"GitLab user ID to audit"`
|
||||
GitLabOrg string `long:"gitlab-org" description:"GitLab group ID to audit"`
|
||||
|
||||
CommitStop string `long:"commit-stop" description:"sha of commit to stop at"`
|
||||
Commit string `long:"commit" description:"sha of commit to audit"`
|
||||
Depth int64 `long:"depth" description:"maximum commit depth"`
|
||||
|
||||
// local target option
|
||||
RepoPath string `long:"repo-path" description:"Path to repo"`
|
||||
OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`
|
||||
|
||||
// Process options
|
||||
Threads int `long:"threads" description:"Maximum number of threads gitleaks spawns"`
|
||||
Disk bool `long:"disk" description:"Clones repo(s) to disk"`
|
||||
ConfigPath string `long:"config" description:"path to gitleaks config"`
|
||||
SSHKey string `long:"ssh-key" description:"path to ssh key"`
|
||||
ExcludeForks bool `long:"exclude-forks" description:"exclude forks for organization/user audits"`
|
||||
RepoConfig bool `long:"repo-config" description:"Load config from target repo. Config file must be \".gitleaks.toml\""`
|
||||
Branch string `long:"branch" description:"Branch to audit"`
|
||||
// TODO: IncludeMessages string `long:"messages" description:"include commit messages in audit"`
|
||||
|
||||
// Output options
|
||||
Log string `short:"l" long:"log" description:"log level"`
|
||||
Verbose bool `short:"v" long:"verbose" description:"Show verbose output from gitleaks audit"`
|
||||
Report string `long:"report" description:"path to write report file. Needs to be csv or json"`
|
||||
Redact bool `long:"redact" description:"redact secrets from log messages and report"`
|
||||
Version bool `long:"version" description:"version number"`
|
||||
SampleConfig bool `long:"sample-config" description:"prints a sample config file"`
|
||||
}
|
||||
|
||||
// ParseOpts parses the options
|
||||
func ParseOpts() *Options {
|
||||
var opts Options
|
||||
parser := flags.NewParser(&opts, flags.Default)
|
||||
_, err := parser.Parse()
|
||||
|
||||
if err != nil {
|
||||
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type != flags.ErrHelp {
|
||||
parser.WriteHelp(os.Stdout)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if len(os.Args) == 1 {
|
||||
parser.WriteHelp(os.Stdout)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if opts.Version {
|
||||
fmt.Println(version)
|
||||
os.Exit(0)
|
||||
}
|
||||
if opts.SampleConfig {
|
||||
fmt.Println(defaultConfig)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
opts.setLogs()
|
||||
|
||||
err = opts.guard()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return &opts
|
||||
}
|
||||
|
||||
// optsGuard prevents invalid options
|
||||
func (opts *Options) guard() error {
|
||||
if opts.GithubOrg != "" && opts.GithubUser != "" {
|
||||
return fmt.Errorf("github user and organization set")
|
||||
} else if opts.GithubOrg != "" && opts.OwnerPath != "" {
|
||||
return fmt.Errorf("github organization set and local owner path")
|
||||
} else if opts.GithubUser != "" && opts.OwnerPath != "" {
|
||||
return fmt.Errorf("github user set and local owner path")
|
||||
}
|
||||
|
||||
if opts.Threads > runtime.GOMAXPROCS(0) {
|
||||
return fmt.Errorf("%d available threads", runtime.GOMAXPROCS(0))
|
||||
}
|
||||
|
||||
// do the URL Parse and error checking here, so we can skip it later
|
||||
// empty string is OK, it will default to the public github URL.
|
||||
if opts.GithubURL != "" && opts.GithubURL != defaultGithubURL {
|
||||
if !strings.HasSuffix(opts.GithubURL, "/") {
|
||||
opts.GithubURL += "/"
|
||||
}
|
||||
ghURL, err := url.Parse(opts.GithubURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tcpPort := "443"
|
||||
if ghURL.Scheme == "http" {
|
||||
tcpPort = "80"
|
||||
}
|
||||
timeout := time.Duration(1 * time.Second)
|
||||
_, err = net.DialTimeout("tcp", ghURL.Host+":"+tcpPort, timeout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s unreachable, error: %s", ghURL.Host, err)
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Report != "" {
|
||||
if !strings.HasSuffix(opts.Report, ".json") && !strings.HasSuffix(opts.Report, ".csv") {
|
||||
return fmt.Errorf("Report should be a .json or .csv file")
|
||||
}
|
||||
dirPath := filepath.Dir(opts.Report)
|
||||
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
|
||||
return fmt.Errorf("%s does not exist", dirPath)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// setLogLevel sets log level for gitleaks. Default is Warning
|
||||
func (opts *Options) setLogs() {
|
||||
switch opts.Log {
|
||||
case "info":
|
||||
log.SetLevel(log.InfoLevel)
|
||||
case "debug":
|
||||
log.SetLevel(log.DebugLevel)
|
||||
case "warn":
|
||||
log.SetLevel(log.WarnLevel)
|
||||
default:
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
FullTimestamp: true,
|
||||
})
|
||||
}
|
||||
-347
@@ -1,347 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
git "gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
||||
diffType "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/storer"
|
||||
"gopkg.in/src-d/go-git.v4/storage/memory"
|
||||
)
|
||||
|
||||
// Leak represents a leaked secret or regex match.
|
||||
type Leak struct {
|
||||
Line string `json:"line"`
|
||||
Commit string `json:"commit"`
|
||||
Offender string `json:"offender"`
|
||||
Rule string `json:"rule"`
|
||||
Info string `json:"info"`
|
||||
Message string `json:"commitMsg"`
|
||||
Author string `json:"author"`
|
||||
Email string `json:"email"`
|
||||
File string `json:"file"`
|
||||
Repo string `json:"repo"`
|
||||
Date time.Time `json:"date"`
|
||||
Tags string `json:"tags"`
|
||||
Severity string `json:"severity"`
|
||||
}
|
||||
|
||||
// RepoInfo contains a src-d git repository and other data about the repo
|
||||
type RepoInfo struct {
|
||||
path string
|
||||
url string
|
||||
name string
|
||||
repository *git.Repository
|
||||
err error
|
||||
}
|
||||
|
||||
func newRepoInfo() (*RepoInfo, error) {
|
||||
for _, re := range config.WhiteList.repos {
|
||||
if re.FindString(opts.Repo) != "" {
|
||||
return nil, fmt.Errorf("skipping %s, whitelisted", opts.Repo)
|
||||
}
|
||||
}
|
||||
return &RepoInfo{
|
||||
path: opts.RepoPath,
|
||||
url: opts.Repo,
|
||||
name: filepath.Base(opts.Repo),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// clone will clone a repo
|
||||
func (repoInfo *RepoInfo) clone() error {
|
||||
var (
|
||||
err error
|
||||
repo *git.Repository
|
||||
)
|
||||
|
||||
// check if cloning to disk
|
||||
if opts.Disk {
|
||||
log.Infof("cloning %s to disk", opts.Repo)
|
||||
cloneTarget := fmt.Sprintf("%s/%x", dir, md5.Sum([]byte(fmt.Sprintf("%s%s", opts.GithubUser, opts.Repo))))
|
||||
if strings.HasPrefix(opts.Repo, "git") {
|
||||
// private
|
||||
repo, err = git.PlainClone(cloneTarget, false, &git.CloneOptions{
|
||||
URL: opts.Repo,
|
||||
Progress: os.Stdout,
|
||||
Auth: config.sshAuth,
|
||||
})
|
||||
} else {
|
||||
// public
|
||||
repo, err = git.PlainClone(cloneTarget, false, &git.CloneOptions{
|
||||
URL: opts.Repo,
|
||||
Progress: os.Stdout,
|
||||
})
|
||||
}
|
||||
} else if repoInfo.path != "" {
|
||||
log.Infof("opening %s", opts.RepoPath)
|
||||
repo, err = git.PlainOpen(repoInfo.path)
|
||||
if err != nil {
|
||||
log.Errorf("unable to open %s", opts.RepoPath)
|
||||
}
|
||||
} else {
|
||||
// cloning to memory
|
||||
log.Infof("cloning %s", opts.Repo)
|
||||
if strings.HasPrefix(opts.Repo, "git") {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: opts.Repo,
|
||||
Progress: os.Stdout,
|
||||
Auth: config.sshAuth,
|
||||
})
|
||||
} else {
|
||||
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: opts.Repo,
|
||||
Progress: os.Stdout,
|
||||
})
|
||||
}
|
||||
}
|
||||
repoInfo.repository = repo
|
||||
repoInfo.err = err
|
||||
return err
|
||||
}
|
||||
|
||||
// audit performs an audit
|
||||
func (repoInfo *RepoInfo) audit() ([]Leak, error) {
|
||||
var (
|
||||
err error
|
||||
leaks []Leak
|
||||
commitCount int64
|
||||
commitWg sync.WaitGroup
|
||||
semaphore chan bool
|
||||
logOpts git.LogOptions
|
||||
)
|
||||
for _, re := range config.WhiteList.repos {
|
||||
if re.FindString(repoInfo.name) != "" {
|
||||
return leaks, fmt.Errorf("skipping %s, whitelisted", repoInfo.name)
|
||||
}
|
||||
}
|
||||
|
||||
// check if target contains an external gitleaks toml
|
||||
if opts.RepoConfig {
|
||||
err := config.updateFromRepo(repoInfo)
|
||||
if err != nil {
|
||||
return leaks, nil
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Branch != "" {
|
||||
refs, err := repoInfo.repository.Storer.IterReferences()
|
||||
if err != nil {
|
||||
return leaks, err
|
||||
}
|
||||
err = refs.ForEach(func(ref *plumbing.Reference) error {
|
||||
if ref.Name().IsTag() {
|
||||
return nil
|
||||
}
|
||||
// check heads first
|
||||
if ref.Name().String() == "refs/heads/"+opts.Branch {
|
||||
logOpts = git.LogOptions{
|
||||
From: ref.Hash(),
|
||||
}
|
||||
return nil
|
||||
} else if ref.Name().String() == "refs/remotes/origin/"+opts.Branch {
|
||||
logOpts = git.LogOptions{
|
||||
From: ref.Hash(),
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
})
|
||||
} else {
|
||||
logOpts = git.LogOptions{
|
||||
All: true,
|
||||
}
|
||||
}
|
||||
|
||||
// iterate all through commits
|
||||
cIter, err := repoInfo.repository.Log(&logOpts)
|
||||
|
||||
if err != nil {
|
||||
return leaks, nil
|
||||
}
|
||||
|
||||
if opts.Threads != 0 {
|
||||
threads = opts.Threads
|
||||
}
|
||||
if opts.RepoPath != "" {
|
||||
threads = 1
|
||||
}
|
||||
semaphore = make(chan bool, threads)
|
||||
|
||||
err = cIter.ForEach(func(c *object.Commit) error {
|
||||
if c == nil || (opts.Depth != 0 && commitCount == opts.Depth) {
|
||||
return storer.ErrStop
|
||||
}
|
||||
|
||||
if config.WhiteList.commits[c.Hash.String()] {
|
||||
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||
return nil
|
||||
}
|
||||
|
||||
// commits w/o parent (root of git the git ref) or option for single commit is not empty str
|
||||
if (len(c.ParentHashes) == 0 && opts.Commit == "") || (len(c.ParentHashes) == 0 && opts.Commit == c.Hash.String()) {
|
||||
commitCount = commitCount + 1
|
||||
totalCommits = totalCommits + 1
|
||||
leaksFromSingleCommit := repoInfo.auditSingleCommit(c)
|
||||
mutex.Lock()
|
||||
leaks = append(leaksFromSingleCommit, leaks...)
|
||||
mutex.Unlock()
|
||||
if opts.Commit == c.Hash.String() {
|
||||
return storer.ErrStop
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if opts.Commit != "" && opts.Commit != c.Hash.String() {
|
||||
return nil
|
||||
}
|
||||
|
||||
commitCount = commitCount + 1
|
||||
totalCommits = totalCommits + 1
|
||||
|
||||
// regular commit audit
|
||||
err = c.Parents().ForEach(func(parent *object.Commit) error {
|
||||
commitWg.Add(1)
|
||||
semaphore <- true
|
||||
go func(c *object.Commit, parent *object.Commit) {
|
||||
var (
|
||||
filePath string
|
||||
skipFile bool
|
||||
)
|
||||
defer func() {
|
||||
commitWg.Done()
|
||||
<-semaphore
|
||||
if r := recover(); r != nil {
|
||||
log.Warnf("recovering from panic on commit %s, likely large diff causing panic", c.Hash.String())
|
||||
}
|
||||
}()
|
||||
patch, err := c.Patch(parent)
|
||||
if err != nil {
|
||||
log.Warnf("problem generating patch for commit: %s\n", c.Hash.String())
|
||||
return
|
||||
}
|
||||
for _, f := range patch.FilePatches() {
|
||||
if f.IsBinary() {
|
||||
continue
|
||||
}
|
||||
skipFile = false
|
||||
from, to := f.Files()
|
||||
filePath = "???"
|
||||
if from != nil {
|
||||
filePath = from.Path()
|
||||
} else if to != nil {
|
||||
filePath = to.Path()
|
||||
}
|
||||
|
||||
for _, fr := range config.FileRules {
|
||||
for _, r := range fr.fileTypes {
|
||||
if r.FindString(filePath) != "" {
|
||||
commitInfo := &commitInfo{
|
||||
repoName: repoInfo.name,
|
||||
filePath: filePath,
|
||||
sha: c.Hash.String(),
|
||||
author: c.Author.Name,
|
||||
email: c.Author.Email,
|
||||
message: strings.Replace(c.Message, "\n", " ", -1),
|
||||
date: c.Author.When,
|
||||
}
|
||||
leak := *newLeak("N/A", fmt.Sprintf("filetype %s found", r.String()), r.String(), fr, commitInfo)
|
||||
mutex.Lock()
|
||||
leaks = append(leaks, leak)
|
||||
mutex.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, re := range config.WhiteList.files {
|
||||
if re.FindString(filePath) != "" {
|
||||
log.Debugf("skipping whitelisted file (matched regex '%s'): %s", re.String(), filePath)
|
||||
skipFile = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if skipFile {
|
||||
continue
|
||||
}
|
||||
chunks := f.Chunks()
|
||||
for _, chunk := range chunks {
|
||||
if chunk.Type() == diffType.Add || chunk.Type() == diffType.Delete {
|
||||
diff := &commitInfo{
|
||||
repoName: repoInfo.name,
|
||||
filePath: filePath,
|
||||
content: chunk.Content(),
|
||||
sha: c.Hash.String(),
|
||||
author: c.Author.Name,
|
||||
email: c.Author.Email,
|
||||
message: strings.Replace(c.Message, "\n", " ", -1),
|
||||
date: c.Author.When,
|
||||
}
|
||||
chunkLeaks := inspect(diff)
|
||||
for _, leak := range chunkLeaks {
|
||||
mutex.Lock()
|
||||
leaks = append(leaks, leak)
|
||||
mutex.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}(c, parent)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
commitWg.Wait()
|
||||
return leaks, nil
|
||||
}
|
||||
|
||||
func (repoInfo *RepoInfo) auditSingleCommit(c *object.Commit) []Leak {
|
||||
var leaks []Leak
|
||||
fIter, err := c.Files()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
err = fIter.ForEach(func(f *object.File) error {
|
||||
bin, err := f.IsBinary()
|
||||
if bin || err != nil {
|
||||
return nil
|
||||
}
|
||||
for _, re := range config.WhiteList.files {
|
||||
if re.FindString(f.Name) != "" {
|
||||
log.Debugf("skipping whitelisted file (matched regex '%s'): %s", re.String(), f.Name)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
content, err := f.Contents()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
diff := &commitInfo{
|
||||
repoName: repoInfo.name,
|
||||
filePath: f.Name,
|
||||
content: content,
|
||||
sha: c.Hash.String(),
|
||||
author: c.Author.Name,
|
||||
email: c.Author.Email,
|
||||
message: strings.Replace(c.Message, "\n", " ", -1),
|
||||
date: c.Author.When,
|
||||
}
|
||||
fileLeaks := inspect(diff)
|
||||
mutex.Lock()
|
||||
leaks = append(leaks, fileLeaks...)
|
||||
mutex.Unlock()
|
||||
return nil
|
||||
})
|
||||
return leaks
|
||||
}
|
||||
-239
@@ -1,239 +0,0 @@
|
||||
package gitleaks
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||
)
|
||||
|
||||
type commitInfo struct {
|
||||
content string
|
||||
commit *object.Commit
|
||||
filePath string
|
||||
repoName string
|
||||
sha string
|
||||
message string
|
||||
author string
|
||||
email string
|
||||
date time.Time
|
||||
}
|
||||
|
||||
// writeReport writes a report to a file specified in the --report= option.
|
||||
// Default format for report is JSON. You can use the --csv option to write the report as a csv
|
||||
func writeReport(leaks []Leak) error {
|
||||
if len(leaks) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Infof("writing report to %s", opts.Report)
|
||||
if strings.HasSuffix(opts.Report, ".csv") {
|
||||
f, err := os.Create(opts.Report)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
w := csv.NewWriter(f)
|
||||
w.Write([]string{"repo", "line", "commit", "offender", "rule", "info", "tags", "severity", "commitMsg", "author", "email", "file", "date"})
|
||||
for _, leak := range leaks {
|
||||
w.Write([]string{leak.Repo, leak.Line, leak.Commit, leak.Offender, leak.Rule, leak.Info, leak.Tags, leak.Severity, leak.Message, leak.Author, leak.Email, leak.File, leak.Date.Format(time.RFC3339)})
|
||||
}
|
||||
w.Flush()
|
||||
} else {
|
||||
f, err := os.Create(opts.Report)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
encoder := json.NewEncoder(f)
|
||||
encoder.SetIndent("", "\t")
|
||||
if _, err := f.WriteString("[\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := 0; i < len(leaks); i++ {
|
||||
if err := encoder.Encode(leaks[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
// for all but the last leak, seek back and overwrite the newline appended by Encode() with comma & newline
|
||||
if i+1 < len(leaks) {
|
||||
if _, err := f.Seek(-1, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := f.WriteString(",\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, err := f.WriteString("]"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.Sync(); err != nil {
|
||||
log.Error(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// check rule will inspect a single line and return a leak if it encounters one
|
||||
func (rule *Rule) check(line string, commit *commitInfo) (*Leak, error) {
|
||||
var (
|
||||
match string
|
||||
fileMatch string
|
||||
entropy float64
|
||||
entropyWord string
|
||||
)
|
||||
|
||||
for _, f := range rule.fileTypes {
|
||||
fileMatch = f.FindString(commit.filePath)
|
||||
if fileMatch != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if fileMatch == "" && len(rule.fileTypes) != 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if rule.entropies != nil {
|
||||
if rule.entropyROI == "word" {
|
||||
words := strings.Fields(line)
|
||||
for _, word := range words {
|
||||
_entropy := getShannonEntropy(word)
|
||||
for _, e := range rule.entropies {
|
||||
if _entropy > e.v1 && _entropy < e.v2 {
|
||||
entropy = _entropy
|
||||
entropyWord = word
|
||||
goto postEntropy
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_entropy := getShannonEntropy(line)
|
||||
for _, e := range rule.entropies {
|
||||
if _entropy > e.v1 && _entropy < e.v2 {
|
||||
entropy = _entropy
|
||||
entropyWord = line
|
||||
goto postEntropy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
postEntropy:
|
||||
if rule.regex != nil {
|
||||
match = rule.regex.FindString(line)
|
||||
}
|
||||
|
||||
if match != "" && entropy != 0.0 {
|
||||
return newLeak(line, fmt.Sprintf("%s regex match and entropy met at %.2f", rule.regex.String(), entropy), entropyWord, rule, commit), nil
|
||||
} else if match != "" && rule.entropies == nil {
|
||||
return newLeak(line, fmt.Sprintf("%s regex match", rule.regex.String()), match, rule, commit), nil
|
||||
} else if entropy != 0.0 && rule.regex.String() == "" {
|
||||
return newLeak(line, fmt.Sprintf("entropy met at %.2f", entropy), entropyWord, rule, commit), nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// inspect will parse each line of the git diff's content against a set of regexes or
|
||||
// a set of regexes set by the config (see gitleaks.toml for example). This function
|
||||
// will skip lines that include a whitelisted regex. A list of leaks is returned.
|
||||
// If verbose mode (-v/--verbose) is set, then checkDiff will log leaks as they are discovered.
|
||||
func inspect(commit *commitInfo) []Leak {
|
||||
var leaks []Leak
|
||||
lines := strings.Split(commit.content, "\n")
|
||||
|
||||
for _, line := range lines {
|
||||
for _, rule := range config.Rules {
|
||||
if isLineWhitelisted(line) {
|
||||
break
|
||||
}
|
||||
leak, err := rule.check(line, commit)
|
||||
if err != nil || leak == nil {
|
||||
continue
|
||||
}
|
||||
leaks = append(leaks, *leak)
|
||||
}
|
||||
}
|
||||
return leaks
|
||||
}
|
||||
|
||||
// isLineWhitelisted returns true iff the line is matched by at least one of the whiteListRegexes.
|
||||
func isLineWhitelisted(line string) bool {
|
||||
for _, wRe := range config.WhiteList.regexes {
|
||||
whitelistMatch := wRe.FindString(line)
|
||||
if whitelistMatch != "" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func newLeak(line string, info string, offender string, rule *Rule, commit *commitInfo) *Leak {
|
||||
leak := &Leak{
|
||||
Line: line,
|
||||
Commit: commit.sha,
|
||||
Offender: offender,
|
||||
Rule: rule.description,
|
||||
Info: info,
|
||||
Author: commit.author,
|
||||
Email: commit.email,
|
||||
File: commit.filePath,
|
||||
Repo: commit.repoName,
|
||||
Message: commit.message,
|
||||
Date: commit.date,
|
||||
Tags: strings.Join(rule.tags, ", "),
|
||||
Severity: rule.severity,
|
||||
}
|
||||
if opts.Redact {
|
||||
leak.Offender = "REDACTED"
|
||||
leak.Line = strings.Replace(line, offender, "REDACTED", -1)
|
||||
}
|
||||
|
||||
if opts.Verbose {
|
||||
leak.log()
|
||||
}
|
||||
return leak
|
||||
}
|
||||
|
||||
// discoverRepos walks all the children of `path`. If a child directory
|
||||
// contain a .git subdirectory then that repo will be added to the list of repos returned
|
||||
func discoverRepos(ownerPath string) ([]*RepoInfo, error) {
|
||||
var (
|
||||
err error
|
||||
repoDs []*RepoInfo
|
||||
)
|
||||
files, err := ioutil.ReadDir(ownerPath)
|
||||
if err != nil {
|
||||
return repoDs, err
|
||||
}
|
||||
for _, f := range files {
|
||||
repoPath := path.Join(ownerPath, f.Name())
|
||||
if f.IsDir() && containsGit(repoPath) {
|
||||
repoDs = append(repoDs, &RepoInfo{
|
||||
name: f.Name(),
|
||||
path: repoPath,
|
||||
})
|
||||
}
|
||||
}
|
||||
return repoDs, err
|
||||
}
|
||||
|
||||
func (leak Leak) log() {
|
||||
b, _ := json.MarshalIndent(leak, "", " ")
|
||||
fmt.Println(string(b))
|
||||
}
|
||||
|
||||
func containsGit(repoPath string) bool {
|
||||
if _, err := os.Stat(repoPath); os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
title = "simple config with allowlist for aws"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
[rules.allowlist]
|
||||
regexes = ['''AKIALALEMEL33243OLIA''']
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
title = "simple config with allowlist for a specific commit"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
[rules.allowlist]
|
||||
commits = ['''allowthiscommit''']
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
|
||||
[allowlist]
|
||||
regexes = ['''AKIALALEMEL33243OLIA''']
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
title = "simple config with allowlist for .go files"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
[rules.allowlist]
|
||||
paths = ['''.go''']
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
id = "discord-api-key"
|
||||
description = "Discord API key"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||
secretGroup = 5
|
||||
entropy = 3.5
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
id = "discord-api-key"
|
||||
description = "Discord API key"
|
||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||
secretGroup = 3
|
||||
entropy = 3.5
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Generic API Key"
|
||||
id = "generic-api-key"
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
entropy = 3.7
|
||||
secretGroup = 4
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Generic API Key"
|
||||
id = "generic-api-key"
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
path = '''.py'''
|
||||
entropy = 3.7
|
||||
secretGroup = 4
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Python Files"
|
||||
id = "python-files-only"
|
||||
path = '''.py'''
|
||||
Vendored
+171
@@ -0,0 +1,171 @@
|
||||
title = "gitleaks config"
|
||||
# https://learnxinyminutes.com/docs/toml/ for toml reference
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Secret Key"
|
||||
regex = '''(?i)aws_(.{0,20})?=?.[\'\"0-9a-zA-Z\/+]{40}'''
|
||||
tags = ["key", "AWS"]
|
||||
|
||||
[[rules]]
|
||||
description = "AWS MWS key"
|
||||
regex = '''amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
|
||||
tags = ["key", "AWS", "MWS"]
|
||||
|
||||
[[rules]]
|
||||
description = "Facebook Secret Key"
|
||||
regex = '''(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]'''
|
||||
tags = ["key", "Facebook"]
|
||||
|
||||
[[rules]]
|
||||
description = "Facebook Client ID"
|
||||
regex = '''(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]'''
|
||||
tags = ["key", "Facebook"]
|
||||
|
||||
[[rules]]
|
||||
description = "Twitter Secret Key"
|
||||
regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{35,44}['\"]'''
|
||||
tags = ["key", "Twitter"]
|
||||
|
||||
[[rules]]
|
||||
description = "Twitter Client ID"
|
||||
regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{18,25}['\"]'''
|
||||
tags = ["client", "Twitter"]
|
||||
|
||||
[[rules]]
|
||||
description = "Github Personal Access Token"
|
||||
regex = '''ghp_[0-9a-zA-Z]{36}'''
|
||||
tags = ["key", "Github"]
|
||||
[[rules]]
|
||||
description = "Github OAuth Access Token"
|
||||
regex = '''gho_[0-9a-zA-Z]{36}'''
|
||||
tags = ["key", "Github"]
|
||||
[[rules]]
|
||||
description = "Github App Token"
|
||||
regex = '''(ghu|ghs)_[0-9a-zA-Z]{36}'''
|
||||
tags = ["key", "Github"]
|
||||
[[rules]]
|
||||
description = "Github Refresh Token"
|
||||
regex = '''ghr_[0-9a-zA-Z]{76}'''
|
||||
tags = ["key", "Github"]
|
||||
|
||||
[[rules]]
|
||||
description = "LinkedIn Client ID"
|
||||
regex = '''(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}'''
|
||||
tags = ["client", "LinkedIn"]
|
||||
|
||||
[[rules]]
|
||||
description = "LinkedIn Secret Key"
|
||||
regex = '''(?i)linkedin(.{0,20})?[0-9a-z]{16}'''
|
||||
tags = ["secret", "LinkedIn"]
|
||||
|
||||
[[rules]]
|
||||
description = "Slack"
|
||||
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
|
||||
tags = ["key", "Slack"]
|
||||
|
||||
[[rules]]
|
||||
description = "Asymmetric Private Key"
|
||||
regex = '''-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----'''
|
||||
tags = ["key", "AsymmetricPrivateKey"]
|
||||
|
||||
[[rules]]
|
||||
description = "Google API key"
|
||||
regex = '''AIza[0-9A-Za-z\-_]{35}'''
|
||||
tags = ["key", "Google"]
|
||||
|
||||
[[rules]]
|
||||
description = "Google (GCP) Service Account"
|
||||
regex = '''"type": "service_account"'''
|
||||
tags = ["key", "Google"]
|
||||
|
||||
[[rules]]
|
||||
description = "Heroku API key"
|
||||
regex = '''(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
|
||||
tags = ["key", "Heroku"]
|
||||
|
||||
[[rules]]
|
||||
description = "MailChimp API key"
|
||||
regex = '''(?i)(mailchimp|mc)(.{0,20})?[0-9a-f]{32}-us[0-9]{1,2}'''
|
||||
tags = ["key", "Mailchimp"]
|
||||
|
||||
[[rules]]
|
||||
description = "Mailgun API key"
|
||||
regex = '''((?i)(mailgun|mg)(.{0,20})?)?key-[0-9a-z]{32}'''
|
||||
tags = ["key", "Mailgun"]
|
||||
|
||||
[[rules]]
|
||||
description = "PayPal Braintree access token"
|
||||
regex = '''access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}'''
|
||||
tags = ["key", "Paypal"]
|
||||
|
||||
[[rules]]
|
||||
description = "Picatic API key"
|
||||
regex = '''sk_live_[0-9a-z]{32}'''
|
||||
tags = ["key", "Picatic"]
|
||||
|
||||
[[rules]]
|
||||
description = "SendGrid API Key"
|
||||
regex = '''SG\.[\w_]{16,32}\.[\w_]{16,64}'''
|
||||
tags = ["key", "SendGrid"]
|
||||
|
||||
[[rules]]
|
||||
description = "Slack Webhook"
|
||||
regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{24}'''
|
||||
tags = ["key", "slack"]
|
||||
|
||||
[[rules]]
|
||||
description = "Stripe API key"
|
||||
regex = '''(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}'''
|
||||
tags = ["key", "Stripe"]
|
||||
|
||||
[[rules]]
|
||||
description = "Square access token"
|
||||
regex = '''sq0atp-[0-9A-Za-z\-_]{22}'''
|
||||
tags = ["key", "square"]
|
||||
|
||||
[[rules]]
|
||||
description = "Square OAuth secret"
|
||||
regex = '''sq0csp-[0-9A-Za-z\-_]{43}'''
|
||||
tags = ["key", "square"]
|
||||
|
||||
[[rules]]
|
||||
description = "Twilio API key"
|
||||
regex = '''(?i)twilio(.{0,20})?SK[0-9a-f]{32}'''
|
||||
tags = ["key", "twilio"]
|
||||
|
||||
[[rules]]
|
||||
description = "Dynatrace ttoken"
|
||||
regex = '''dt0[a-zA-Z]{1}[0-9]{2}\.[A-Z0-9]{24}\.[A-Z0-9]{64}'''
|
||||
tags = ["key", "Dynatrace"]
|
||||
|
||||
[[rules]]
|
||||
description = "Shopify shared secret"
|
||||
regex = '''shpss_[a-fA-F0-9]{32}'''
|
||||
tags = ["key", "Shopify"]
|
||||
|
||||
[[rules]]
|
||||
description = "Shopify access token"
|
||||
regex = '''shpat_[a-fA-F0-9]{32}'''
|
||||
tags = ["key", "Shopify"]
|
||||
|
||||
[[rules]]
|
||||
description = "Shopify custom app access token"
|
||||
regex = '''shpca_[a-fA-F0-9]{32}'''
|
||||
tags = ["key", "Shopify"]
|
||||
|
||||
[[rules]]
|
||||
description = "Shopify private app access token"
|
||||
regex = '''shppa_[a-fA-F0-9]{32}'''
|
||||
tags = ["key", "Shopify"]
|
||||
|
||||
[[rules]]
|
||||
description = "PyPI upload token"
|
||||
regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}'''
|
||||
tags = ["key", "pypi"]
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
// seems safer
|
||||
aws_token := os.Getenv("AWS_TOKEN")
|
||||
package foo
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Foo() {
|
||||
fmt.Println("foo")
|
||||
|
||||
// seems safe
|
||||
aws_token := "AKIALALEMEL33243OLIA"
|
||||
fmt.Println(aws_token)
|
||||
}
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
// seems safer
|
||||
aws_token := os.Getenv("AWS_TOKEN")
|
||||
package foo
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Foo() {
|
||||
fmt.Println("foo")
|
||||
|
||||
// seems safe
|
||||
aws_token := "AKIALALEMEL33243OLIA"
|
||||
fmt.Println(aws_token)
|
||||
}
|
||||
package api
|
||||
|
||||
import "fmt"
|
||||
|
||||
func PrintHello() {
|
||||
fmt.Println("hello")
|
||||
}
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
var a = "initial"
|
||||
fmt.Println(a)
|
||||
var b, c int = 1, 2
|
||||
fmt.Println(b, c)
|
||||
var d = true
|
||||
fmt.Println(d)
|
||||
var e int
|
||||
fmt.Println(e)
|
||||
// load secret via env
|
||||
awsToken := os.Getenv("AWS_TOKEN")
|
||||
|
||||
f := "apple"
|
||||
fmt.Println(f)
|
||||
|
||||
// opps I added a secret at line 20
|
||||
awsToken := "AKIALALEMEL33243OLIA"
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
var a = "initial"
|
||||
fmt.Println(a)
|
||||
|
||||
var b, c int = 1, 2
|
||||
fmt.Println(b, c)
|
||||
|
||||
var d = true
|
||||
fmt.Println(d)
|
||||
|
||||
var e int
|
||||
fmt.Println(e)
|
||||
|
||||
f := "apple"
|
||||
fmt.Println(f)
|
||||
}
|
||||
# test
|
||||
This is a repo used for testing gitleaks
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
RuleID,Commit,File,Secret,Match,StartLine,EndLine,StartColumn,EndColumn,Author,Message,Date,Email
|
||||
test-rule,0000000000000000,auth.py,a secret,line containing secret,1,2,1,2,John Doe,opps,10-19-2003,johndoe@gmail.com
|
||||
|
+20
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"Description": "",
|
||||
"StartLine": 1,
|
||||
"EndLine": 2,
|
||||
"StartColumn": 1,
|
||||
"EndColumn": 2,
|
||||
"Match": "line containing secret",
|
||||
"Secret": "a secret",
|
||||
"File": "auth.py",
|
||||
"Commit": "0000000000000000",
|
||||
"Entropy": 0,
|
||||
"Author": "John Doe",
|
||||
"Email": "johndoe@gmail.com",
|
||||
"Date": "10-19-2003",
|
||||
"Message": "opps",
|
||||
"Tags": [],
|
||||
"RuleID": "test-rule"
|
||||
}
|
||||
]
|
||||
+287
@@ -0,0 +1,287 @@
|
||||
{
|
||||
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "gitleaks",
|
||||
"semanticVersion": "v8.0.0",
|
||||
"rules": [
|
||||
{
|
||||
"id": "aws-access-key",
|
||||
"name": "AWS Access Key",
|
||||
"shortDescription": {
|
||||
"text": "(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "AWS Secret Key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)aws_(.{0,20})?=?.[\\'\\\"0-9a-zA-Z\\/+]{40}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "AWS MWS key",
|
||||
"shortDescription": {
|
||||
"text": "amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Facebook Secret Key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)(facebook|fb)(.{0,20})?(?-i)['\\\"][0-9a-f]{32}['\\\"]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Facebook Client ID",
|
||||
"shortDescription": {
|
||||
"text": "(?i)(facebook|fb)(.{0,20})?['\\\"][0-9]{13,17}['\\\"]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Twitter Secret Key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)twitter(.{0,20})?['\\\"][0-9a-z]{35,44}['\\\"]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Twitter Client ID",
|
||||
"shortDescription": {
|
||||
"text": "(?i)twitter(.{0,20})?['\\\"][0-9a-z]{18,25}['\\\"]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Github Personal Access Token",
|
||||
"shortDescription": {
|
||||
"text": "ghp_[0-9a-zA-Z]{36}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Github OAuth Access Token",
|
||||
"shortDescription": {
|
||||
"text": "gho_[0-9a-zA-Z]{36}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Github App Token",
|
||||
"shortDescription": {
|
||||
"text": "(ghu|ghs)_[0-9a-zA-Z]{36}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Github Refresh Token",
|
||||
"shortDescription": {
|
||||
"text": "ghr_[0-9a-zA-Z]{76}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "LinkedIn Client ID",
|
||||
"shortDescription": {
|
||||
"text": "(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "LinkedIn Secret Key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)linkedin(.{0,20})?[0-9a-z]{16}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Slack",
|
||||
"shortDescription": {
|
||||
"text": "xox[baprs]-([0-9a-zA-Z]{10,48})?"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Asymmetric Private Key",
|
||||
"shortDescription": {
|
||||
"text": "-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Google API key",
|
||||
"shortDescription": {
|
||||
"text": "AIza[0-9A-Za-z\\-_]{35}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Google (GCP) Service Account",
|
||||
"shortDescription": {
|
||||
"text": "\"type\": \"service_account\""
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Heroku API key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "MailChimp API key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)(mailchimp|mc)(.{0,20})?[0-9a-f]{32}-us[0-9]{1,2}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Mailgun API key",
|
||||
"shortDescription": {
|
||||
"text": "((?i)(mailgun|mg)(.{0,20})?)?key-[0-9a-z]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "PayPal Braintree access token",
|
||||
"shortDescription": {
|
||||
"text": "access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Picatic API key",
|
||||
"shortDescription": {
|
||||
"text": "sk_live_[0-9a-z]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "SendGrid API Key",
|
||||
"shortDescription": {
|
||||
"text": "SG\\.[\\w_]{16,32}\\.[\\w_]{16,64}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Slack Webhook",
|
||||
"shortDescription": {
|
||||
"text": "https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{24}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Stripe API key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Square access token",
|
||||
"shortDescription": {
|
||||
"text": "sq0atp-[0-9A-Za-z\\-_]{22}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Square OAuth secret",
|
||||
"shortDescription": {
|
||||
"text": "sq0csp-[0-9A-Za-z\\-_]{43}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Twilio API key",
|
||||
"shortDescription": {
|
||||
"text": "(?i)twilio(.{0,20})?SK[0-9a-f]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Dynatrace ttoken",
|
||||
"shortDescription": {
|
||||
"text": "dt0[a-zA-Z]{1}[0-9]{2}\\.[A-Z0-9]{24}\\.[A-Z0-9]{64}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Shopify shared secret",
|
||||
"shortDescription": {
|
||||
"text": "shpss_[a-fA-F0-9]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Shopify access token",
|
||||
"shortDescription": {
|
||||
"text": "shpat_[a-fA-F0-9]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Shopify custom app access token",
|
||||
"shortDescription": {
|
||||
"text": "shpca_[a-fA-F0-9]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "Shopify private app access token",
|
||||
"shortDescription": {
|
||||
"text": "shppa_[a-fA-F0-9]{32}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"name": "PyPI upload token",
|
||||
"shortDescription": {
|
||||
"text": "pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"message": {
|
||||
"text": "test-rule has detected secret for file auth.py at commit 0000000000000000."
|
||||
},
|
||||
"ruleId": "test-rule",
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "auth.py"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 1,
|
||||
"endLine": 2,
|
||||
"endColumn": 2,
|
||||
"snippet": {
|
||||
"text": "a secret"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"partialFingerprints": {
|
||||
"commitSha": "0000000000000000",
|
||||
"email": "johndoe@gmail.com",
|
||||
"author": "John Doe",
|
||||
"date": "10-19-2003",
|
||||
"commitMessage": "opps"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
var a = "initial"
|
||||
fmt.Println(a)
|
||||
|
||||
var b, c int = 1, 2
|
||||
fmt.Println(b, c)
|
||||
|
||||
var d = true
|
||||
fmt.Println(d)
|
||||
|
||||
var e int
|
||||
fmt.Println(e)
|
||||
|
||||
// opps I added a secret at line 20
|
||||
awsToken := "AKIALALEMEL33243OLIA"
|
||||
|
||||
f := "apple"
|
||||
fmt.Println(f)
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
# test
|
||||
This is a repo used for testing gitleaks
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package api
|
||||
|
||||
import "fmt"
|
||||
|
||||
func PrintHello() {
|
||||
fmt.Println("hello")
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
removing secret from foo package
|
||||
+1
@@ -0,0 +1 @@
|
||||
2e1db472eeba53f06c4026ae4566ea022e36598e branch 'main' of github.com:gitleaks/test
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
ref: refs/heads/main
|
||||
+1
@@ -0,0 +1 @@
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[remote "origin"]
|
||||
url = git@github.com:gitleaks/test.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
+1
@@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
||||
Vendored
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500 clone: from github.com:gitleaks/test.git
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896362 -0500 checkout: moving from main to remove-secrets
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice <zricer@protonmail.com> 1635896426 -0500 commit: load token via env var
|
||||
906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896518 -0500 commit: add api package
|
||||
a122b33c6bad3ee54724f52f2caad385ab1982ab a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896543 -0500 checkout: moving from remove-secrets to api-pkg
|
||||
a122b33c6bad3ee54724f52f2caad385ab1982ab 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896644 -0500 checkout: moving from api-pkg to main
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896648 -0500 pull origin main: Fast-forward
|
||||
2e1db472eeba53f06c4026ae4566ea022e36598e 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896716 -0500 checkout: moving from main to foo
|
||||
2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice <zricer@protonmail.com> 1635896886 -0500 commit: adding foo package with secret
|
||||
491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896931 -0500 commit: removing secret from foo package
|
||||
f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635897009 -0500 checkout: moving from foo to main
|
||||
2e1db472eeba53f06c4026ae4566ea022e36598e f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635897062 -0500 checkout: moving from main to foo
|
||||
f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635897508 -0500 checkout: moving from foo to main
|
||||
@@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896543 -0500 branch: Created from HEAD
|
||||
@@ -0,0 +1,3 @@
|
||||
0000000000000000000000000000000000000000 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896716 -0500 branch: Created from HEAD
|
||||
2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice <zricer@protonmail.com> 1635896886 -0500 commit: adding foo package with secret
|
||||
491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896931 -0500 commit: removing secret from foo package
|
||||
@@ -0,0 +1,2 @@
|
||||
0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500 clone: from github.com:gitleaks/test.git
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896648 -0500 pull origin main: Fast-forward
|
||||
@@ -0,0 +1,3 @@
|
||||
0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896362 -0500 branch: Created from HEAD
|
||||
1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice <zricer@protonmail.com> 1635896426 -0500 commit: load token via env var
|
||||
906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896518 -0500 commit: add api package
|
||||
@@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500 clone: from github.com:gitleaks/test.git
|
||||
@@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896552 -0500 update by push
|
||||
@@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896935 -0500 update by push
|
||||
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user