mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: [zricethezav]
|
github: [zricethezav]
|
||||||
|
custom: ["https://www.paypal.me/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,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?
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
*.DS_STORE
|
*.DS_STORE
|
||||||
*.idea
|
*.idea
|
||||||
gitleaks
|
gitleaks
|
||||||
|
build
|
||||||
|
|
||||||
# Test binary
|
# Test binary
|
||||||
*.out
|
*.out
|
||||||
@@ -5,3 +5,4 @@ services:
|
|||||||
- docker
|
- docker
|
||||||
script:
|
script:
|
||||||
- make test
|
- make test
|
||||||
|
- make security-scan
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
FROM golang:1.13.4 AS build
|
FROM golang:1.14.1 AS build
|
||||||
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||||
|
ARG ldflags
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN GO111MODULE=on CGO_ENABLED=0 go build -o bin/gitleaks *.go
|
RUN GO111MODULE=on CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="${ldflags} *.go
|
||||||
|
|
||||||
FROM alpine:3.10
|
FROM alpine:3.11
|
||||||
RUN apk add --no-cache bash git openssh
|
RUN apk add --no-cache bash git openssh
|
||||||
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
||||||
ENTRYPOINT ["gitleaks"]
|
ENTRYPOINT ["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.
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
||||||
PKG=github.com/zricethezav/gitleaks
|
PKG=github.com/zricethezav/gitleaks
|
||||||
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/version.Version=$(VERSION)"
|
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v4/version.Version=$(VERSION)"
|
||||||
|
_LDFLAGS="github.com/zricethezav/gitleaks/v4/version.Version=$(VERSION)"
|
||||||
COVER=--cover --coverprofile=cover.out
|
COVER=--cover --coverprofile=cover.out
|
||||||
|
|
||||||
test-cover:
|
test-cover:
|
||||||
@@ -12,6 +13,7 @@ test-cover:
|
|||||||
test:
|
test:
|
||||||
go get golang.org/x/lint/golint
|
go get golang.org/x/lint/golint
|
||||||
go fmt ./...
|
go fmt ./...
|
||||||
|
go vet ./...
|
||||||
golint ./...
|
golint ./...
|
||||||
go test ./... --race $(PKG) -v
|
go test ./... --race $(PKG) -v
|
||||||
|
|
||||||
@@ -21,9 +23,14 @@ test-integration:
|
|||||||
build:
|
build:
|
||||||
go fmt ./...
|
go fmt ./...
|
||||||
golint ./...
|
golint ./...
|
||||||
|
go vet ./...
|
||||||
go mod tidy
|
go mod tidy
|
||||||
go build $(LDFLAGS)
|
go build $(LDFLAGS)
|
||||||
|
|
||||||
|
security-scan:
|
||||||
|
go get github.com/securego/gosec/cmd/gosec
|
||||||
|
gosec -no-fail ./...
|
||||||
|
|
||||||
release-builds:
|
release-builds:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
mkdir build
|
mkdir build
|
||||||
@@ -37,6 +44,9 @@ release-builds:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
|
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
|
||||||
docker build -f Dockerfile -t $(REPO):$(TAG) .
|
docker build --build-arg ldflags=$(_LDFLAGS) -f Dockerfile -t zricethezav/gitleaks:latest -t zricethezav/gitleaks:$(VERSION) .
|
||||||
echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
|
echo "Pushing zricethezav/gitleaks:$(VERSION) and zricethezav/gitleaks:latest"
|
||||||
docker push $(REPO)
|
docker push zricethezav/gitleaks
|
||||||
|
|
||||||
|
dockerbuild:
|
||||||
|
docker build --build-arg ldflags=$(_LDFLAGS) -f Dockerfile -t zricethezav/gitleaks:latest -t zricethezav/gitleaks:$(VERSION) .
|
||||||
@@ -1,123 +1,39 @@
|
|||||||
Gitleaks
|
<p align="center">
|
||||||
--------
|
<img alt="gitleaks" src="https://raw.githubusercontent.com/zricethezav/gifs/master/gitleakslogo.png" height="70" />
|
||||||
|
<p align="center">
|
||||||
<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>
|
<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>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Audit git repos for secrets. Gitleaks provides a way for you to find unencrypted secrets and other unwanted data types in git repositories. As part of it's core functionality, it provides:
|
Gitleaks is a SAST tool for detecting hardcoded secrets like passwords, api keys, and tokens in git repos. Gitleaks aims to be the **easy-to-use, all-in-one solution** for finding secrets, past or present, in your code.
|
||||||
|
|
||||||
* Audits for uncommitted changes
|
### Features:
|
||||||
* Github and Gitlab support including support for bulk organization and repository owner (user) repository scans, as well as pull/merge request scanning for use in common CI workflows.
|
- Scans for [commited](https://github.com/zricethezav/gitleaks/wiki/Scanning) secrets
|
||||||
* Support for private repository scans, and repositories that require key based authentication
|
- Scans for [uncommitted](https://github.com/zricethezav/gitleaks/wiki/Scanning#uncommitted-changes-scan) secrets as part of shifting security left
|
||||||
* Output in JSON formats for consumption in other reporting tools and frameworks
|
- Available [Github Action](https://github.com/marketplace/actions/gitleaks)
|
||||||
* Externalised configuration for environment specific customisation including regex rules
|
- Gitlab and Github API support which allows scans of whole organizations, users, and pull/merge requests
|
||||||
* High performance through the use of src-d's [go-git](https://github.com/src-d/go-git) framework
|
- [Custom rules](https://github.com/zricethezav/gitleaks/wiki/Configuration) via toml configuration
|
||||||
|
- High performance using [go-git](https://github.com/go-git/go-git)
|
||||||
|
- JSON and CSV reporting
|
||||||
|
- Private repo scans using key or password based authentication
|
||||||
|
|
||||||
|
|
||||||
|
## Installation, Documentation and Examples
|
||||||
| `repo scan` |
|
This project is documented [here](https://github.com/zricethezav/gitleaks/wiki)
|
||||||
|---|
|
|
||||||
| <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/repo-scan.gif"></p> | <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/repo-scan.gif"></p> |
|
|
||||||
|
|
||||||
| `pre commit scan` |
|
|
||||||
|---|
|
|
||||||
| <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/pre-commit-1.gif"></p> |
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
#### MacOS
|
|
||||||
|
|
||||||
```
|
|
||||||
brew install gitleaks
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Docker
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker pull zricethezav/gitleaks
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Go
|
|
||||||
|
|
||||||
```bash
|
|
||||||
go get -u github.com/zricethezav/gitleaks
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
gitleaks has a wide range of configuration options that can be adjusted at runtime or via a configuration file based on your specific requirements.
|
|
||||||
|
|
||||||
```
|
|
||||||
Usage:
|
|
||||||
gitleaks [OPTIONS]
|
|
||||||
|
|
||||||
Application Options:
|
|
||||||
-v, --verbose Show verbose output from audit
|
|
||||||
-r, --repo= Target repository
|
|
||||||
--config= config path
|
|
||||||
--disk Clones repo(s) to disk
|
|
||||||
--version version number
|
|
||||||
--timeout= Timeout (s)
|
|
||||||
--username= Username for git repo
|
|
||||||
--password= Password for git repo
|
|
||||||
--access-token= Access token for git repo
|
|
||||||
--commit= sha of commit to audit
|
|
||||||
--threads= Maximum number of threads gitleaks spawns
|
|
||||||
--ssh-key= path to ssh key used for auth
|
|
||||||
--uncommitted run gitleaks on uncommitted code
|
|
||||||
--repo-path= Path to repo
|
|
||||||
--owner-path= Path to owner directory (repos discovered)
|
|
||||||
--branch= Branch to audit
|
|
||||||
--report= path to write json leaks file
|
|
||||||
--redact redact secrets from log messages and leaks
|
|
||||||
--debug log debug messages
|
|
||||||
--repo-config Load config from target repo. Config file must be ".gitleaks.toml" or "gitleaks.toml"
|
|
||||||
--pretty Pretty print json if leaks are present
|
|
||||||
--host= git hosting service like gitlab or github. Supported hosts include: Github, Gitlab
|
|
||||||
--org= organization to audit
|
|
||||||
--user= user to audit
|
|
||||||
--pr= pull/merge request url
|
|
||||||
|
|
||||||
Help Options:
|
|
||||||
-h, --help Show this help message
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker usage examples
|
|
||||||
|
|
||||||
Run gitleaks against:
|
|
||||||
|
|
||||||
###### Public repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run --rm --name=gitleaks zricethezav/gitleaks -v -r https://github.com/zricethezav/gitleaks.git
|
|
||||||
```
|
|
||||||
|
|
||||||
###### Local repository already cloned into /tmp/
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run --rm --name=gitleaks -v /tmp/:/code/ zricethezav/gitleaks -v --repo-path=/code/gitleaks
|
|
||||||
```
|
|
||||||
|
|
||||||
By default repos cloned to memory. Using `--disk` for clone to disk or you can quickly out of memory.
|
|
||||||
|
|
||||||
For speed up analyze operation using `--threads` parameter, which set to `ALL - 1` threads at your instance CPU.
|
|
||||||
|
|
||||||
|
|
||||||
## Exit Codes
|
### Sponsors ❤️
|
||||||
|
#### Corporate Sponsors
|
||||||
|
[](https://gammanet.com/?utm_source=gitleaks&utm_medium=homepage&utm_campaign=gitleaks_promotion)
|
||||||
|
|
||||||
Gitleaks provides consistent exist codes to assist in automation workflows such as CICD platforms and bulk scanning.
|
Gamma proactively detects and remediates data leaks across cloud apps. Scan your public repos for secret leaks with [Gamma](https://gammanet.com/github-demo?utm_source=gitleaks&utm_medium=homepage&utm_campaign=gitleaks_promotion)
|
||||||
|
|
||||||
|
#### Individual Sponsors
|
||||||
|
These users are [sponsors](https://github.com/sponsors/zricethezav) of gitleaks:
|
||||||
|
|
||||||
```
|
[](https://github.com/adamdecaf) | [](https://github.com/gramidt) |
|
||||||
0: no leaks
|
---|---|
|
||||||
1: leaks present
|
----
|
||||||
2: error encountered
|
#### Logo Attribution
|
||||||
```
|
The Gitleaks logo uses the Git Logo created <a href="https://twitter.com/jasonlong">Jason Long</a> is licensed under the <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.
|
||||||
|
|
||||||
### Give Thanks
|
|
||||||
|
|
||||||
If using gitleaks has made you job easier consider donating to one of [Sam](https://www.flickr.com/photos/146541520@N08/albums/72157710121716312)'s favorite places, the Japan House on the University of Illinois at Urbana-Champaign's campus: https://japanhouse.illinois.edu/make-a-gift
|
|
||||||
|
|
||||||
+11
-2
@@ -5,7 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@@ -33,6 +33,15 @@ func Run(m *manager.Manager) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runHelper(r *Repo) error {
|
func runHelper(r *Repo) error {
|
||||||
|
// Ignore whitelisted repos
|
||||||
|
for _, wlRepo := range r.Manager.Config.Whitelist.Repos {
|
||||||
|
if RegexMatched(r.Manager.Opts.RepoPath, wlRepo) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if RegexMatched(r.Manager.Opts.Repo, wlRepo) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
if r.Manager.Opts.OpenLocal() {
|
if r.Manager.Opts.OpenLocal() {
|
||||||
r.Name = path.Base(r.Manager.Opts.RepoPath)
|
r.Name = path.Base(r.Manager.Opts.RepoPath)
|
||||||
if err := r.Open(); err != nil {
|
if err := r.Open(); err != nil {
|
||||||
@@ -40,7 +49,7 @@ func runHelper(r *Repo) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we are checking uncommitted files. This is the default behavior
|
// Check if we are checking uncommitted files. This is the default behavior
|
||||||
// for a "$gitleaks" command with no options set
|
// for a "$ gitleaks" command with no options set
|
||||||
if r.Manager.Opts.CheckUncommitted() {
|
if r.Manager.Opts.CheckUncommitted() {
|
||||||
if err := r.AuditUncommitted(); err != nil {
|
if err := r.AuditUncommitted(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+251
-27
@@ -1,16 +1,20 @@
|
|||||||
package audit
|
package audit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/sergi/go-diff/diffmatchpatch"
|
|
||||||
"github.com/zricethezav/gitleaks/config"
|
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
|
||||||
"github.com/zricethezav/gitleaks/options"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
|
"github.com/sergi/go-diff/diffmatchpatch"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testRepoBase = "../test_data/test_repos/"
|
const testRepoBase = "../test_data/test_repos/"
|
||||||
@@ -71,6 +75,37 @@ func TestAudit(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_two_leaks.json",
|
wantPath: "../test_data/test_local_repo_two_leaks.json",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo two leaks from commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
|
Report: "../test_data/test_local_repo_two_leaks_commit_from.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitFrom: "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_two_leaks_commit_from.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo two leaks to commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
|
Report: "../test_data/test_local_repo_two_leaks_commit_to.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitTo: "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_two_leaks_commit_to.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo two leaks range commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
|
Report: "../test_data/test_local_repo_two_leaks_commit_range.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitFrom: "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a",
|
||||||
|
CommitTo: "51f6dcf6b89b93f4075ba92c400b075631a6cc93",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_two_leaks_commit_range.json",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "test local repo two leaks globally whitelisted",
|
description: "test local repo two leaks globally whitelisted",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
@@ -139,14 +174,14 @@ func TestAudit(t *testing.T) {
|
|||||||
wantPath: "../test_data/test_local_owner_aws_leak.json",
|
wantPath: "../test_data/test_local_owner_aws_leak.json",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "test entropy",
|
description: "test owner path whitelist repo",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
OwnerPath: "../test_data/test_repos/",
|
||||||
Report: "../test_data/test_entropy.json.got",
|
Report: "../test_data/test_local_owner_aws_leak_whitelist_repo.json.got",
|
||||||
Config: "../test_data/test_configs/entropy.toml",
|
|
||||||
ReportFormat: "json",
|
ReportFormat: "json",
|
||||||
|
Config: "../test_data/test_configs/aws_key_local_owner_whitelist_repo.toml",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_entropy.json",
|
wantPath: "../test_data/test_local_owner_aws_leak_whitelist_repo.json",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "test entropy and regex",
|
description: "test entropy and regex",
|
||||||
@@ -178,6 +213,159 @@ func TestAudit(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo one aws leak timeout",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
|
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
Timeout: "10ns",
|
||||||
|
},
|
||||||
|
wantEmpty: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo one aws leak long timeout",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
|
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
Timeout: "2m",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test owner path depth=2",
|
||||||
|
opts: options.Options{
|
||||||
|
OwnerPath: "../test_data/test_repos/",
|
||||||
|
Report: "../test_data/test_local_owner_aws_leak_depth_2.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
Depth: 2,
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_owner_aws_leak_depth_2.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo five files at commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_5",
|
||||||
|
Report: "../test_data/test_local_repo_five_files_at_commit.json.got",
|
||||||
|
FilesAtCommit: "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_five_files_at_commit.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo five files at latest commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_5",
|
||||||
|
Report: "../test_data/test_local_repo_five_files_at_latest_commit.json.got",
|
||||||
|
FilesAtCommit: "latest",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_five_files_at_commit.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo five at commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_5",
|
||||||
|
Report: "../test_data/test_local_repo_five_commit.json.got",
|
||||||
|
Commit: "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
ReportFormat: "json",
|
||||||
|
Config: "../test_data/test_configs/generic.toml",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_five_commit.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo five at latest commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_5",
|
||||||
|
Report: "../test_data/test_local_repo_five_at_latest_commit.json.got",
|
||||||
|
Commit: "latest",
|
||||||
|
ReportFormat: "json",
|
||||||
|
Config: "../test_data/test_configs/generic.toml",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_five_at_latest_commit.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo six filename",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_filename.json.got",
|
||||||
|
Config: "../test_data/test_configs/regex_filename.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_filename.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo six filepath",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_filepath.json.got",
|
||||||
|
Config: "../test_data/test_configs/regex_filepath.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_filepath.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo six filename and filepath",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_filepath_filename.json.got",
|
||||||
|
Config: "../test_data/test_configs/regex_filepath_filename.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_filepath_filename.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo six path globally whitelisted",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_path_globally_whitelisted.json.got",
|
||||||
|
Config: "../test_data/test_configs/aws_key_global_whitelist_path.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_path_globally_whitelisted.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo six leaks since date",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_leaks_since_date.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitSince: "2019-10-25",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_leaks_since_date.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo two leaks until date",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_6",
|
||||||
|
Report: "../test_data/test_local_repo_six_leaks_until_date.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitUntil: "2019-10-25",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_six_leaks_until_date.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo four leaks timerange commit",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_4",
|
||||||
|
Report: "../test_data/test_local_repo_four_leaks_commit_timerange.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
|
CommitSince: "2019-10-25T13:01:27-0400",
|
||||||
|
CommitUntil: "2019-10-25T13:12:32-0400",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_four_leaks_commit_timerange.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test local repo two whitelist commit config",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
|
Report: "../test_data/test_local_repo_two_whitelist_commits.json.got",
|
||||||
|
Config: "../test_data/test_configs/whitelist_commit.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_two_whitelist_commits.json",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@@ -258,22 +446,39 @@ func TestAuditUncommited(t *testing.T) {
|
|||||||
fileToChange: "server.test.py",
|
fileToChange: "server.test.py",
|
||||||
addition: "nothing bad",
|
addition: "nothing bad",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "test audit repo with no commits",
|
||||||
|
opts: options.Options{
|
||||||
|
RepoPath: "../test_data/test_repos/test_repo_7",
|
||||||
|
Report: "../test_data/test_local_repo_seven_aws_leak_uncommitted.json.got",
|
||||||
|
Uncommited: true,
|
||||||
|
ReportFormat: "json",
|
||||||
|
},
|
||||||
|
wantPath: "../test_data/test_local_repo_seven_aws_leak_uncommitted.json",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
var (
|
||||||
|
old []byte
|
||||||
|
err error
|
||||||
|
)
|
||||||
fmt.Println(test.description)
|
fmt.Println(test.description)
|
||||||
old, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange))
|
if test.fileToChange != "" {
|
||||||
if err != nil {
|
old, err = ioutil.ReadFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange))
|
||||||
t.Error(err)
|
if err != nil {
|
||||||
}
|
t.Error(err)
|
||||||
altered, err := os.OpenFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange),
|
}
|
||||||
os.O_WRONLY|os.O_APPEND, 0644)
|
altered, err := os.OpenFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange),
|
||||||
if err != nil {
|
os.O_WRONLY|os.O_APPEND, 0644)
|
||||||
t.Error(err)
|
if err != nil {
|
||||||
}
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = altered.WriteString(test.addition)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
_, err = altered.WriteString(test.addition)
|
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg, err := config.NewConfig(test.opts)
|
cfg, err := config.NewConfig(test.opts)
|
||||||
@@ -293,9 +498,11 @@ func TestAuditUncommited(t *testing.T) {
|
|||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange), old, 0)
|
if test.fileToChange != "" {
|
||||||
if err != nil {
|
err = ioutil.WriteFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange), old, 0)
|
||||||
t.Error(err)
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if test.wantEmpty {
|
if test.wantEmpty {
|
||||||
@@ -312,6 +519,10 @@ func TestAuditUncommited(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fileCheck(wantPath, gotPath string) error {
|
func fileCheck(wantPath, gotPath string) error {
|
||||||
|
var (
|
||||||
|
gotLeaks []manager.Leak
|
||||||
|
wantLeaks []manager.Leak
|
||||||
|
)
|
||||||
want, err := ioutil.ReadFile(wantPath)
|
want, err := ioutil.ReadFile(wantPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -322,10 +533,23 @@ func fileCheck(wantPath, gotPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Trim(string(want), "\n") != strings.Trim(string(got), "\n") {
|
err = json.Unmarshal(got, &gotLeaks)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(want, &wantLeaks)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(gotLeaks, func(i, j int) bool { return (gotLeaks)[i].Commit < (gotLeaks)[j].Commit })
|
||||||
|
sort.Slice(wantLeaks, func(i, j int) bool { return (wantLeaks)[i].Commit < (wantLeaks)[j].Commit })
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(gotLeaks, wantLeaks) {
|
||||||
dmp := diffmatchpatch.New()
|
dmp := diffmatchpatch.New()
|
||||||
diffs := dmp.DiffMain(string(want), string(got), false)
|
diffs := dmp.DiffMain(string(want), string(got), false)
|
||||||
return fmt.Errorf("does not equal: %s", dmp.DiffPrettyText(diffs))
|
return fmt.Errorf("%s does not equal %s: %s", wantPath, gotPath, dmp.DiffPrettyText(diffs))
|
||||||
}
|
}
|
||||||
if err := os.Remove(gotPath); err != nil {
|
if err := os.Remove(gotPath); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+139
-57
@@ -2,8 +2,10 @@ package audit
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/go-git/go-git/v5"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@@ -11,18 +13,17 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/go-git/go-billy/v5"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/storer"
|
||||||
|
"github.com/go-git/go-git/v5/storage/memory"
|
||||||
"github.com/sergi/go-diff/diffmatchpatch"
|
"github.com/sergi/go-diff/diffmatchpatch"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/src-d/go-billy.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
"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"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Repo wraps a *git.Repository object in addition to a manager object and the name of the repo.
|
// Repo wraps a *git.Repository object in addition to a manager object and the name of the repo.
|
||||||
@@ -39,6 +40,10 @@ type Repo struct {
|
|||||||
// for those repo audits.
|
// for those repo audits.
|
||||||
config config.Config
|
config config.Config
|
||||||
|
|
||||||
|
// ctx is used to signal timeouts to running goroutines
|
||||||
|
ctx context.Context
|
||||||
|
cancel context.CancelFunc
|
||||||
|
|
||||||
Name string
|
Name string
|
||||||
Manager *manager.Manager
|
Manager *manager.Manager
|
||||||
}
|
}
|
||||||
@@ -48,6 +53,7 @@ func NewRepo(m *manager.Manager) *Repo {
|
|||||||
return &Repo{
|
return &Repo{
|
||||||
Manager: m,
|
Manager: m,
|
||||||
config: m.Config,
|
config: m.Config,
|
||||||
|
ctx: context.Background(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +87,42 @@ func (repo *Repo) Clone(cloneOption *git.CloneOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func emptyCommit() *object.Commit {
|
||||||
|
return &object.Commit{
|
||||||
|
Hash: plumbing.Hash{},
|
||||||
|
Message: "***STAGED CHANGES***",
|
||||||
|
Author: object.Signature{
|
||||||
|
Name: "",
|
||||||
|
Email: "",
|
||||||
|
When: time.Unix(0, 0).UTC(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// auditEmpty audits an empty repo without any commits. See https://github.com/zricethezav/gitleaks/issues/352
|
||||||
|
func (repo *Repo) auditEmpty() error {
|
||||||
|
auditTimeStart := time.Now()
|
||||||
|
wt, err := repo.Worktree()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
status, err := wt.Status()
|
||||||
|
for fn := range status {
|
||||||
|
workTreeBuf := bytes.NewBuffer(nil)
|
||||||
|
workTreeFile, err := wt.Filesystem.Open(fn)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, err := io.Copy(workTreeBuf, workTreeFile); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
InspectFile(workTreeBuf.String(), workTreeFile.Name(), emptyCommit(), repo)
|
||||||
|
}
|
||||||
|
repo.Manager.RecordTime(manager.AuditTime(howLong(auditTimeStart)))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// AuditUncommitted will do a `git diff` and scan changed files that are being tracked. This is useful functionality
|
// AuditUncommitted will do a `git diff` and scan changed files that are being tracked. This is useful functionality
|
||||||
// for a pre-commit hook so you can make sure your code does not have any leaks before committing.
|
// for a pre-commit hook so you can make sure your code does not have any leaks before committing.
|
||||||
func (repo *Repo) AuditUncommitted() error {
|
func (repo *Repo) AuditUncommitted() error {
|
||||||
@@ -93,13 +135,20 @@ func (repo *Repo) AuditUncommitted() error {
|
|||||||
repo.config = cfg
|
repo.config = cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
auditTimeStart := time.Now()
|
if err := repo.setupTimeout(); err != nil {
|
||||||
|
|
||||||
r, err := repo.Head()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r, err := repo.Head()
|
||||||
|
if err == plumbing.ErrReferenceNotFound {
|
||||||
|
// possibly an empty repo, or maybe its not, either way lets scan all the files in the directory
|
||||||
|
return repo.auditEmpty()
|
||||||
|
} else if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
auditTimeStart := time.Now()
|
||||||
|
|
||||||
c, err := repo.CommitObject(r.Hash())
|
c, err := repo.CommitObject(r.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -161,35 +210,18 @@ func (repo *Repo) AuditUncommitted() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileMatched(filename, repo.config.Whitelist.File) {
|
diffs := diffmatchpatch.New().DiffMain(prevFileContents, currFileContents, false)
|
||||||
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
|
var diffContents string
|
||||||
} else if fileMatched(filename, repo.config.FileRegex) {
|
for _, d := range diffs {
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
switch d.Type {
|
||||||
Line: "N/A",
|
case diffmatchpatch.DiffInsert:
|
||||||
Offender: filename,
|
diffContents += fmt.Sprintf("%s\n", d.Text)
|
||||||
Commit: c.Hash.String(),
|
case diffmatchpatch.DiffDelete:
|
||||||
Repo: repo.Name,
|
diffContents += fmt.Sprintf("%s\n", d.Text)
|
||||||
Rule: "file regex matched" + repo.config.FileRegex.String(),
|
|
||||||
Message: c.Message,
|
|
||||||
Author: c.Author.Name,
|
|
||||||
Email: c.Author.Email,
|
|
||||||
Date: c.Author.When,
|
|
||||||
File: filename,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
dmp := diffmatchpatch.New()
|
|
||||||
diffs := dmp.DiffMain(prevFileContents, currFileContents, false)
|
|
||||||
var diffContents string
|
|
||||||
for _, d := range diffs {
|
|
||||||
switch d.Type {
|
|
||||||
case diffmatchpatch.DiffInsert:
|
|
||||||
diffContents += fmt.Sprintf("%s\n", d.Text)
|
|
||||||
case diffmatchpatch.DiffDelete:
|
|
||||||
diffContents += fmt.Sprintf("%s\n", d.Text)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
InspectString(diffContents, c, repo, filename)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InspectFile(diffContents, filename, c, repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +236,13 @@ func (repo *Repo) AuditUncommitted() error {
|
|||||||
// git repo. Options that can change the behavior of this function include: --commit, --depth, --branch.
|
// git repo. Options that can change the behavior of this function include: --commit, --depth, --branch.
|
||||||
// See options/options.go for an explanation on these options.
|
// See options/options.go for an explanation on these options.
|
||||||
func (repo *Repo) Audit() error {
|
func (repo *Repo) Audit() error {
|
||||||
|
if err := repo.setupTimeout(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if repo.cancel != nil {
|
||||||
|
defer repo.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
if repo.Repository == nil {
|
if repo.Repository == nil {
|
||||||
return fmt.Errorf("%s repo is empty", repo.Name)
|
return fmt.Errorf("%s repo is empty", repo.Name)
|
||||||
}
|
}
|
||||||
@@ -219,19 +258,11 @@ func (repo *Repo) Audit() error {
|
|||||||
|
|
||||||
auditTimeStart := time.Now()
|
auditTimeStart := time.Now()
|
||||||
|
|
||||||
// audit single Commit
|
// audit commit patches OR all files at commit. See https://github.com/zricethezav/gitleaks/issues/326
|
||||||
if repo.Manager.Opts.Commit != "" {
|
if repo.Manager.Opts.Commit != "" {
|
||||||
h := plumbing.NewHash(repo.Manager.Opts.Commit)
|
return inspectCommit(repo.Manager.Opts.Commit, repo, inspectCommitPatches)
|
||||||
c, err := repo.CommitObject(h)
|
} else if repo.Manager.Opts.FilesAtCommit != "" {
|
||||||
if err != nil {
|
return inspectCommit(repo.Manager.Opts.FilesAtCommit, repo, inspectFilesAtCommit)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = inspectCommit(c, repo)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logOpts, err := getLogOptions(repo)
|
logOpts, err := getLogOptions(repo)
|
||||||
@@ -247,24 +278,28 @@ func (repo *Repo) Audit() error {
|
|||||||
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
|
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
if c == nil {
|
if c == nil || repo.timeoutReached() || repo.depthReached(cc) {
|
||||||
return storer.ErrStop
|
return storer.ErrStop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if commit is whitelisted
|
||||||
|
if isCommitWhiteListed(c.Hash.String(), repo.config.Whitelist.Commits) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if at root
|
||||||
if len(c.ParentHashes) == 0 {
|
if len(c.ParentHashes) == 0 {
|
||||||
cc++
|
cc++
|
||||||
err = inspectCommit(c, repo)
|
err = inspectFilesAtCommit(c, repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCommitWhiteListed(c.Hash.String(), repo.config.Whitelist.Commits) {
|
// increase commit counter
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
cc++
|
cc++
|
||||||
|
|
||||||
err = c.Parents().ForEach(func(parent *object.Commit) error {
|
err = c.Parents().ForEach(func(parent *object.Commit) error {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
@@ -274,6 +309,9 @@ func (repo *Repo) Audit() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
if repo.timeoutReached() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
patch, err := c.Patch(parent)
|
patch, err := c.Patch(parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -292,6 +330,9 @@ func (repo *Repo) Audit() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if c.Hash.String() == repo.Manager.Opts.CommitTo {
|
||||||
|
return storer.ErrStop
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -344,3 +385,44 @@ func (repo *Repo) loadRepoConfig() (config.Config, error) {
|
|||||||
_, err = toml.DecodeReader(f, &tomlLoader)
|
_, err = toml.DecodeReader(f, &tomlLoader)
|
||||||
return tomlLoader.Parse()
|
return tomlLoader.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// timeoutReached returns true if the timeout deadline has been met. This function should be used
|
||||||
|
// at the top of loops and before potentially long running goroutines (like checking inefficient regexes)
|
||||||
|
func (repo *Repo) timeoutReached() bool {
|
||||||
|
if repo.ctx.Err() == context.DeadlineExceeded {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// setupTimeout parses the --timeout option and assigns a context with timeout to the manager
|
||||||
|
// which will exit early if the timeout has been met.
|
||||||
|
func (repo *Repo) setupTimeout() error {
|
||||||
|
if repo.Manager.Opts.Timeout == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
timeout, err := time.ParseDuration(repo.Manager.Opts.Timeout)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
repo.ctx, repo.cancel = context.WithTimeout(context.Background(), timeout)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
select {
|
||||||
|
case <-repo.ctx.Done():
|
||||||
|
if repo.timeoutReached() {
|
||||||
|
log.Warnf("Timeout deadline (%s) exceeded for %s", timeout.String(), repo.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repo) depthReached(i int) bool {
|
||||||
|
if repo.Manager.Opts.Depth != 0 && repo.Manager.Opts.Depth == i {
|
||||||
|
log.Warnf("Exceeded depth limit (%d)", i)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
+288
-189
@@ -3,60 +3,45 @@ package audit
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
|
|
||||||
|
"github.com/go-git/go-git/v5"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
|
fdiff "github.com/go-git/go-git/v5/plumbing/format/diff"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
fdiff "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxLineLen = 200
|
|
||||||
|
|
||||||
// Inspect patch accepts a patch, commit, and repo. If the patches contains files that are
|
// Inspect patch accepts a patch, commit, and repo. If the patches contains files that are
|
||||||
// binary, then gitleaks will skip auditing that file OR if a file is matched on
|
// binary, then gitleaks will skip auditing that file OR if a file is matched on
|
||||||
// whitelisted files set in the configuration. If a global rule for files is defined and a filename
|
// whitelisted files set in the configuration. If a global rule for files is defined and a filename
|
||||||
// matches said global rule, then a laek is sent to the manager.
|
// matches said global rule, then a leak is sent to the manager.
|
||||||
// After that, file chunks are created which are then inspected by InspectString()
|
// After that, file chunks are created which are then inspected by InspectString()
|
||||||
func inspectPatch(patch *object.Patch, c *object.Commit, repo *Repo) {
|
func inspectPatch(patch *object.Patch, c *object.Commit, repo *Repo) {
|
||||||
for _, f := range patch.FilePatches() {
|
for _, f := range patch.FilePatches() {
|
||||||
|
if repo.timeoutReached() {
|
||||||
|
return
|
||||||
|
}
|
||||||
if f.IsBinary() {
|
if f.IsBinary() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if fileMatched(getFileName(f), repo.config.Whitelist.File) {
|
|
||||||
log.Debugf("whitelisted file found, skipping audit of file: %s", getFileName(f))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if fileMatched(getFileName(f), repo.config.FileRegex) {
|
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
|
||||||
Line: "N/A",
|
|
||||||
Offender: getFileName(f),
|
|
||||||
Commit: c.Hash.String(),
|
|
||||||
Repo: repo.Name,
|
|
||||||
Rule: "file regex matched" + repo.config.FileRegex.String(),
|
|
||||||
Author: c.Author.Name,
|
|
||||||
Email: c.Author.Email,
|
|
||||||
Date: c.Author.When,
|
|
||||||
File: getFileName(f),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
for _, chunk := range f.Chunks() {
|
for _, chunk := range f.Chunks() {
|
||||||
if chunk.Type() == fdiff.Delete || chunk.Type() == fdiff.Add {
|
if chunk.Type() == fdiff.Delete || chunk.Type() == fdiff.Add {
|
||||||
InspectString(chunk.Content(), c, repo, getFileName(f))
|
InspectFile(chunk.Content(), getFileFullPath(f), c, repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getFileName accepts a file patch and returns the filename
|
// getFileName accepts a file patch and returns the filename
|
||||||
func getFileName(f fdiff.FilePatch) string {
|
func getFileFullPath(f fdiff.FilePatch) string {
|
||||||
fn := "???"
|
fn := "???"
|
||||||
from, to := f.Files()
|
from, to := f.Files()
|
||||||
if from != nil {
|
if from != nil {
|
||||||
@@ -68,6 +53,31 @@ func getFileName(f fdiff.FilePatch) string {
|
|||||||
return fn
|
return fn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getFileName accepts a string with full path and returns only path
|
||||||
|
func getFilePath(fullpath string) string {
|
||||||
|
return filepath.Dir(fullpath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getFileName accepts a string with full path and returns only filename
|
||||||
|
func getFileName(fullpath string) string {
|
||||||
|
return filepath.Base(fullpath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
|
||||||
|
// trippedEntropy checks if a given capture group or offender falls in between entropy ranges
|
||||||
|
// supplied by a custom gitleaks configuration. Gitleaks do not check entropy by default.
|
||||||
|
func trippedEntropy(groups []string, rule config.Rule) bool {
|
||||||
|
for _, e := range rule.Entropies {
|
||||||
|
if len(groups) > e.Group {
|
||||||
|
entropy := shannonEntropy(groups[e.Group])
|
||||||
|
if entropy >= e.Min && entropy <= e.Max {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// getShannonEntropy https://en.wiktionary.org/wiki/Shannon_entropy
|
// getShannonEntropy https://en.wiktionary.org/wiki/Shannon_entropy
|
||||||
func shannonEntropy(data string) (entropy float64) {
|
func shannonEntropy(data string) (entropy float64) {
|
||||||
if data == "" {
|
if data == "" {
|
||||||
@@ -88,19 +98,7 @@ func shannonEntropy(data string) (entropy float64) {
|
|||||||
return entropy
|
return entropy
|
||||||
}
|
}
|
||||||
|
|
||||||
// aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
|
// Checks if the given rule has a regex
|
||||||
// trippedEntropy checks if a given line falls in between entropy ranges supplied
|
|
||||||
// by a custom gitleaks configuration. Gitleaks do not check entropy by default.
|
|
||||||
func trippedEntropy(line string, rule config.Rule) bool {
|
|
||||||
for _, e := range rule.Entropy {
|
|
||||||
entropy := shannonEntropy(line)
|
|
||||||
if entropy > e.P1 && entropy < e.P2 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func ruleContainRegex(rule config.Rule) bool {
|
func ruleContainRegex(rule config.Rule) bool {
|
||||||
if rule.Regex == nil {
|
if rule.Regex == nil {
|
||||||
return false
|
return false
|
||||||
@@ -111,150 +109,207 @@ func ruleContainRegex(rule config.Rule) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// InspectString accepts a string, commit object, repo, and filename. This function iterates over
|
// Checks if the given rule has a file name regex
|
||||||
// all the rules set by the gitleaks config. If the rule contains entropy checks then entropy will be checked first.
|
func ruleContainFileNameRegex(rule config.Rule) bool {
|
||||||
// Next, if the rule contains a regular expression then that will be checked.
|
if rule.FileNameRegex == nil {
|
||||||
func InspectString(content string, c *object.Commit, repo *Repo, filename string) {
|
return false
|
||||||
for _, rule := range repo.config.Rules {
|
}
|
||||||
// check entropy
|
if rule.FileNameRegex.String() == "" {
|
||||||
if len(rule.Entropy) != 0 {
|
return false
|
||||||
// an optimization would be to switch the regex from FindAllIndex to FindString
|
}
|
||||||
// since we are iterating on the lines if entropy rules exist...
|
return true
|
||||||
for _, line := range strings.Split(content, "\n") {
|
}
|
||||||
entropyTripped := trippedEntropy(line, rule)
|
|
||||||
if entropyTripped && !ruleContainRegex(rule) {
|
|
||||||
_line := line
|
|
||||||
if len(_line) > maxLineLen {
|
|
||||||
_line = line[0 : maxLineLen-1]
|
|
||||||
}
|
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
|
||||||
Line: _line,
|
|
||||||
Offender: fmt.Sprintf("Entropy range %+v", rule.Entropy),
|
|
||||||
Commit: c.Hash.String(),
|
|
||||||
Repo: repo.Name,
|
|
||||||
Message: c.Message,
|
|
||||||
Rule: rule.Description,
|
|
||||||
Author: c.Author.Name,
|
|
||||||
Email: c.Author.Email,
|
|
||||||
Date: c.Author.When,
|
|
||||||
Tags: strings.Join(rule.Tags, ", "),
|
|
||||||
File: filename,
|
|
||||||
})
|
|
||||||
} else if entropyTripped {
|
|
||||||
// entropy has been tripped which means if there is a regex specified in the same
|
|
||||||
// rule, we need to inspect the line for a regex match. In otherwords, the current rule has
|
|
||||||
// both entropy and regex set which work in combination. This helps narrow down false positives
|
|
||||||
// on searches for generic passwords in code.
|
|
||||||
match := rule.Regex.FindString(line)
|
|
||||||
|
|
||||||
// check if any rules are whitelisting this leak
|
// Checks if the given rule has a file path regex
|
||||||
if len(rule.Whitelist) != 0 {
|
func ruleContainFilePathRegex(rule config.Rule) bool {
|
||||||
for _, wl := range rule.Whitelist {
|
if rule.FilePathRegex == nil {
|
||||||
if fileMatched(filename, wl.File) {
|
return false
|
||||||
// if matched, go to next rule
|
}
|
||||||
goto NEXTLINE
|
if rule.FilePathRegex.String() == "" {
|
||||||
}
|
return false
|
||||||
if wl.Regex.FindString(line) != "" {
|
}
|
||||||
goto NEXTLINE
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if match != "" {
|
func sendLeak(offender string, line string, filename string, rule config.Rule, c *object.Commit, repo *Repo) {
|
||||||
// both the regex and entropy in this rule have been tripped which means this line
|
repo.Manager.SendLeaks(manager.Leak{
|
||||||
// contains a leak
|
Line: line,
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
Offender: offender,
|
||||||
Line: line,
|
Commit: c.Hash.String(),
|
||||||
Offender: match,
|
Repo: repo.Name,
|
||||||
Commit: c.Hash.String(),
|
Message: c.Message,
|
||||||
Message: c.Message,
|
Rule: rule.Description,
|
||||||
Repo: repo.Name,
|
Author: c.Author.Name,
|
||||||
Rule: rule.Description,
|
Email: c.Author.Email,
|
||||||
Author: c.Author.Name,
|
Date: c.Author.When,
|
||||||
Email: c.Author.Email,
|
Tags: strings.Join(rule.Tags, ", "),
|
||||||
Date: c.Author.When,
|
File: filename,
|
||||||
Tags: strings.Join(rule.Tags, ", "),
|
})
|
||||||
File: filename,
|
}
|
||||||
})
|
|
||||||
}
|
// InspectFile accepts a file content, fullpath of file, commit and repo. If the file is
|
||||||
}
|
// binary OR if a file is matched on whitelisted files set in the configuration, then gitleaks
|
||||||
NEXTLINE:
|
// will skip auditing that file. It will check first if rules apply to this file comparing filename
|
||||||
|
// and path to their respective rule regexes and inspect file content with inspectFileContents after.
|
||||||
|
func InspectFile(content string, fullpath string, c *object.Commit, repo *Repo) {
|
||||||
|
|
||||||
|
filename := getFileName(fullpath)
|
||||||
|
path := getFilePath(fullpath)
|
||||||
|
|
||||||
|
// We want to check if there is a whitelist for this file
|
||||||
|
if len(repo.config.Whitelist.Files) != 0 {
|
||||||
|
for _, reFileName := range repo.config.Whitelist.Files {
|
||||||
|
if RegexMatched(filename, reFileName) {
|
||||||
|
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if rule.Regex.String() == "" {
|
}
|
||||||
|
|
||||||
|
// We want to check if there is a whitelist for this path
|
||||||
|
if len(repo.config.Whitelist.Paths) != 0 {
|
||||||
|
for _, reFilePath := range repo.config.Whitelist.Paths {
|
||||||
|
if RegexMatched(path, reFilePath) {
|
||||||
|
log.Debugf("file in whitelisted path found, skipping audit of file: %s", filename)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, rule := range repo.config.Rules {
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
|
// For each rule we want to check filename whitelists
|
||||||
|
if isFileNameWhiteListed(filename, rule.Whitelist) || isFilePathWhiteListed(path, rule.Whitelist) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
start := time.Now()
|
|
||||||
locs := rule.Regex.FindAllIndex([]byte(content), -1)
|
|
||||||
if len(locs) != 0 {
|
|
||||||
// check if any rules are whitelisting this leak
|
|
||||||
if len(rule.Whitelist) != 0 {
|
|
||||||
for _, wl := range rule.Whitelist {
|
|
||||||
if fileMatched(filename, wl.File) {
|
|
||||||
// if matched, go to next rule
|
|
||||||
goto NEXT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, loc := range locs {
|
|
||||||
start := loc[0]
|
|
||||||
end := loc[1]
|
|
||||||
for start != 0 && content[start] != '\n' {
|
|
||||||
start = start - 1
|
|
||||||
}
|
|
||||||
if start != 0 {
|
|
||||||
// skip newline
|
|
||||||
start = start + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
for end < len(content)-1 && content[end] != '\n' {
|
// If it has fileNameRegex and it doesnt match we continue to next rule
|
||||||
end = end + 1
|
if ruleContainFileNameRegex(rule) && !RegexMatched(filename, rule.FileNameRegex) {
|
||||||
}
|
continue
|
||||||
|
|
||||||
offender := content[loc[0]:loc[1]]
|
|
||||||
line := content[start:end]
|
|
||||||
|
|
||||||
if len(rule.Whitelist) != 0 {
|
|
||||||
for _, wl := range rule.Whitelist {
|
|
||||||
if wl.Regex.FindString(line) != "" {
|
|
||||||
goto NEXT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if repo.Manager.Opts.Redact {
|
|
||||||
line = strings.ReplaceAll(line, offender, "REDACTED")
|
|
||||||
offender = "REDACTED"
|
|
||||||
}
|
|
||||||
|
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
|
||||||
Line: line,
|
|
||||||
Offender: offender,
|
|
||||||
Commit: c.Hash.String(),
|
|
||||||
Message: c.Message,
|
|
||||||
Repo: repo.Name,
|
|
||||||
Rule: rule.Description,
|
|
||||||
Author: c.Author.Name,
|
|
||||||
Email: c.Author.Email,
|
|
||||||
Date: c.Author.When,
|
|
||||||
Tags: strings.Join(rule.Tags, ", "),
|
|
||||||
File: filename,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If it has filePathRegex and it doesnt match we continue to next rule
|
||||||
|
if ruleContainFilePathRegex(rule) && !RegexMatched(path, rule.FilePathRegex) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it doesnt contain a content regex then it is a filename regex match
|
||||||
|
if !ruleContainRegex(rule) {
|
||||||
|
sendLeak("Filename/path offender: "+filename, "N/A", fullpath, rule, c, repo)
|
||||||
|
} else {
|
||||||
|
//otherwise we check if it matches content regex
|
||||||
|
inspectFileContents(content, fullpath, rule, c, repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO should return filenameRegex if only file rule
|
||||||
repo.Manager.RecordTime(manager.RegexTime{
|
repo.Manager.RecordTime(manager.RegexTime{
|
||||||
Time: time.Now().Sub(start).Nanoseconds(),
|
Time: howLong(start),
|
||||||
Regex: rule.Regex.String(),
|
Regex: rule.Regex.String(),
|
||||||
})
|
})
|
||||||
NEXT:
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// inspectCommit accepts a commit object and a repo. This function is only called when the --commit=
|
// InspectString accepts a string, commit object, repo, and filename. This function iterates over
|
||||||
|
// all the rules set by the gitleaks config. If the rule contains entropy checks then entropy will be checked first.
|
||||||
|
// Next, if the rule contains a regular expression then that will be checked.
|
||||||
|
func inspectFileContents(content string, path string, rule config.Rule, c *object.Commit, repo *Repo) {
|
||||||
|
locs := rule.Regex.FindAllIndex([]byte(content), -1)
|
||||||
|
if len(locs) != 0 {
|
||||||
|
for _, loc := range locs {
|
||||||
|
start := loc[0]
|
||||||
|
end := loc[1]
|
||||||
|
for start != 0 && content[start] != '\n' {
|
||||||
|
start = start - 1
|
||||||
|
}
|
||||||
|
if start != 0 {
|
||||||
|
// skip newline
|
||||||
|
start = start + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for end < len(content)-1 && content[end] != '\n' {
|
||||||
|
end = end + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
line := content[start:end]
|
||||||
|
offender := content[loc[0]:loc[1]]
|
||||||
|
groups := rule.Regex.FindStringSubmatch(offender)
|
||||||
|
|
||||||
|
if isOffenderWhiteListed(offender, rule.Whitelist) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(rule.Entropies) != 0 && !trippedEntropy(groups, rule) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
sendLeak(offender, line, path, rule, c, repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type commitInspector func(c *object.Commit, repo *Repo) error
|
||||||
|
|
||||||
|
// inspectCommit accepts a commit hash, repo, and commit inspecting function. A new commit
|
||||||
|
// object will be created from the hash which will be passed into either inspectCommitPatches
|
||||||
|
// or inspectFilesAtCommit depending on the options set.
|
||||||
|
func inspectCommit(commit string, repo *Repo, f commitInspector) error {
|
||||||
|
if commit == "latest" {
|
||||||
|
ref, err := repo.Repository.Head()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
commit = ref.Hash().String()
|
||||||
|
}
|
||||||
|
repo.Manager.IncrementCommits(1)
|
||||||
|
h := plumbing.NewHash(commit)
|
||||||
|
c, err := repo.CommitObject(h)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return f(c, repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// inspectCommitPatches accepts a commit object and a repo. This function is only called when the --commit=
|
||||||
// option has been set. That option tells gitleaks to look only at a single commit and check the contents
|
// option has been set. That option tells gitleaks to look only at a single commit and check the contents
|
||||||
// of said commit. Similar to inspectPatch(), if the files contained in the commit are a binaries or if they are
|
// of said commit. Similar to inspectPatch(), if the files contained in the commit are a binaries or if they are
|
||||||
// whitelisted then those files will be skipped.
|
// whitelisted then those files will be skipped.
|
||||||
func inspectCommit(c *object.Commit, repo *Repo) error {
|
func inspectCommitPatches(c *object.Commit, repo *Repo) error {
|
||||||
|
if len(c.ParentHashes) == 0 {
|
||||||
|
err := inspectFilesAtCommit(c, repo)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Parents().ForEach(func(parent *object.Commit) error {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
// sometimes the patch generation will fail due to a known bug in
|
||||||
|
// sergi's go-diff: https://github.com/sergi/go-diff/issues/89.
|
||||||
|
// Once a fix has been merged I will remove this recover.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if repo.timeoutReached() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
start := time.Now()
|
||||||
|
patch, err := c.Patch(parent)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("could not generate patch")
|
||||||
|
}
|
||||||
|
repo.Manager.RecordTime(manager.PatchTime(howLong(start)))
|
||||||
|
inspectPatch(patch, c, repo)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// inspectFilesAtCommit accepts a commit object and a repo. This function is only called when the --files-at-commit=
|
||||||
|
// option has been set. That option tells gitleaks to look only at ALL the files at a commit and check the contents
|
||||||
|
// of said commit. Similar to inspectPatch(), if the files contained in the commit are a binaries or if they are
|
||||||
|
// whitelisted then those files will be skipped.
|
||||||
|
func inspectFilesAtCommit(c *object.Commit, repo *Repo) error {
|
||||||
fIter, err := c.Files()
|
fIter, err := c.Files()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -262,35 +317,18 @@ func inspectCommit(c *object.Commit, repo *Repo) error {
|
|||||||
|
|
||||||
err = fIter.ForEach(func(f *object.File) error {
|
err = fIter.ForEach(func(f *object.File) error {
|
||||||
bin, err := f.IsBinary()
|
bin, err := f.IsBinary()
|
||||||
if bin {
|
if bin || repo.timeoutReached() {
|
||||||
return nil
|
return nil
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if fileMatched(f, repo.config.Whitelist.File) {
|
|
||||||
log.Debugf("whitelisted file found, skipping audit of file: %s", f.Name)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if fileMatched(f.Name, repo.config.FileRegex) {
|
|
||||||
repo.Manager.SendLeaks(manager.Leak{
|
|
||||||
Line: "N/A",
|
|
||||||
Offender: f.Name,
|
|
||||||
Commit: c.Hash.String(),
|
|
||||||
Repo: repo.Name,
|
|
||||||
Rule: "file regex matched" + repo.config.FileRegex.String(),
|
|
||||||
Author: c.Author.Name,
|
|
||||||
Email: c.Author.Email,
|
|
||||||
Date: c.Author.When,
|
|
||||||
File: f.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
content, err := f.Contents()
|
content, err := f.Contents()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
InspectString(content, c, repo, f.Name)
|
InspectFile(content, f.Name, c, repo)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@@ -319,7 +357,42 @@ func isCommitWhiteListed(commitHash string, whitelistedCommits []string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileMatched(f interface{}, re *regexp.Regexp) bool {
|
func isOffenderWhiteListed(offender string, whitelist []config.Whitelist) bool {
|
||||||
|
if len(whitelist) != 0 {
|
||||||
|
for _, wl := range whitelist {
|
||||||
|
if wl.Regex.FindString(offender) != "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func isFileNameWhiteListed(filename string, whitelist []config.Whitelist) bool {
|
||||||
|
if len(whitelist) != 0 {
|
||||||
|
for _, wl := range whitelist {
|
||||||
|
if RegexMatched(filename, wl.File) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func isFilePathWhiteListed(filepath string, whitelist []config.Whitelist) bool {
|
||||||
|
if len(whitelist) != 0 {
|
||||||
|
for _, wl := range whitelist {
|
||||||
|
if RegexMatched(filepath, wl.Path) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegexMatched matched an interface to a regular expression. The interface f can
|
||||||
|
// be a string type or go-git *object.File type.
|
||||||
|
func RegexMatched(f interface{}, re *regexp.Regexp) bool {
|
||||||
if re == nil {
|
if re == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -344,8 +417,31 @@ func fileMatched(f interface{}, re *regexp.Regexp) bool {
|
|||||||
// It is similar to `git log {branch}`. Default behavior is to log ALL branches so
|
// It is similar to `git log {branch}`. Default behavior is to log ALL branches so
|
||||||
// gitleaks gets the full git history.
|
// gitleaks gets the full git history.
|
||||||
func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
||||||
|
var logOpts git.LogOptions
|
||||||
|
const dateformat string = "2006-01-02"
|
||||||
|
const timeformat string = "2006-01-02T15:04:05-0700"
|
||||||
|
if repo.Manager.Opts.CommitFrom != "" {
|
||||||
|
logOpts.From = plumbing.NewHash(repo.Manager.Opts.CommitFrom)
|
||||||
|
}
|
||||||
|
if repo.Manager.Opts.CommitSince != "" {
|
||||||
|
if t, err := time.Parse(timeformat, repo.Manager.Opts.CommitSince); err == nil {
|
||||||
|
logOpts.Since = &t
|
||||||
|
} else if t, err := time.Parse(dateformat, repo.Manager.Opts.CommitSince); err == nil {
|
||||||
|
logOpts.Since = &t
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if repo.Manager.Opts.CommitUntil != "" {
|
||||||
|
if t, err := time.Parse(timeformat, repo.Manager.Opts.CommitUntil); err == nil {
|
||||||
|
logOpts.Until = &t
|
||||||
|
} else if t, err := time.Parse(dateformat, repo.Manager.Opts.CommitUntil); err == nil {
|
||||||
|
logOpts.Until = &t
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if repo.Manager.Opts.Branch != "" {
|
if repo.Manager.Opts.Branch != "" {
|
||||||
var logOpts git.LogOptions
|
|
||||||
refs, err := repo.Storer.IterReferences()
|
refs, err := repo.Storer.IterReferences()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -373,6 +469,9 @@ func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
|||||||
}
|
}
|
||||||
return &logOpts, nil
|
return &logOpts, nil
|
||||||
}
|
}
|
||||||
|
if !logOpts.From.IsZero() || logOpts.Since != nil || logOpts.Until != nil {
|
||||||
|
return &logOpts, nil
|
||||||
|
}
|
||||||
return &git.LogOptions{All: true}, nil
|
return &git.LogOptions{All: true}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+104
-75
@@ -2,11 +2,11 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
)
|
)
|
||||||
@@ -17,11 +17,14 @@ type Whitelist struct {
|
|||||||
Description string
|
Description string
|
||||||
Regex *regexp.Regexp
|
Regex *regexp.Regexp
|
||||||
File *regexp.Regexp
|
File *regexp.Regexp
|
||||||
|
Path *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
// entropy represents an entropy range
|
// Entropy represents an entropy range
|
||||||
type entropy struct {
|
type Entropy struct {
|
||||||
P1, P2 float64
|
Min float64
|
||||||
|
Max float64
|
||||||
|
Group int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rule is a struct that contains information that is loaded from a gitleaks config.
|
// Rule is a struct that contains information that is loaded from a gitleaks config.
|
||||||
@@ -30,23 +33,25 @@ type entropy struct {
|
|||||||
// that match is not whitelisted (globally or locally), then a leak will be appended
|
// that match is not whitelisted (globally or locally), then a leak will be appended
|
||||||
// to the final audit report.
|
// to the final audit report.
|
||||||
type Rule struct {
|
type Rule struct {
|
||||||
Description string
|
Description string
|
||||||
Regex *regexp.Regexp
|
Regex *regexp.Regexp
|
||||||
Tags []string
|
FileNameRegex *regexp.Regexp
|
||||||
Whitelist []Whitelist
|
FilePathRegex *regexp.Regexp
|
||||||
Entropy []entropy
|
Tags []string
|
||||||
|
Whitelist []Whitelist
|
||||||
|
Entropies []Entropy
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config is a composite struct of Rules and Whitelists
|
// Config is a composite struct of Rules and Whitelists
|
||||||
// Each Rule contains a description, regular expression, tags, and whitelists if available
|
// Each Rule contains a description, regular expression, tags, and whitelists if available
|
||||||
type Config struct {
|
type Config struct {
|
||||||
FileRegex *regexp.Regexp
|
|
||||||
Message *regexp.Regexp
|
|
||||||
Rules []Rule
|
Rules []Rule
|
||||||
Whitelist struct {
|
Whitelist struct {
|
||||||
Description string
|
Description string
|
||||||
Commits []string
|
Commits []string
|
||||||
File *regexp.Regexp
|
Files []*regexp.Regexp
|
||||||
|
Paths []*regexp.Regexp
|
||||||
|
Repos []*regexp.Regexp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,24 +59,29 @@ type Config struct {
|
|||||||
// see the config in config/defaults.go for an example. TomlLoader is used
|
// see the config in config/defaults.go for an example. TomlLoader is used
|
||||||
// to generate Config values (compiling regexes, etc).
|
// to generate Config values (compiling regexes, etc).
|
||||||
type TomlLoader struct {
|
type TomlLoader struct {
|
||||||
Global struct {
|
|
||||||
File string
|
|
||||||
Message string
|
|
||||||
}
|
|
||||||
Whitelist struct {
|
Whitelist struct {
|
||||||
Description string
|
Description string
|
||||||
Commits []string
|
Commits []string
|
||||||
File string
|
Files []string
|
||||||
|
Paths []string
|
||||||
|
Repos []string
|
||||||
}
|
}
|
||||||
Rules []struct {
|
Rules []struct {
|
||||||
Description string
|
Description string
|
||||||
Regex string
|
Regex string
|
||||||
Tags []string
|
FileNameRegex string
|
||||||
Entropies []string
|
FilePathRegex string
|
||||||
Whitelist []struct {
|
Tags []string
|
||||||
|
Entropies []struct {
|
||||||
|
Min string
|
||||||
|
Max string
|
||||||
|
Group string
|
||||||
|
}
|
||||||
|
Whitelist []struct {
|
||||||
Description string
|
Description string
|
||||||
Regex string
|
Regex string
|
||||||
File string
|
File string
|
||||||
|
Path string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +97,8 @@ func NewConfig(options options.Options) (Config, error) {
|
|||||||
var err error
|
var err error
|
||||||
if options.Config != "" {
|
if options.Config != "" {
|
||||||
_, err = toml.DecodeFile(options.Config, &tomlLoader)
|
_, err = toml.DecodeFile(options.Config, &tomlLoader)
|
||||||
|
// append a whitelist rule for whitelisting the config
|
||||||
|
tomlLoader.Whitelist.Files = append(tomlLoader.Whitelist.Files, path.Base(options.Config))
|
||||||
} else {
|
} else {
|
||||||
_, err = toml.Decode(DefaultConfig, &tomlLoader)
|
_, err = toml.Decode(DefaultConfig, &tomlLoader)
|
||||||
}
|
}
|
||||||
@@ -111,90 +123,107 @@ func (tomlLoader TomlLoader) Parse() (Config, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
}
|
}
|
||||||
|
fileNameRe, err := regexp.Compile(rule.FileNameRegex)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
|
}
|
||||||
|
filePathRe, err := regexp.Compile(rule.FilePathRegex)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// rule specific whitelists
|
// rule specific whitelists
|
||||||
var whitelists []Whitelist
|
var whitelists []Whitelist
|
||||||
for _, wl := range rule.Whitelist {
|
for _, wl := range rule.Whitelist {
|
||||||
re, err := regexp.Compile(wl.Regex)
|
wlRe, err := regexp.Compile(wl.Regex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
}
|
}
|
||||||
fileRe, err := regexp.Compile(wl.File)
|
wlFileNameRe, err := regexp.Compile(wl.File)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
|
}
|
||||||
|
wlFilePathRe, err := regexp.Compile(wl.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
}
|
}
|
||||||
whitelists = append(whitelists, Whitelist{
|
whitelists = append(whitelists, Whitelist{
|
||||||
Description: wl.Description,
|
Description: wl.Description,
|
||||||
File: fileRe,
|
File: wlFileNameRe,
|
||||||
Regex: re,
|
Path: wlFilePathRe,
|
||||||
|
Regex: wlRe,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
entropies, err := getEntropy(rule.Entropies)
|
var entropies []Entropy
|
||||||
if err != nil {
|
for _, e := range rule.Entropies {
|
||||||
return cfg, err
|
min, err := strconv.ParseFloat(e.Min, 64)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, err
|
||||||
|
}
|
||||||
|
max, err := strconv.ParseFloat(e.Max, 64)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, err
|
||||||
|
}
|
||||||
|
if e.Group == "" {
|
||||||
|
e.Group = "0"
|
||||||
|
}
|
||||||
|
group, err := strconv.ParseInt(e.Group, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, err
|
||||||
|
} else if int(group) >= len(re.SubexpNames()) {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: group cannot be higher than number of groups in regexp")
|
||||||
|
} else if group < 0 {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: group cannot be lower than 0")
|
||||||
|
} else if min > 8.0 || min < 0.0 || max > 8.0 || max < 0.0 {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: invalid entropy ranges, must be within 0.0-8.0")
|
||||||
|
} else if min > max {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: entropy Min value cannot be higher than Max value")
|
||||||
|
}
|
||||||
|
|
||||||
|
entropies = append(entropies, Entropy{Min: min, Max: max, Group: int(group)})
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Rules = append(cfg.Rules, Rule{
|
cfg.Rules = append(cfg.Rules, Rule{
|
||||||
Description: rule.Description,
|
Description: rule.Description,
|
||||||
Regex: re,
|
Regex: re,
|
||||||
Tags: rule.Tags,
|
FileNameRegex: fileNameRe,
|
||||||
Whitelist: whitelists,
|
FilePathRegex: filePathRe,
|
||||||
Entropy: entropies,
|
Tags: rule.Tags,
|
||||||
|
Whitelist: whitelists,
|
||||||
|
Entropies: entropies,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// global leaks
|
// global file name whitelists
|
||||||
if tomlLoader.Global.File != "" {
|
for _, wlFileName := range tomlLoader.Whitelist.Files {
|
||||||
re, err := regexp.Compile(tomlLoader.Global.File)
|
re, err := regexp.Compile(wlFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
}
|
}
|
||||||
cfg.FileRegex = re
|
cfg.Whitelist.Files = append(cfg.Whitelist.Files, re)
|
||||||
}
|
|
||||||
if tomlLoader.Global.Message != "" {
|
|
||||||
re, err := regexp.Compile(tomlLoader.Global.Message)
|
|
||||||
if err != nil {
|
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
|
||||||
}
|
|
||||||
cfg.Message = re
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// global whitelists
|
// global file path whitelists
|
||||||
if tomlLoader.Whitelist.File != "" {
|
for _, wlFilePath := range tomlLoader.Whitelist.Paths {
|
||||||
re, err := regexp.Compile(tomlLoader.Whitelist.File)
|
re, err := regexp.Compile(wlFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
}
|
}
|
||||||
cfg.Whitelist.File = re
|
cfg.Whitelist.Paths = append(cfg.Whitelist.Paths, re)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// global repo whitelists
|
||||||
|
for _, wlRepo := range tomlLoader.Whitelist.Repos {
|
||||||
|
re, err := regexp.Compile(wlRepo)
|
||||||
|
if err != nil {
|
||||||
|
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||||
|
}
|
||||||
|
cfg.Whitelist.Repos = append(cfg.Whitelist.Repos, re)
|
||||||
|
}
|
||||||
|
|
||||||
cfg.Whitelist.Commits = tomlLoader.Whitelist.Commits
|
cfg.Whitelist.Commits = tomlLoader.Whitelist.Commits
|
||||||
cfg.Whitelist.Description = tomlLoader.Whitelist.Description
|
cfg.Whitelist.Description = tomlLoader.Whitelist.Description
|
||||||
|
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getEntropy
|
|
||||||
func getEntropy(entropyStr []string) ([]entropy, error) {
|
|
||||||
var ranges []entropy
|
|
||||||
for _, span := range entropyStr {
|
|
||||||
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 := entropy{P1: v1, P2: v2}
|
|
||||||
if r.P1 > 8.0 || r.P1 < 0.0 || r.P2 > 8.0 || r.P2 < 0.0 {
|
|
||||||
return nil, fmt.Errorf("invalid entropy ranges, must be within 0.0-8.0")
|
|
||||||
}
|
|
||||||
ranges = append(ranges, r)
|
|
||||||
}
|
|
||||||
return ranges, nil
|
|
||||||
}
|
|
||||||
+27
-13
@@ -2,7 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -54,13 +54,6 @@ func TestParse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantErr: fmt.Errorf("problem loading config: error parsing regexp: missing argument to repetition operator: `??`"),
|
wantErr: fmt.Errorf("problem loading config: error parsing regexp: missing argument to repetition operator: `??`"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: "test bad global message regex",
|
|
||||||
opts: options.Options{
|
|
||||||
Config: "../test_data/test_configs/bad_aws_key_message_regex.toml",
|
|
||||||
},
|
|
||||||
wantErr: fmt.Errorf("problem loading config: error parsing regexp: missing argument to repetition operator: `??`"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
description: "test successful load big ol thing",
|
description: "test successful load big ol thing",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
@@ -78,28 +71,49 @@ func TestParse(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
Config: "../test_data/test_configs/bad_entropy_1.toml",
|
Config: "../test_data/test_configs/bad_entropy_1.toml",
|
||||||
},
|
},
|
||||||
wantErr: fmt.Errorf("entropy range must be ascending"),
|
wantErr: fmt.Errorf("problem loading config: entropy Min value cannot be higher than Max value"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "test entropy value p2",
|
description: "test entropy value max",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
Config: "../test_data/test_configs/bad_entropy_2.toml",
|
Config: "../test_data/test_configs/bad_entropy_2.toml",
|
||||||
},
|
},
|
||||||
wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
|
wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "test entropy value p1",
|
description: "test entropy value min",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
Config: "../test_data/test_configs/bad_entropy_3.toml",
|
Config: "../test_data/test_configs/bad_entropy_3.toml",
|
||||||
},
|
},
|
||||||
wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
|
wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "test entropy value p1",
|
description: "test entropy value group",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
Config: "../test_data/test_configs/bad_entropy_4.toml",
|
Config: "../test_data/test_configs/bad_entropy_4.toml",
|
||||||
},
|
},
|
||||||
wantErr: fmt.Errorf("invalid entropy ranges, must be within 0.0-8.0"),
|
wantErr: fmt.Errorf("strconv.ParseInt: parsing \"x\": invalid syntax"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test entropy value group",
|
||||||
|
opts: options.Options{
|
||||||
|
Config: "../test_data/test_configs/bad_entropy_5.toml",
|
||||||
|
},
|
||||||
|
wantErr: fmt.Errorf("problem loading config: group cannot be lower than 0"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test entropy value group",
|
||||||
|
opts: options.Options{
|
||||||
|
Config: "../test_data/test_configs/bad_entropy_6.toml",
|
||||||
|
},
|
||||||
|
wantErr: fmt.Errorf("problem loading config: group cannot be higher than number of groups in regexp"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "test entropy range limits",
|
||||||
|
opts: options.Options{
|
||||||
|
Config: "../test_data/test_configs/bad_entropy_7.toml",
|
||||||
|
},
|
||||||
|
wantErr: fmt.Errorf("problem loading config: invalid entropy ranges, must be within 0.0-8.0"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-18
@@ -13,7 +13,7 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Secret Key"
|
description = "AWS Secret Key"
|
||||||
regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]'''
|
regex = '''(?i)aws(.{0,20})?(?-i)[0-9a-zA-Z\/+]{40}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -33,27 +33,27 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Twitter Secret Key"
|
description = "Twitter Secret Key"
|
||||||
regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{35,44}['\"]'''
|
regex = '''(?i)twitter(.{0,20})?[0-9a-z]{35,44}'''
|
||||||
tags = ["key", "Twitter"]
|
tags = ["key", "Twitter"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Twitter Client ID"
|
description = "Twitter Client ID"
|
||||||
regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{18,25}['\"]'''
|
regex = '''(?i)twitter(.{0,20})?[0-9a-z]{18,25}'''
|
||||||
tags = ["client", "Twitter"]
|
tags = ["client", "Twitter"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Github"
|
description = "Github"
|
||||||
regex = '''(?i)github(.{0,20})?(?-i)['\"][0-9a-zA-Z]{35,40}['\"]'''
|
regex = '''(?i)github(.{0,20})?(?-i)[0-9a-zA-Z]{35,40}'''
|
||||||
tags = ["key", "Github"]
|
tags = ["key", "Github"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "LinkedIn Client ID"
|
description = "LinkedIn Client ID"
|
||||||
regex = '''(?i)linkedin(.{0,20})?(?-i)['\"][0-9a-z]{12}['\"]'''
|
regex = '''(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}'''
|
||||||
tags = ["client", "LinkedIn"]
|
tags = ["client", "LinkedIn"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "LinkedIn Secret Key"
|
description = "LinkedIn Secret Key"
|
||||||
regex = '''(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]'''
|
regex = '''(?i)linkedin(.{0,20})?[0-9a-z]{16}'''
|
||||||
tags = ["secret", "LinkedIn"]
|
tags = ["secret", "LinkedIn"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -63,33 +63,32 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Asymmetric Private Key"
|
description = "Asymmetric Private Key"
|
||||||
regex = '''-----BEGIN (EC|PGP|DSA|RSA|OPENSSH) PRIVATE KEY( BLOCK)?-----'''
|
regex = '''-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----'''
|
||||||
tags = ["key", "AsymmetricPrivateKey"]
|
tags = ["key", "AsymmetricPrivateKey"]
|
||||||
|
|
||||||
[[rules]]
|
|
||||||
description = "Generic Credential"
|
|
||||||
regex = '''(?i)(api_key|apikey|secret)(.{0,20})?['|"][0-9a-zA-Z]{16,45}['|"]'''
|
|
||||||
tags = ["key", "API", "generic"]
|
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Google API key"
|
description = "Google API key"
|
||||||
regex = '''AIza[0-9A-Za-z\\-_]{35}'''
|
regex = '''AIza[0-9A-Za-z\\-_]{35}'''
|
||||||
tags = ["key", "Google"]
|
tags = ["key", "Google"]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "Google (GCP) Service Account"
|
||||||
|
regex = '''"type": "service_account"'''
|
||||||
|
tags = ["key", "Google"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Heroku API key"
|
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}['"]'''
|
regex = '''(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
|
||||||
tags = ["key", "Heroku"]
|
tags = ["key", "Heroku"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "MailChimp API key"
|
description = "MailChimp API key"
|
||||||
regex = '''(?i)(mailchimp|mc)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]'''
|
regex = '''(?i)(mailchimp|mc)(.{0,20})?[0-9a-f]{32}-us[0-9]{1,2}'''
|
||||||
tags = ["key", "Mailchimp"]
|
tags = ["key", "Mailchimp"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Mailgun API key"
|
description = "Mailgun API key"
|
||||||
regex = '''(?i)(mailgun|mg)(.{0,20})?['"][0-9a-z]{32}['"]'''
|
regex = '''((?i)(mailgun|mg)(.{0,20})?)?key-[0-9a-z]{32}'''
|
||||||
tags = ["key", "Mailgun"]
|
tags = ["key", "Mailgun"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -114,7 +113,7 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Stripe API key"
|
description = "Stripe API key"
|
||||||
regex = '''(?i)stripe(.{0,20})?['\"][sk|rk]_live_[0-9a-zA-Z]{24}'''
|
regex = '''(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}'''
|
||||||
tags = ["key", "Stripe"]
|
tags = ["key", "Stripe"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -129,10 +128,10 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Twilio API key"
|
description = "Twilio API key"
|
||||||
regex = '''(?i)twilio(.{0,20})?['\"][0-9a-f]{32}['\"]'''
|
regex = '''(?i)twilio(.{0,20})?SK[0-9a-f]{32}'''
|
||||||
tags = ["key", "twilio"]
|
tags = ["key", "twilio"]
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
description = "Whitelisted files"
|
description = "Whitelisted files"
|
||||||
file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$)'''
|
files = [ '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$)''' ]
|
||||||
`
|
`
|
||||||
+53
-19
@@ -124,46 +124,80 @@ title = "gitleaks config"
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Env Var"
|
description = "Env Var"
|
||||||
regex = '''(?i)(api_key|apikey|secret|key|api|password|pw|host)=[0-9a-zA-Z-_{}]{4,120}'''
|
regex = '''(?i)(apikey|secret|key|api|password|pass|pw|host)=[0-9a-zA-Z-_.{}]{4,120}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Port"
|
description = "Port"
|
||||||
regex = '''(?i)port(.{0,4})?[0-9]{1,10}'''
|
regex = '''(?i)port(.{0,4})?[0-9]{1,10}'''
|
||||||
|
[[rules.whitelist]]
|
||||||
|
regex = '''(?i)port '''
|
||||||
|
description = "ignore export "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Email"
|
description = "Email"
|
||||||
regex = '''[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}'''
|
regex = '''[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}'''
|
||||||
tags = ["email"]
|
tags = ["email"]
|
||||||
|
[[rules.whitelist]]
|
||||||
|
file = '''(?i)bashrc'''
|
||||||
|
description = "ignore bashrc emails"
|
||||||
|
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Generic Credential"
|
description = "Generic Credential"
|
||||||
regex = '''(?i)(dbpasswd|dbuser|dbname|dbhost|api_key|apikey|secret|key|api|password|user|guid|hostname|pw|auth)(.{0,20})?['|"][0-9a-zA-Z-_!{}/=]{4,120}['|"]'''
|
regex = '''(?i)(dbpasswd|dbuser|dbname|dbhost|api_key|apikey|secret|key|api|password|user|guid|hostname|pw|auth)(.{0,20})?['|"]([0-9a-zA-Z-_\/+!{}/=]{4,120})['|"]'''
|
||||||
tags = ["key", "API", "generic"]
|
tags = ["key", "API", "generic"]
|
||||||
|
# ignore leaks with specific identifiers like slack and aws
|
||||||
|
[[rules.whitelist]]
|
||||||
|
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})'''
|
||||||
|
description = "ignore slack"
|
||||||
|
[[rules.whitelist]]
|
||||||
|
description = "MailChimp API key"
|
||||||
|
regex = '''(?i)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]'''
|
||||||
|
[[rules.whitelist]]
|
||||||
|
description = "AWS Manager ID"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
|
||||||
|
#[[rules]]
|
||||||
|
# description = "s3config"
|
||||||
|
# regex = '''(?i)(dbpasswd|dbuser|dbname|dbhost|api_key|apikey|key|api|password|user|guid|hostname|pw|auth)(.{0,3})?([0-9a-zA-Z-_\/+!{}=]{4,120})'''
|
||||||
|
# fileNameRegex = '''(?i)s3cfg$'''
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "High Entropy"
|
||||||
|
regex = '''[0-9a-zA-Z-_!{}/=]{4,120}'''
|
||||||
|
fileNameRegex = '''(?i)(dump.sql|high-entropy-misc.txt)$'''
|
||||||
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.3"
|
||||||
|
Max = "7.0"
|
||||||
|
[[rules.whitelist]]
|
||||||
|
description = "ignore ssh key and pems"
|
||||||
|
file = '''(pem|ppk|env)$'''
|
||||||
|
path = '''(.*)?ssh'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "Potential bash var"
|
||||||
|
regex='''(?i)(=)([0-9a-zA-Z-_!{}=]{4,120})'''
|
||||||
|
tags = ["key", "bash", "API", "generic"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "3.5"
|
||||||
|
Max = "4.5"
|
||||||
|
Group = "1"
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "WP-Config"
|
description = "WP-Config"
|
||||||
regex='''define(.{0,20})?(DB_CHARSET|NONCE_SALT|LOGGED_IN_SALT|AUTH_SALT|NONCE_KEY|DB_HOST|DB_PASSWORD|AUTH_KEY|SECURE_AUTH_KEY|LOGGED_IN_KEY|DB_NAME|DB_USER)(.{0,20})?['|"].{10,120}['|"]'''
|
regex='''define(.{0,20})?(DB_CHARSET|NONCE_SALT|LOGGED_IN_SALT|AUTH_SALT|NONCE_KEY|DB_HOST|DB_PASSWORD|AUTH_KEY|SECURE_AUTH_KEY|LOGGED_IN_KEY|DB_NAME|DB_USER)(.{0,20})?['|"].{10,120}['|"]'''
|
||||||
tags = ["key", "API", "generic"]
|
tags = ["key", "API", "generic"]
|
||||||
|
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Pure Entropy"
|
description = "Files with keys and credentials"
|
||||||
regex = '''['|"][0-9a-zA-Z-._{}$\/=]{40,120}['|"]'''
|
fileNameRegex = '''(?i)(id_rsa|passwd|id_rsa.pub|pgpass|pem|key|shadow)'''
|
||||||
entropies = [
|
|
||||||
"5.0-5.6"
|
|
||||||
]
|
|
||||||
|
|
||||||
[[rules]]
|
|
||||||
description = "Entropy plus Generic Credential"
|
|
||||||
regex = '''(?i)(api_key|apikey|secret|key|api|password|pw)'''
|
|
||||||
entropies = [
|
|
||||||
"5.2-5.5"
|
|
||||||
]
|
|
||||||
|
|
||||||
[Global]
|
|
||||||
file = '''(?i)(id_rsa|passwd|id_rsa.pub|pgpass|pem|key|shadow)'''
|
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
description = "image whitelists"
|
description = "image whitelists"
|
||||||
file = '''(.*?)(jpg|gif|doc|pdf|bin)$'''
|
files = ['''(.*?)(jpg|gif|doc|pdf|bin)$''']
|
||||||
|
|
||||||
@@ -8,8 +8,10 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy and regex"
|
description = "entropy and regex"
|
||||||
regex = '''(?i)key(.{0,20})?['|"][0-9a-zA-Z]{16,45}['|"]'''
|
regex = '''(?i)key(.{0,20})?['|"][0-9a-zA-Z]{16,45}['|"]'''
|
||||||
entropies = [
|
|
||||||
"4.5-4.7",
|
|
||||||
"5.5-6.3",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.5"
|
||||||
|
Max = "5.7"
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "5.5"
|
||||||
|
Max = "6.3"
|
||||||
@@ -6,5 +6,7 @@
|
|||||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
[Global]
|
[[rules]]
|
||||||
|
description = "PEM Files"
|
||||||
file = '''(.*)?pem$'''
|
file = '''(.*)?pem$'''
|
||||||
|
tags = ["key", "PEM"]
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
module github.com/zricethezav/gitleaks
|
module github.com/zricethezav/gitleaks/v4
|
||||||
|
|
||||||
go 1.13
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/BurntSushi/toml v0.3.1
|
github.com/BurntSushi/toml v0.3.1
|
||||||
github.com/google/go-github v17.0.0+incompatible
|
github.com/go-git/go-billy/v5 v5.0.0
|
||||||
|
github.com/go-git/go-git/v5 v5.0.0
|
||||||
|
github.com/google/go-cmp v0.4.0 // indirect
|
||||||
|
github.com/google/go-github/v31 v31.0.0
|
||||||
github.com/hako/durafmt v0.0.0-20191009132224-3f39dc1ed9f4
|
github.com/hako/durafmt v0.0.0-20191009132224-3f39dc1ed9f4
|
||||||
github.com/jessevdk/go-flags v1.4.0
|
github.com/jessevdk/go-flags v1.4.0
|
||||||
github.com/mattn/go-colorable v0.1.2
|
github.com/mattn/go-colorable v0.1.2
|
||||||
github.com/sergi/go-diff v1.0.0
|
github.com/sergi/go-diff v1.1.0
|
||||||
github.com/sirupsen/logrus v1.4.2
|
github.com/sirupsen/logrus v1.4.2
|
||||||
github.com/xanzy/go-gitlab v0.21.0
|
github.com/xanzy/go-gitlab v0.21.0
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||||
gopkg.in/src-d/go-billy.v4 v4.3.2
|
|
||||||
gopkg.in/src-d/go-git.v4 v4.13.1
|
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo
|
|||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -17,12 +17,24 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr
|
|||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
|
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||||
|
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||||
|
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM=
|
||||||
|
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||||
|
github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc=
|
||||||
|
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
||||||
|
github.com/go-git/go-git/v5 v5.0.0 h1:k5RWPm4iJwYtfWoxIJy4wJX9ON7ihPeZZYC1fLYDnpg=
|
||||||
|
github.com/go-git/go-git/v5 v5.0.0/go.mod h1:oYD8y9kWsGINPFJoLdaScGCN6dlKg23blmClfZwtUVA=
|
||||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
|
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-github/v31 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo=
|
||||||
|
github.com/google/go-github/v31 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM=
|
||||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
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/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
github.com/hako/durafmt v0.0.0-20191009132224-3f39dc1ed9f4 h1:60gBOooTSmNtrqNaRvrDbi8VAne0REaek2agjnITKSw=
|
github.com/hako/durafmt v0.0.0-20191009132224-3f39dc1ed9f4 h1:60gBOooTSmNtrqNaRvrDbi8VAne0REaek2agjnITKSw=
|
||||||
@@ -38,32 +50,29 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
|||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
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/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
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/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/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.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/xanzy/go-gitlab v0.21.0 h1:Ru55sR4TBoDNsAKwCOpzeaGtbiWj7xTksVmzBJbLu6c=
|
github.com/xanzy/go-gitlab v0.21.0 h1:Ru55sR4TBoDNsAKwCOpzeaGtbiWj7xTksVmzBJbLu6c=
|
||||||
@@ -72,48 +81,45 @@ github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70
|
|||||||
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
|
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
|
||||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/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-20190108225652-1e06a53dbb7e/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-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
|
||||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk=
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/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/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/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-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0=
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
|
||||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a h1:mEQZbbaBjWyLNy0tmZmgEuQAR8XOQ3hL8GYi3J/NG64=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
|
|
||||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg=
|
|
||||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
|
|
||||||
gopkg.in/src-d/go-git.v4 v4.13.1 h1:SRtFyV8Kxc0UP7aCHcijOMQGPxHSmMOPrzulQWolkYE=
|
|
||||||
gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8=
|
|
||||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
+49
-18
@@ -6,37 +6,48 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/audit"
|
"github.com/zricethezav/gitleaks/v4/audit"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
"github.com/google/go-github/github"
|
"github.com/go-git/go-git/v5"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
|
"github.com/google/go-github/v31/github"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Github wraps a github client and manager. This struct implements what the Host interface defines.
|
// Github wraps a github client and manager. This struct implements what the Host interface defines.
|
||||||
type Github struct {
|
type Github struct {
|
||||||
client *github.Client
|
client *github.Client
|
||||||
manager manager.Manager
|
manager *manager.Manager
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGithubClient accepts a manager struct and returns a Github host pointer which will be used to
|
// NewGithubClient accepts a manager struct and returns a Github host pointer which will be used to
|
||||||
// perform a github audit on an organization, user, or PR.
|
// perform a github audit on an organization, user, or PR.
|
||||||
func NewGithubClient(m manager.Manager) *Github {
|
func NewGithubClient(m *manager.Manager) (*Github, error) {
|
||||||
|
var err error
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
token := oauth2.StaticTokenSource(
|
token := oauth2.StaticTokenSource(
|
||||||
&oauth2.Token{AccessToken: options.GetAccessToken(m.Opts)},
|
&oauth2.Token{AccessToken: options.GetAccessToken(m.Opts)},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var githubClient *github.Client
|
||||||
|
httpClient := oauth2.NewClient(ctx, token)
|
||||||
|
|
||||||
|
if m.Opts.BaseURL == "" {
|
||||||
|
githubClient = github.NewClient(httpClient)
|
||||||
|
} else {
|
||||||
|
githubClient, err = github.NewEnterpriseClient(m.Opts.BaseURL, m.Opts.BaseURL, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
return &Github{
|
return &Github{
|
||||||
manager: m,
|
manager: m,
|
||||||
client: github.NewClient(oauth2.NewClient(ctx, token)),
|
client: githubClient,
|
||||||
}
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audit will audit a github user or organization's repos.
|
// Audit will audit a github user or organization's repos.
|
||||||
@@ -47,7 +58,10 @@ func (g *Github) Audit() {
|
|||||||
Page: 1,
|
Page: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
var githubRepos []*github.Repository
|
var (
|
||||||
|
githubRepos []*github.Repository
|
||||||
|
auth transport.AuthMethod
|
||||||
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var (
|
var (
|
||||||
@@ -61,8 +75,18 @@ func (g *Github) Audit() {
|
|||||||
} else if g.manager.Opts.Organization != "" {
|
} else if g.manager.Opts.Organization != "" {
|
||||||
_githubRepos, resp, err = g.client.Repositories.ListByOrg(ctx, g.manager.Opts.Organization,
|
_githubRepos, resp, err = g.client.Repositories.ListByOrg(ctx, g.manager.Opts.Organization,
|
||||||
&github.RepositoryListByOrgOptions{ListOptions: listOptions})
|
&github.RepositoryListByOrgOptions{ListOptions: listOptions})
|
||||||
|
} else {
|
||||||
|
_githubRepos, resp, err = g.client.Repositories.List(ctx, "",
|
||||||
|
&github.RepositoryListOptions{ListOptions: listOptions})
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range _githubRepos {
|
||||||
|
if g.manager.Opts.ExcludeForks && r.GetFork() {
|
||||||
|
log.Debugf("excluding forked repo: %s", *r.Name)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
githubRepos = append(githubRepos, r)
|
||||||
}
|
}
|
||||||
githubRepos = append(githubRepos, _githubRepos...)
|
|
||||||
|
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
break
|
break
|
||||||
@@ -81,16 +105,22 @@ func (g *Github) Audit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range githubRepos {
|
for _, repo := range githubRepos {
|
||||||
r := audit.NewRepo(&g.manager)
|
r := audit.NewRepo(g.manager)
|
||||||
r.Name = *repo.Name
|
|
||||||
|
if g.manager.CloneOptions != nil {
|
||||||
|
auth = g.manager.CloneOptions.Auth
|
||||||
|
}
|
||||||
err := r.Clone(&git.CloneOptions{
|
err := r.Clone(&git.CloneOptions{
|
||||||
URL: *repo.CloneURL,
|
URL: *repo.CloneURL,
|
||||||
|
Auth: auth,
|
||||||
})
|
})
|
||||||
|
r.Name = *repo.Name
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("unable to clone via https and access token, attempting with ssh now")
|
log.Warn("unable to clone via https and access token, attempting with ssh now")
|
||||||
auth, err := options.SSHAuth(g.manager.Opts)
|
auth, err := options.SSHAuth(g.manager.Opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("unable to get ssh auth, skipping clone and audit for repo %s: %+v\n", *repo.CloneURL, err)
|
log.Warnf("unable to get ssh auth, skipping clone and audit for repo %s: %+v\n", *repo.CloneURL, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
err = r.Clone(&git.CloneOptions{
|
err = r.Clone(&git.CloneOptions{
|
||||||
URL: *repo.SSHURL,
|
URL: *repo.SSHURL,
|
||||||
@@ -98,6 +128,7 @@ func (g *Github) Audit() {
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("err cloning %s, skipping clone and audit: %+v\n", *repo.SSHURL, err)
|
log.Warnf("err cloning %s, skipping clone and audit: %+v\n", *repo.SSHURL, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = r.Audit(); err != nil {
|
if err = r.Audit(); err != nil {
|
||||||
@@ -113,7 +144,7 @@ func (g *Github) AuditPR() {
|
|||||||
owner := splits[len(splits)-4]
|
owner := splits[len(splits)-4]
|
||||||
repoName := splits[len(splits)-3]
|
repoName := splits[len(splits)-3]
|
||||||
prNum, err := strconv.Atoi(splits[len(splits)-1])
|
prNum, err := strconv.Atoi(splits[len(splits)-1])
|
||||||
repo := audit.NewRepo(&g.manager)
|
repo := audit.NewRepo(g.manager)
|
||||||
repo.Name = repoName
|
repo.Name = repoName
|
||||||
log.Infof("auditing pr %s\n", g.manager.Opts.PullRequest)
|
log.Infof("auditing pr %s\n", g.manager.Opts.PullRequest)
|
||||||
|
|
||||||
@@ -144,7 +175,7 @@ func (g *Github) AuditPR() {
|
|||||||
if f.Patch == nil {
|
if f.Patch == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
audit.InspectString(*f.Patch, &commitObj, repo, *f.Filename)
|
audit.InspectFile(*f.Patch, *f.Filename, &commitObj, repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page = resp.NextPage
|
page = resp.NextPage
|
||||||
|
|||||||
+25
-10
@@ -4,9 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/audit"
|
"github.com/zricethezav/gitleaks/v4/audit"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/xanzy/go-gitlab"
|
"github.com/xanzy/go-gitlab"
|
||||||
@@ -15,19 +15,27 @@ import (
|
|||||||
// Gitlab wraps a gitlab client and manager. This struct implements what the Host interface defines.
|
// Gitlab wraps a gitlab client and manager. This struct implements what the Host interface defines.
|
||||||
type Gitlab struct {
|
type Gitlab struct {
|
||||||
client *gitlab.Client
|
client *gitlab.Client
|
||||||
manager manager.Manager
|
manager *manager.Manager
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGitlabClient accepts a manager struct and returns a Gitlab host pointer which will be used to
|
// NewGitlabClient accepts a manager struct and returns a Gitlab host pointer which will be used to
|
||||||
// perform a gitlab audit on an group or user.
|
// perform a gitlab audit on an group or user.
|
||||||
func NewGitlabClient(m manager.Manager) *Gitlab {
|
func NewGitlabClient(m *manager.Manager) (*Gitlab, error) {
|
||||||
return &Gitlab{
|
var err error
|
||||||
|
|
||||||
|
gitlabClient := &Gitlab{
|
||||||
manager: m,
|
manager: m,
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
client: gitlab.NewClient(nil, options.GetAccessToken(m.Opts)),
|
client: gitlab.NewClient(nil, options.GetAccessToken(m.Opts)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.Opts.BaseURL != "" {
|
||||||
|
err = gitlabClient.client.SetBaseURL(m.Opts.BaseURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
return gitlabClient, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audit will audit a github user or organization's repos.
|
// Audit will audit a github user or organization's repos.
|
||||||
@@ -49,19 +57,26 @@ func (g *Gitlab) Audit() {
|
|||||||
glOpts := &gitlab.ListProjectsOptions{
|
glOpts := &gitlab.ListProjectsOptions{
|
||||||
ListOptions: listOpts,
|
ListOptions: listOpts,
|
||||||
}
|
}
|
||||||
projects, resp, err = g.client.Projects.ListUserProjects(g.manager.Opts.User, glOpts)
|
_projects, resp, err = g.client.Projects.ListUserProjects(g.manager.Opts.User, glOpts)
|
||||||
|
|
||||||
} else if g.manager.Opts.Organization != "" {
|
} else if g.manager.Opts.Organization != "" {
|
||||||
glOpts := &gitlab.ListGroupProjectsOptions{
|
glOpts := &gitlab.ListGroupProjectsOptions{
|
||||||
ListOptions: listOpts,
|
ListOptions: listOpts,
|
||||||
}
|
}
|
||||||
projects, resp, err = g.client.Groups.ListGroupProjects(g.manager.Opts.Organization, glOpts)
|
_projects, resp, err = g.client.Groups.ListGroupProjects(g.manager.Opts.Organization, glOpts)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
projects = append(projects, _projects...)
|
for _, p := range _projects {
|
||||||
|
if g.manager.Opts.ExcludeForks && p.ForkedFromProject != nil {
|
||||||
|
log.Debugf("excluding forked repo: %s", p.Name)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
projects = append(projects, p)
|
||||||
|
}
|
||||||
|
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -74,7 +89,7 @@ func (g *Gitlab) Audit() {
|
|||||||
|
|
||||||
// iterate of gitlab projects
|
// iterate of gitlab projects
|
||||||
for _, p := range projects {
|
for _, p := range projects {
|
||||||
r := audit.NewRepo(&g.manager)
|
r := audit.NewRepo(g.manager)
|
||||||
cloneOpts := g.manager.CloneOptions
|
cloneOpts := g.manager.CloneOptions
|
||||||
cloneOpts.URL = p.HTTPURLToRepo
|
cloneOpts.URL = p.HTTPURLToRepo
|
||||||
err := r.Clone(cloneOpts)
|
err := r.Clone(cloneOpts)
|
||||||
|
|||||||
+5
-4
@@ -1,7 +1,7 @@
|
|||||||
package hosts
|
package hosts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,11 +20,12 @@ type Host interface {
|
|||||||
// Run kicks off a host audit. This function accepts a manager and determines what host it should audit
|
// Run kicks off a host audit. This function accepts a manager and determines what host it should audit
|
||||||
func Run(m *manager.Manager) error {
|
func Run(m *manager.Manager) error {
|
||||||
var host Host
|
var host Host
|
||||||
|
var err error
|
||||||
switch getHost(m.Opts.Host) {
|
switch getHost(m.Opts.Host) {
|
||||||
case _github:
|
case _github:
|
||||||
host = NewGithubClient(*m)
|
host, err = NewGithubClient(m)
|
||||||
case _gitlab:
|
case _gitlab:
|
||||||
host = NewGitlabClient(*m)
|
host, err = NewGitlabClient(m)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -34,7 +35,7 @@ func Run(m *manager.Manager) error {
|
|||||||
} else {
|
} else {
|
||||||
host.Audit()
|
host.Audit()
|
||||||
}
|
}
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHost(host string) int {
|
func getHost(host string) int {
|
||||||
|
|||||||
+3
-3
@@ -3,9 +3,9 @@ package hosts
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/audit"
|
"github.com/zricethezav/gitleaks/v4/audit"
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/hosts"
|
"github.com/zricethezav/gitleaks/v4/hosts"
|
||||||
"github.com/zricethezav/gitleaks/manager"
|
"github.com/zricethezav/gitleaks/v4/manager"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
"github.com/hako/durafmt"
|
"github.com/hako/durafmt"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|||||||
+58
-44
@@ -9,19 +9,22 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
|
|
||||||
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/hako/durafmt"
|
"github.com/hako/durafmt"
|
||||||
"github.com/mattn/go-colorable"
|
"github.com/mattn/go-colorable"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxLineLen = 200
|
||||||
|
|
||||||
// Manager is a struct containing options and configs as well CloneOptions and CloneDir.
|
// Manager is a struct containing options and configs as well CloneOptions and CloneDir.
|
||||||
// This struct is passed into each NewRepo so we are not passing around the manager in func params.
|
// This struct is passed into each NewRepo so we are not passing around the manager in func params.
|
||||||
type Manager struct {
|
type Manager struct {
|
||||||
@@ -77,7 +80,7 @@ type RegexTime struct {
|
|||||||
|
|
||||||
// Metadata is a struct used to communicate metadata about an audit like timings and total commit counts.
|
// Metadata is a struct used to communicate metadata about an audit like timings and total commit counts.
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
mux sync.Mutex
|
mux *sync.Mutex
|
||||||
data map[string]interface{}
|
data map[string]interface{}
|
||||||
|
|
||||||
timings chan interface{}
|
timings chan interface{}
|
||||||
@@ -101,6 +104,42 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewManager accepts options and returns a manager struct. The manager is a container for gitleaks configurations,
|
||||||
|
// options and channel receivers.
|
||||||
|
func NewManager(opts options.Options, cfg config.Config) (*Manager, error) {
|
||||||
|
cloneOpts, err := opts.CloneOptions()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
m := &Manager{
|
||||||
|
Opts: opts,
|
||||||
|
Config: cfg,
|
||||||
|
CloneOptions: cloneOpts,
|
||||||
|
|
||||||
|
stopChan: make(chan os.Signal, 1),
|
||||||
|
leakChan: make(chan Leak),
|
||||||
|
leakWG: &sync.WaitGroup{},
|
||||||
|
leakCache: make(map[string]bool),
|
||||||
|
metaWG: &sync.WaitGroup{},
|
||||||
|
metadata: Metadata{
|
||||||
|
RegexTime: make(map[string]int64),
|
||||||
|
timings: make(chan interface{}),
|
||||||
|
data: make(map[string]interface{}),
|
||||||
|
mux: new(sync.Mutex),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
signal.Notify(m.stopChan, os.Interrupt)
|
||||||
|
|
||||||
|
// start receiving leaks and metadata
|
||||||
|
go m.receiveLeaks()
|
||||||
|
go m.receiveMetadata()
|
||||||
|
go m.receiveInterrupt()
|
||||||
|
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetLeaks returns all available leaks
|
// GetLeaks returns all available leaks
|
||||||
func (manager *Manager) GetLeaks() []Leak {
|
func (manager *Manager) GetLeaks() []Leak {
|
||||||
// need to wait for any straggling leaks
|
// need to wait for any straggling leaks
|
||||||
@@ -111,9 +150,19 @@ func (manager *Manager) GetLeaks() []Leak {
|
|||||||
// SendLeaks accepts a leak and is used by the audit pkg. This is the public function
|
// SendLeaks accepts a leak and is used by the audit pkg. This is the public function
|
||||||
// that allows other packages to send leaks to the manager.
|
// that allows other packages to send leaks to the manager.
|
||||||
func (manager *Manager) SendLeaks(l Leak) {
|
func (manager *Manager) SendLeaks(l Leak) {
|
||||||
|
if len(l.Line) > maxLineLen {
|
||||||
|
l.Line = l.Line[0:maxLineLen-1] + "..."
|
||||||
|
}
|
||||||
|
if len(l.Offender) > maxLineLen {
|
||||||
|
l.Offender = l.Offender[0:maxLineLen-1] + "..."
|
||||||
|
}
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write([]byte(l.Commit + l.Offender + l.File))
|
h.Write([]byte(l.Commit + l.Offender + l.File + l.Line))
|
||||||
l.lookupHash = hex.EncodeToString(h.Sum(nil))
|
l.lookupHash = hex.EncodeToString(h.Sum(nil))
|
||||||
|
if manager.Opts.Redact {
|
||||||
|
l.Line = strings.ReplaceAll(l.Line, l.Offender, "REDACTED")
|
||||||
|
l.Offender = "REDACTED"
|
||||||
|
}
|
||||||
manager.leakWG.Add(1)
|
manager.leakWG.Add(1)
|
||||||
manager.leakChan <- l
|
manager.leakChan <- l
|
||||||
}
|
}
|
||||||
@@ -187,41 +236,6 @@ func (manager *Manager) RecordTime(t interface{}) {
|
|||||||
manager.metadata.timings <- t
|
manager.metadata.timings <- t
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManager accepts options and returns a manager struct. The manager is a container for gitleaks configurations,
|
|
||||||
// options and channel receivers.
|
|
||||||
func NewManager(opts options.Options, cfg config.Config) (*Manager, error) {
|
|
||||||
cloneOpts, err := opts.CloneOptions()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
m := &Manager{
|
|
||||||
Opts: opts,
|
|
||||||
Config: cfg,
|
|
||||||
CloneOptions: cloneOpts,
|
|
||||||
|
|
||||||
stopChan: make(chan os.Signal, 1),
|
|
||||||
leakChan: make(chan Leak),
|
|
||||||
leakWG: &sync.WaitGroup{},
|
|
||||||
leakCache: make(map[string]bool),
|
|
||||||
metaWG: &sync.WaitGroup{},
|
|
||||||
metadata: Metadata{
|
|
||||||
RegexTime: make(map[string]int64),
|
|
||||||
timings: make(chan interface{}),
|
|
||||||
data: make(map[string]interface{}),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
signal.Notify(m.stopChan, os.Interrupt)
|
|
||||||
|
|
||||||
// start receiving leaks and metadata
|
|
||||||
go m.receiveLeaks()
|
|
||||||
go m.receiveMetadata()
|
|
||||||
go m.receiveInterrupt()
|
|
||||||
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DebugOutput logs metadata and other messages that occurred during a gitleaks audit
|
// DebugOutput logs metadata and other messages that occurred during a gitleaks audit
|
||||||
func (manager *Manager) DebugOutput() {
|
func (manager *Manager) DebugOutput() {
|
||||||
log.Debugf("-------------------------\n")
|
log.Debugf("-------------------------\n")
|
||||||
@@ -239,9 +253,9 @@ func (manager *Manager) DebugOutput() {
|
|||||||
log.Debugf("| Individual Regex Times |\n")
|
log.Debugf("| Individual Regex Times |\n")
|
||||||
log.Debugf("--------------------------\n")
|
log.Debugf("--------------------------\n")
|
||||||
for k, v := range manager.metadata.RegexTime {
|
for k, v := range manager.metadata.RegexTime {
|
||||||
fmt.Fprintf(w, "%s\t%s\n", k, durafmt.Parse(time.Duration(v)*time.Nanosecond))
|
_, _ = fmt.Fprintf(w, "%s\t%s\n", k, durafmt.Parse(time.Duration(v)*time.Nanosecond))
|
||||||
}
|
}
|
||||||
w.Flush()
|
_ = w.Flush()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,13 +287,13 @@ func (manager *Manager) Report() error {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w := csv.NewWriter(file)
|
w := csv.NewWriter(file)
|
||||||
w.Write([]string{"repo", "line", "commit", "offender", "rule", "tags", "commitMsg", "author", "email", "file", "date"})
|
_ = w.Write([]string{"repo", "line", "commit", "offender", "rule", "tags", "commitMsg", "author", "email", "file", "date"})
|
||||||
for _, leak := range manager.GetLeaks() {
|
for _, leak := range manager.GetLeaks() {
|
||||||
w.Write([]string{leak.Repo, leak.Line, leak.Commit, leak.Offender, leak.Rule, leak.Tags, leak.Message, leak.Author, leak.Email, leak.File, leak.Date.Format(time.RFC3339)})
|
w.Write([]string{leak.Repo, leak.Line, leak.Commit, leak.Offender, leak.Rule, leak.Tags, leak.Message, leak.Author, leak.Email, leak.File, leak.Date.Format(time.RFC3339)})
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
}
|
}
|
||||||
file.Close()
|
_ = file.Close()
|
||||||
|
|
||||||
log.Infof("report written to %s", manager.Opts.Report)
|
log.Infof("report written to %s", manager.Opts.Report)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package manager
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zricethezav/gitleaks/config"
|
"github.com/zricethezav/gitleaks/v4/config"
|
||||||
"github.com/zricethezav/gitleaks/options"
|
"github.com/zricethezav/gitleaks/v4/options"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|||||||
+40
-27
@@ -7,13 +7,13 @@ import (
|
|||||||
"os/user"
|
"os/user"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/version"
|
"github.com/zricethezav/gitleaks/v4/version"
|
||||||
|
|
||||||
|
"github.com/go-git/go-git/v5"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
|
||||||
"github.com/jessevdk/go-flags"
|
"github.com/jessevdk/go-flags"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/transport/http"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// No leaks or early exit due to invalid options
|
// No leaks or early exit due to invalid options
|
||||||
@@ -23,38 +23,47 @@ const (
|
|||||||
Success = 0
|
Success = 0
|
||||||
LeaksPresent = 1
|
LeaksPresent = 1
|
||||||
ErrorEncountered = 2
|
ErrorEncountered = 2
|
||||||
|
donateMessage = "👋 maintaining gitleaks takes a lot of work so consider sponsoring me or donating a little something\n❤️ https://github.com/sponsors/zricethezav\n💸 https://www.paypal.me/zricethezav\n₿ btc:3GndEzRZa6rJ8ZpkLureUcc5TDHMYfpDxn"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options stores values of command line options
|
// Options stores values of command line options
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Verbose bool `short:"v" long:"verbose" description:"Show verbose output from audit"`
|
Verbose bool `short:"v" long:"verbose" description:"Show verbose output from audit"`
|
||||||
Repo string `short:"r" long:"repo" description:"Target repository"`
|
Repo string `short:"r" long:"repo" description:"Target repository"`
|
||||||
Config string `long:"config" description:"config path"`
|
Config string `long:"config" description:"config path"`
|
||||||
Disk bool `long:"disk" description:"Clones repo(s) to disk"`
|
Disk bool `long:"disk" description:"Clones repo(s) to disk"`
|
||||||
Version bool `long:"version" description:"version number"`
|
Version bool `long:"version" description:"version number"`
|
||||||
Timeout int `long:"timeout" description:"Timeout (s)"`
|
Username string `long:"username" description:"Username for git repo"`
|
||||||
Username string `long:"username" description:"Username for git repo"`
|
Password string `long:"password" description:"Password for git repo"`
|
||||||
Password string `long:"password" description:"Password for git repo"`
|
AccessToken string `long:"access-token" description:"Access token for git repo"`
|
||||||
AccessToken string `long:"access-token" description:"Access token for git repo"`
|
Commit string `long:"commit" description:"sha of commit to audit or \"latest\" to scan the last commit of the repository"`
|
||||||
Commit string `long:"commit" description:"sha of commit to audit"`
|
FilesAtCommit string `long:"files-at-commit" description:"sha of commit to audit all files at commit"`
|
||||||
Threads int `long:"threads" description:"Maximum number of threads gitleaks spawns"`
|
Threads int `long:"threads" description:"Maximum number of threads gitleaks spawns"`
|
||||||
SSH string `long:"ssh-key" description:"path to ssh key used for auth"`
|
SSH string `long:"ssh-key" description:"path to ssh key used for auth"`
|
||||||
Uncommited bool `long:"uncommitted" description:"run gitleaks on uncommitted code"`
|
Uncommited bool `long:"uncommitted" description:"run gitleaks on uncommitted code"`
|
||||||
RepoPath string `long:"repo-path" description:"Path to repo"`
|
RepoPath string `long:"repo-path" description:"Path to repo"`
|
||||||
OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`
|
OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`
|
||||||
Branch string `long:"branch" description:"Branch to audit"`
|
Branch string `long:"branch" description:"Branch to audit"`
|
||||||
Report string `long:"report" description:"path to write json leaks file"`
|
Report string `long:"report" description:"path to write json leaks file"`
|
||||||
ReportFormat string `long:"report-format" default:"json" description:"json or csv"`
|
ReportFormat string `long:"report-format" default:"json" description:"json or csv"`
|
||||||
Redact bool `long:"redact" description:"redact secrets from log messages and leaks"`
|
Redact bool `long:"redact" description:"redact secrets from log messages and leaks"`
|
||||||
Debug bool `long:"debug" description:"log debug messages"`
|
Debug bool `long:"debug" description:"log debug messages"`
|
||||||
RepoConfig bool `long:"repo-config" description:"Load config from target repo. Config file must be \".gitleaks.toml\" or \"gitleaks.toml\""`
|
RepoConfig bool `long:"repo-config" description:"Load config from target repo. Config file must be \".gitleaks.toml\" or \"gitleaks.toml\""`
|
||||||
PrettyPrint bool `long:"pretty" description:"Pretty print json if leaks are present"`
|
PrettyPrint bool `long:"pretty" description:"Pretty print json if leaks are present"`
|
||||||
|
CommitFrom string `long:"commit-from" description:"Commit to start audit from"`
|
||||||
|
CommitTo string `long:"commit-to" description:"Commit to stop audit"`
|
||||||
|
CommitSince string `long:"commit-since" description:"Audit commits more recent than a specific date. Ex: '2006-01-02' or '2006-01-02T15:04:05-0700' format."`
|
||||||
|
CommitUntil string `long:"commit-until" description:"Audit commits older than a specific date. Ex: '2006-01-02' or '2006-01-02T15:04:05-0700' format."`
|
||||||
|
Timeout string `long:"timeout" description:"Time allowed per audit. Ex: 10us, 30s, 1m, 1h10m1s"`
|
||||||
|
Depth int `long:"depth" description:"Number of commits to audit"`
|
||||||
|
|
||||||
// Hosts
|
// Hosts
|
||||||
Host string `long:"host" description:"git hosting service like gitlab or github. Supported hosts include: Github, Gitlab"`
|
Host string `long:"host" description:"git hosting service like gitlab or github. Supported hosts include: Github, Gitlab"`
|
||||||
|
BaseURL string `long:"baseurl" description:"Base URL for API requests. Defaults to the public GitLab or GitHub API, but can be set to a domain endpoint to use with a self hosted server."`
|
||||||
Organization string `long:"org" description:"organization to audit"`
|
Organization string `long:"org" description:"organization to audit"`
|
||||||
User string `long:"user" description:"user to audit"` //work
|
User string `long:"user" description:"user to audit"`
|
||||||
PullRequest string `long:"pr" description:"pull/merge request url"`
|
PullRequest string `long:"pr" description:"pull/merge request url"`
|
||||||
|
ExcludeForks bool `long:"exclude-forks" description:"audit excludes forks"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseOptions is responsible for parsing options passed in by cli. An Options struct
|
// ParseOptions is responsible for parsing options passed in by cli. An Options struct
|
||||||
@@ -70,6 +79,7 @@ func ParseOptions() (Options, error) {
|
|||||||
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type != flags.ErrHelp {
|
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type != flags.ErrHelp {
|
||||||
parser.WriteHelp(os.Stdout)
|
parser.WriteHelp(os.Stdout)
|
||||||
}
|
}
|
||||||
|
fmt.Println(donateMessage)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +112,9 @@ func (opts Options) Guard() error {
|
|||||||
if !oneOrNoneSet(opts.AccessToken, opts.Password) {
|
if !oneOrNoneSet(opts.AccessToken, opts.Password) {
|
||||||
log.Warn("both access-token and password are set. Only password will be attempted")
|
log.Warn("both access-token and password are set. Only password will be attempted")
|
||||||
}
|
}
|
||||||
|
if !oneOrNoneSet(opts.FilesAtCommit, opts.Commit, opts.CommitTo, opts.CommitFrom) {
|
||||||
|
return fmt.Errorf("invalid commit options set")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@
|
|||||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
[Global]
|
[[rules]]
|
||||||
file = '''(.*)?py$'''
|
description = "Python files"
|
||||||
|
fileRegex = '''(.*)?py$'''
|
||||||
@@ -5,4 +5,6 @@
|
|||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
description = "ignore md files"
|
description = "ignore md files"
|
||||||
file = '''(.*)?md$'''
|
files = [
|
||||||
|
'''(.*)?md$'''
|
||||||
|
]
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "AWS Manager ID"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
|
[whitelist]
|
||||||
|
description = "ignore config folders"
|
||||||
|
paths = [
|
||||||
|
'''config(uration)?'''
|
||||||
|
]
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "AWS Manager ID"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
tags = ["key", "AWS"]
|
||||||
|
[whitelist]
|
||||||
|
description = "whitelist repo"
|
||||||
|
repos = [
|
||||||
|
'''test_repo_1'''
|
||||||
|
]
|
||||||
@@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
description = "ignore md files"
|
description = "ignore md files"
|
||||||
file = '''???????'''
|
files = ['''???????''']
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
[[rules]]
|
|
||||||
description = "AWS Secret Key"
|
|
||||||
regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]'''
|
|
||||||
tags = ["key", "AWS"]
|
|
||||||
|
|
||||||
[[rules]]
|
|
||||||
description = "AWS Manager ID"
|
|
||||||
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
|
||||||
tags = ["key", "AWS"]
|
|
||||||
|
|
||||||
[Global]
|
|
||||||
message = '''?????????????'''
|
|
||||||
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
"4.3-4.1",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.3"
|
||||||
|
Max = "4.1"
|
||||||
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
"4.3-x",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.3"
|
||||||
|
Max = "x"
|
||||||
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
"x-4.3",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "x"
|
||||||
|
Max = "4.1"
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
"1-8.9",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "1.0"
|
||||||
|
Max = "8"
|
||||||
|
Group = "x"
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "entropy"
|
||||||
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "1.0"
|
||||||
|
Max = "8.5"
|
||||||
|
Group = "-2"
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "entropy"
|
||||||
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "1.0"
|
||||||
|
Max = "8.5"
|
||||||
|
Group = "2"
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "entropy"
|
||||||
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "1.0"
|
||||||
|
Max = "8.5"
|
||||||
|
Group = "0"
|
||||||
|
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{40,120})['|"]'''
|
||||||
"4.5-4.7",
|
|
||||||
"5.5-6.3",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.5"
|
||||||
|
Max = "4.7"
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "5.5"
|
||||||
|
Max = "6.3"
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "Generic Credential"
|
||||||
|
regex = '''(?i)(api_key|apikey|secret|password|pass|pw|key)(.{0,20})?[0-9a-zA-Z]{16,45}'''
|
||||||
|
tags = ["key", "API", "generic"]
|
||||||
@@ -135,11 +135,14 @@ title = "gitleaks config"
|
|||||||
file = '''(.*)?Jenkinsfile$'''
|
file = '''(.*)?Jenkinsfile$'''
|
||||||
|
|
||||||
# Global rules. This instructs gitleaks to ignore all .pem files or if a message with
|
# Global rules. This instructs gitleaks to ignore all .pem files or if a message with
|
||||||
[Global]
|
[[rules]]
|
||||||
file = '''(.*?)(pem)'''
|
description = "Files with keys and credentials"
|
||||||
message = '''somethingbad'''
|
fileRegex = '''(.*?)(pem)'''
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
description = "image whitelists"
|
description = "File whitelists"
|
||||||
file = '''(.*?)(jpg|gif|doc|pdf|bin)$'''
|
files = [
|
||||||
|
'''(.*?)(jpg|gif)$''',
|
||||||
|
'''(.*?)(doc|pdf|bin)$'''
|
||||||
|
]
|
||||||
|
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy and regex"
|
description = "entropy and regex"
|
||||||
regex = '''(?i)key(.{0,20})?['|"][0-9a-zA-Z]{16,45}['|"]'''
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
entropies = [
|
|
||||||
"4.5-4.7",
|
|
||||||
"5.5-6.3",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "4.5"
|
||||||
|
Max = "4.7"
|
||||||
|
Group = "1"
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "5.5"
|
||||||
|
Max = "6.3"
|
||||||
|
Group = "1"
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "Generic password"
|
||||||
|
regex = '''(?i)(password|token).{0,20}?\s*[:|=]\s*?(?-i)([0-9a-zA-Z\/+]{4,40})'''
|
||||||
|
fileNameRegex = '''.*\.ya?ml'''
|
||||||
|
tags = ["key", "Yml", "Yaml"]
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "AWS Manager ID"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
filePathRegex = '''config(guration)?'''
|
||||||
|
tags = ["key", "AWS"]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "Generic password"
|
||||||
|
regex = '''(?i)(password|token).{0,20}?\s*[:|=]\s*?(?-i)([0-9a-zA-Z\/+]{4,40})'''
|
||||||
|
fileNameRegex = '''.*\.properties'''
|
||||||
|
filePathRegex = '''config(guration)?'''
|
||||||
|
tags = ["key", "Yml", "Yaml"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "AWS Manager ID"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
|
|
||||||
|
[whitelist]
|
||||||
|
commits = [
|
||||||
|
"b10b3e2cb320a8c211fda94c4567299d37de7776",
|
||||||
|
"17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"996865bb912f3bc45898a370a13aadb315014b55"
|
||||||
|
]
|
||||||
|
|
||||||
@@ -25,19 +25,6 @@
|
|||||||
"date": "2019-10-25T13:12:32-04:00",
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "rm secrets again\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:12:32-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIB",
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
@@ -51,19 +38,6 @@
|
|||||||
"date": "2019-10-25T13:12:08-04:00",
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "adding another one\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:12:08-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -77,19 +51,6 @@
|
|||||||
"date": "2019-10-25T13:07:41-04:00",
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "committing pem\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:07:41-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -104,17 +65,17 @@
|
|||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
"repo": "test_repo_2",
|
"repo": "test_repo_2",
|
||||||
"rule": "Generic Credential",
|
"rule": "AWS Manager ID",
|
||||||
"commitMessage": "wait this is actually adding an aws secret\n",
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zricer@protonmail.com",
|
||||||
"file": "secrets.md",
|
"file": "secrets.md",
|
||||||
"date": "2019-10-25T13:01:27-04:00",
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
"tags": "key, API, generic"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
@@ -142,19 +103,6 @@
|
|||||||
"date": "2019-10-25T13:54:26-04:00",
|
"date": "2019-10-25T13:54:26-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
|
|
||||||
"repo": "test_repo_3",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "rm secrets\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:54:26-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -168,19 +116,6 @@
|
|||||||
"date": "2019-10-25T13:54:08-04:00",
|
"date": "2019-10-25T13:54:08-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
|
|
||||||
"repo": "test_repo_3",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "more secrets\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:54:08-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -194,19 +129,6 @@
|
|||||||
"date": "2019-10-25T13:36:22-04:00",
|
"date": "2019-10-25T13:36:22-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"commit": "64cfcee9aad1c84581631636bfc54f2050718d1a",
|
|
||||||
"repo": "test_repo_3",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "rm secrets\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:36:22-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -221,16 +143,42 @@
|
|||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "\naws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
"offender": "AKIAIO5FODNN7EXAMPL2",
|
||||||
"commit": "deea550dd6c7acaf0e59432600593533984a2125",
|
"commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
|
||||||
"repo": "test_repo_3",
|
"repo": "test_repo_5",
|
||||||
"rule": "Generic Credential",
|
"rule": "AWS Manager ID",
|
||||||
"commitMessage": "dev branch\n",
|
"commitMessage": "introduce more secrets\n",
|
||||||
"author": "zach rice",
|
"author": "Zach Rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zrice@gitlab.com",
|
||||||
"file": "secrets.md",
|
"file": "secrets.py",
|
||||||
"date": "2019-10-25T13:35:03-04:00",
|
"date": "2020-02-01T10:08:04-05:00",
|
||||||
"tags": "key, API, generic"
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "1f2a4abc47dabf991e6af6f9770867ce0ac1f360",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "introduce secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:07:34-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
|
"repo": "test_repo_1",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "commit 1 with secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "server.test.py",
|
||||||
|
"date": "2019-10-24T09:29:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:54:26-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "more secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:54:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "\naws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPL2",
|
||||||
|
"commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "introduce more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:08:04-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding aws key\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T12:58:39-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:54:26-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "more secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:54:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "64cfcee9aad1c84581631636bfc54f2050718d1a",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:36:22-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "deea550dd6c7acaf0e59432600593533984a2125",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "dev branch\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:35:03-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "\naws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPL2",
|
||||||
|
"commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "introduce more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:08:04-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "1f2a4abc47dabf991e6af6f9770867ce0ac1f360",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "introduce secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:07:34-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "commit 1 with secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "server.test.py",
|
||||||
|
"date": "2019-10-24T09:29:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "\nmore_secrets = '99432bfewaf823ec3294e231'",
|
||||||
|
"offender": "secrets = '99432bfewaf823ec3294e231",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "Generic Credential",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, API, generic"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "\nmore_secrets = '99432bfewaf823ec3294e231'",
|
||||||
|
"offender": "secrets = '99432bfewaf823ec3294e231",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "Generic Credential",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, API, generic"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPL2",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPL2",
|
||||||
|
"commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
|
||||||
|
"repo": "test_repo_5",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "even more secrets\n",
|
||||||
|
"author": "Zach Rice",
|
||||||
|
"email": "zrice@gitlab.com",
|
||||||
|
"file": "secrets.py",
|
||||||
|
"date": "2020-02-01T10:30:22-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,28 +1,54 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"line": " Just moments after the Cessna's inquiry, a Twin Beech piped up on frequency, in a rather superior tone, asking for his ground speed. \"I have you at one hundred and twenty-five knots of ground spe",
|
"line": "const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
||||||
"offender": "Entropy range [{P1:4.5 P2:4.7}]",
|
"offender": "\"99432bfewaf823ec3294e231\"",
|
||||||
"commit": "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a",
|
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
|
||||||
"repo": "test_repo_4",
|
"repo": "test_repo_4",
|
||||||
"rule": "entropy",
|
"rule": "entropy",
|
||||||
"commitMessage": "removing secret.pem\n",
|
"commitMessage": "rm secrets\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zricer@protonmail.com",
|
||||||
"file": "secret.pem",
|
"file": "secrets.md",
|
||||||
"date": "2019-10-25T13:08:39-04:00",
|
"date": "2019-10-25T13:54:26-04:00",
|
||||||
"tags": "entropy"
|
"tags": "entropy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": " Just moments after the Cessna's inquiry, a Twin Beech piped up on frequency, in a rather superior tone, asking for his ground speed. \"I have you at one hundred and twenty-five knots of ground spe",
|
"line": "const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
||||||
"offender": "Entropy range [{P1:4.5 P2:4.7}]",
|
"offender": "\"99432bfewaf823ec3294e231\"",
|
||||||
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
|
||||||
"repo": "test_repo_4",
|
"repo": "test_repo_4",
|
||||||
"rule": "entropy",
|
"rule": "entropy",
|
||||||
"commitMessage": "committing pem\n",
|
"commitMessage": "more secrets\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zricer@protonmail.com",
|
||||||
"file": "secret.pem",
|
"file": "secrets.md",
|
||||||
"date": "2019-10-25T13:07:41-04:00",
|
"date": "2019-10-25T13:54:08-04:00",
|
||||||
|
"tags": "entropy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
||||||
|
"offender": "\"99432bfewaf823ec3294e231\"",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "entropy",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "entropy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
||||||
|
"offender": "\"99432bfewaf823ec3294e231\"",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "entropy",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
"tags": "entropy"
|
"tags": "entropy"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_4",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,30 +1,17 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"line": "N/A",
|
"line": "N/A",
|
||||||
"offender": "server.test.py",
|
"offender": "Filename/path offender: server.test.py",
|
||||||
"commit": "d274003914c707212cbe84e3e466a00013ccb639",
|
"commit": "d274003914c707212cbe84e3e466a00013ccb639",
|
||||||
"repo": "test_repo_1",
|
"repo": "test_repo_1",
|
||||||
"rule": "file regex matched(.*)?py$",
|
"rule": "Python files",
|
||||||
"commitMessage": "",
|
"commitMessage": "comment\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zricer@protonmail.com",
|
||||||
"file": "server.test.py",
|
"file": "server.test.py",
|
||||||
"date": "2019-10-24T10:03:38-04:00",
|
"date": "2019-10-24T10:03:38-04:00",
|
||||||
"tags": ""
|
"tags": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "N/A",
|
|
||||||
"offender": "server.test.py",
|
|
||||||
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
|
||||||
"repo": "test_repo_1",
|
|
||||||
"rule": "file regex matched(.*)?py$",
|
|
||||||
"commitMessage": "",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "server.test.py",
|
|
||||||
"date": "2019-10-24T09:29:27-04:00",
|
|
||||||
"tags": ""
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
||||||
"offender": "AKIAIO5FODNN7EXAMPLE",
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
@@ -37,5 +24,18 @@
|
|||||||
"file": "server.test.py",
|
"file": "server.test.py",
|
||||||
"date": "2019-10-24T09:29:27-04:00",
|
"date": "2019-10-24T09:29:27-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "N/A",
|
||||||
|
"offender": "Filename/path offender: server.test.py",
|
||||||
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
|
"repo": "test_repo_1",
|
||||||
|
"rule": "Python files",
|
||||||
|
"commitMessage": "commit 1 with secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "server.test.py",
|
||||||
|
"date": "2019-10-24T09:29:27-04:00",
|
||||||
|
"tags": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "0000000000000000000000000000000000000000",
|
||||||
|
"repo": "test_repo_7",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "***STAGED CHANGES***",
|
||||||
|
"author": "",
|
||||||
|
"email": "",
|
||||||
|
"file": "file",
|
||||||
|
"date": "1970-01-01T00:00:00Z",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "api_token: exampleSecretPassword",
|
||||||
|
"lineNumber": 3,
|
||||||
|
"offender": "token: exampleSecretPassword",
|
||||||
|
"commit": "e7bf376f855ae9bc6e3bb27b5f9d65c57eba799d",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "Generic password",
|
||||||
|
"commitMessage": "More secrets\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/config.yaml",
|
||||||
|
"date": "2020-02-19T04:08:26-05:00",
|
||||||
|
"tags": "key, Yml, Yaml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "db_password_token: exampleSecretPassword",
|
||||||
|
"lineNumber": 3,
|
||||||
|
"offender": "password_token: exampleSecretPassword",
|
||||||
|
"commit": "e7bf376f855ae9bc6e3bb27b5f9d65c57eba799d",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "Generic password",
|
||||||
|
"commitMessage": "More secrets\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/config.yaml",
|
||||||
|
"date": "2020-02-19T04:08:26-05:00",
|
||||||
|
"tags": "key, Yml, Yaml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "95cf0237f8cdfc0686a29df08260d8635f46c9b0",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "AWS Key in properties\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-19T04:04:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "api_token: exampleSecretPassword",
|
||||||
|
"offender": "token: exampleSecretPassword",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "Generic password",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "application.yaml",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, Yml, Yaml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "db_password: verySecretProductionPassword",
|
||||||
|
"offender": "password: verySecretProductionPassword",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "Generic password",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "application.yaml",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, Yml, Yaml"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "apiToken=d41d8cd98f00b204e9800998ecf8427e",
|
||||||
|
"offender": "Token=d41d8cd98f00b204e9800998ecf8427e",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "Generic password",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, Yml, Yaml"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "Adding some secrets in config folder\n\n",
|
||||||
|
"author": "Noel Algora",
|
||||||
|
"email": "noealgigu@gmail.com",
|
||||||
|
"file": "config/application.properties",
|
||||||
|
"date": "2020-02-24T14:13:15-05:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
||||||
"offender": "AKIAIO5FODNN7EXAMPLE",
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
"repo": "test_repo_1",
|
"repo": "test_repo_6",
|
||||||
"rule": "AWS Manager ID",
|
"rule": "AWS Manager ID",
|
||||||
"commitMessage": "commit 1 with secrets\n",
|
"commitMessage": "commit 1 with secrets\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
||||||
|
"offender": "AKIAIO5FODNN7EXAMPLE",
|
||||||
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
|
"repo": "test_repo_6",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "commit 1 with secrets\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "server.test.py",
|
||||||
|
"date": "2019-10-24T09:29:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -77,6 +77,19 @@
|
|||||||
"date": "2019-10-25T13:01:27-04:00",
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_3",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
|||||||
@@ -12,19 +12,6 @@
|
|||||||
"date": "2019-10-25T13:12:32-04:00",
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "rm secrets again\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:12:32-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIB",
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
@@ -38,19 +25,6 @@
|
|||||||
"date": "2019-10-25T13:12:08-04:00",
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": " const AWSSECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"offender": "SECRET = \"99432bfewaf823ec3294e231\"",
|
|
||||||
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "adding another one\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:12:08-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -64,19 +38,6 @@
|
|||||||
"date": "2019-10-25T13:07:41-04:00",
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
|
||||||
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
|
||||||
"repo": "test_repo_2",
|
|
||||||
"rule": "Generic Credential",
|
|
||||||
"commitMessage": "committing pem\n",
|
|
||||||
"author": "zach rice",
|
|
||||||
"email": "zricer@protonmail.com",
|
|
||||||
"file": "secrets.md",
|
|
||||||
"date": "2019-10-25T13:07:41-04:00",
|
|
||||||
"tags": "key, API, generic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
"offender": "AKIALALEMEL33243OLIA",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
@@ -91,17 +52,17 @@
|
|||||||
"tags": "key, AWS"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
"repo": "test_repo_2",
|
"repo": "test_repo_2",
|
||||||
"rule": "Generic Credential",
|
"rule": "AWS Manager ID",
|
||||||
"commitMessage": "wait this is actually adding an aws secret\n",
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
"author": "zach rice",
|
"author": "zach rice",
|
||||||
"email": "zricer@protonmail.com",
|
"email": "zricer@protonmail.com",
|
||||||
"file": "secrets.md",
|
"file": "secrets.md",
|
||||||
"date": "2019-10-25T13:01:27-04:00",
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
"tags": "key, API, generic"
|
"tags": "key, AWS"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding aws key\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T12:58:39-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "wait this is actually adding an aws secret\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:01:27-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "rm secrets again\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:32-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIB",
|
||||||
|
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "adding another one\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
|
"line": " aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'",
|
||||||
"offender": "key_id='AKIAIO5FODNN7EXAMPLE'",
|
"offender": "'ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'",
|
||||||
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
"repo": "test_repo_1",
|
"repo": "test_repo_1",
|
||||||
"rule": "entropy and regex",
|
"rule": "entropy and regex",
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "entropy"
|
description = "entropy"
|
||||||
entropies = [
|
regex = '''['|"]([0-9a-zA-Z-._{}$\/\+=]{20,120})['|"]'''
|
||||||
"4.5-4.7",
|
|
||||||
]
|
|
||||||
tags = ["entropy"]
|
tags = ["entropy"]
|
||||||
|
[[rules.Entropies]]
|
||||||
|
Min = "3.3"
|
||||||
|
Max = "3.5"
|
||||||
|
Group = "1"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
even more secrets
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ref: refs/heads/master
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = false
|
||||||
|
logallrefupdates = true
|
||||||
|
ignorecase = true
|
||||||
|
precomposeunicode = true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Unnamed repository; edit this file 'description' to name the repository.
|
||||||
Binary file not shown.
@@ -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]
|
||||||
|
# *~
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
0000000000000000000000000000000000000000 547bc0caa26ce3f20bea9ad9bb0f7e3e9dc749ec Zach Rice <zrice@gitlab.com> 1580490269 -0500 commit (initial): init
|
||||||
|
547bc0caa26ce3f20bea9ad9bb0f7e3e9dc749ec 1f2a4abc47dabf991e6af6f9770867ce0ac1f360 Zach Rice <zrice@gitlab.com> 1580569654 -0500 commit: introduce secrets
|
||||||
|
1f2a4abc47dabf991e6af6f9770867ce0ac1f360 ca71fcdeda15f25f0cc661d90e8785c255925c27 Zach Rice <zrice@gitlab.com> 1580569684 -0500 commit: introduce more secrets
|
||||||
|
ca71fcdeda15f25f0cc661d90e8785c255925c27 a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0 Zach Rice <zrice@gitlab.com> 1580571022 -0500 commit: even more secrets
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
0000000000000000000000000000000000000000 547bc0caa26ce3f20bea9ad9bb0f7e3e9dc749ec Zach Rice <zrice@gitlab.com> 1580490269 -0500 commit (initial): init
|
||||||
|
547bc0caa26ce3f20bea9ad9bb0f7e3e9dc749ec 1f2a4abc47dabf991e6af6f9770867ce0ac1f360 Zach Rice <zrice@gitlab.com> 1580569654 -0500 commit: introduce secrets
|
||||||
|
1f2a4abc47dabf991e6af6f9770867ce0ac1f360 ca71fcdeda15f25f0cc661d90e8785c255925c27 Zach Rice <zrice@gitlab.com> 1580569684 -0500 commit: introduce more secrets
|
||||||
|
ca71fcdeda15f25f0cc661d90e8785c255925c27 a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0 Zach Rice <zrice@gitlab.com> 1580571022 -0500 commit: even more secrets
|
||||||
BIN
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
|||||||
|
x•ŽM
|
||||||
|
Â0F]繀’ß&ĎŕŇÝĚdb¶•4ÝxzsW<xĽŹ¶e©]cN˝1˨�±™°” MA«ĽĆ’µˇ�0;ŚĹŻ]z��‰ŘŁ�!AN�޶ś2—�}Ţš|ÍňQ‰ĺőŰĆÜ_µż/´-7©}T~J“wň¬ĽRbĐń®óżž¨ko[>FfgjÜwń;ěH�
|
||||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
|||||||
|
x•�A
|
||||||
|
‚!F[{й@1ú«)Dt†–ítû…L�iÓéó
|
||||||
|
>xðÞG£÷& ½>Èd*¶š’3ç@hü‘μéZB$olEçL.dTúÈ>&<ípoÄpùÎ5·g“WÊ'ý
|
||||||
|
Ú´qe"Ñ!ªE×›ð¿žjï&êÚQ3–
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
|||||||
|
x•ŽA
|
||||||
|
Â0E]çse2Í$-ˆx—îÒéÄl#itáéÍ\=xŸ_òº.ˆèP‹*$%.29¥ë1«O®␍ê58ï�Ìæ‹n$›dÒ)ZNÄ E¼·Ó€Ú‡ž¥Å5ßuÎîQf¸-¢pþ–†ëc©Ï8ž$¯°Ü#‹DpDF4ͶwUÿíŒ~tƒ5…]¥hÝÍ\ïES
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
x•ŽAj1E»ö)t�yì‘l(¥gȲ;Y–“�N\g“Óg®ÐÕ‡�÷µïû6aYøc3Xk)![ñ)�ÊZ#'Zjð>ÇbèþdØ}‚o‹D)¹Ji9{#iÔ23&b5õ-:yÎ[ð#zƒË¦Ÿ¯qÌ÷u›¿RÎÚ÷/ðk•2¥'\ÝA�wÓþë¹í>G¯Ï#³÷að06î␍ÿGó
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Init
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
aws_access_key_id='AKIAIO5FODNN7EXAMPLE'
|
||||||
|
print(aws_access_key_id)
|
||||||
|
|
||||||
|
aws_access_key_id='AKIAIO5FODNN7EXAMPL2'
|
||||||
|
print(aws_access_key_id)
|
||||||
|
|
||||||
|
more_secrets = '99432bfewaf823ec3294e231'
|
||||||
|
print(more_secrets)
|
||||||
|
|
||||||
Loaded 100 of 151 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user