Skip to content

Commit

Permalink
(feat) #6 adds scan documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
benammann committed Aug 6, 2022
1 parent a62009e commit b12b7b2
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

go test ./...
git secrets scan
3 changes: 2 additions & 1 deletion cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ var scanCmd = &cobra.Command{
for _, secret := range contextSecrets {
decodedValue, errDecode := secret.Decode()
if errDecode != nil {
cobra.CheckErr(fmt.Errorf("Could not decode %s: %s\n", secret.Name, errDecode.Error()))
color.Yellow("Warning: could not decode secret %s from context %s, skipping this secret\n", secret.Name, secret.OriginContext.Name)
continue
}
decodedSecrets = append(decodedSecrets, &DecodedSecret{secret: secret, decodedValue: decodedValue})
}
Expand Down
Binary file added docs/img/git-secrets-scan-demo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 47 additions & 24 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# Git-Secrets

````text
________.__ __ _________ __
/ _____/|__|/ |_ / _____/ ____ ___________ _____/ |_ ______
/ \ ___| \ __\ \_____ \_/ __ \_/ ___\_ __ \_/ __ \ __\/ ___/
\ \_\ \ || | / \ ___/\ \___| | \/\ ___/| | \___ \
\______ /__||__| /_______ /\___ >\___ >__| \___ >__| /____ >
\/ \/ \/ \/ \/ \/
````

## encryption and rendering engine for git repositories

![Tag](https://img.shields.io/github/v/release/benammann/git-secrets?label=brew%20tag)
![Docker Image Version](https://img.shields.io/docker/v/benammann/git-secrets?label=docker%20image%20tag)
![Release Badge](https://github.com/benammann/git-secrets/actions/workflows/brew-release.yml/badge.svg)
![Tag](https://img.shields.io/github/v/release/benammann/git-secrets?label=release)
![Docker Image Version](https://img.shields.io/docker/v/benammann/git-secrets?label=image)
![Release Badge](https://github.com/benammann/git-secrets/actions/workflows/goreleaser.yml/badge.svg)
![Test Badge](https://github.com/benammann/git-secrets/actions/workflows/docker-release.yml/badge.svg)
![License](https://img.shields.io/github/license/benammann/git-secrets?123)

Expand All @@ -30,28 +19,44 @@ Git Secrets encrypts your passwords and configurations for multiple environments

### Demo

![](../docs/img/git-secrets-demo.gif)
![](img/git-secrets-demo.gif)

### Examples

- Encoding / Decoding: [with-binary-example](examples/with-binary-example)
- Kubernetes Secrets: [render-kubernetes-secret](examples/render-kubernetes-secret)
- Github Actions [.github/workflows/docker-release.yml](.github/workflows/docker-release.yml)


### Installation

via Homebrew / Linuxbrew
```
brew install benammann/tap/git-secrets
```
`Git-Secrets` is available on Linux, macOS and Windows platforms.

via Docker
* Binaries for Linux, Windows and Mac are available as tarballs in the [release](https://github.com/benammann/git-secrets/releases) page.

````bash
docker run benammann/git-secrets info
````

or just head over to the [Releases](https://github.com/benammann/git-secrets/releases) page and download the prebuilt binary manually
* Via Curl for Linux and Mac (uses https://github.com/jpillora/installer)

```shell
# without sudo
curl https://i.jpillora.com/benammann/git-secrets! | bash

# using sudo (if mv fails)
curl https://i.jpillora.com/benammann/git-secrets!! | bash
```

* Via Homebrew for macOS or LinuxBrew for Linux

```shell
brew install benammann/tap/git-secrets
```

* Via a GO install

```shell
# NOTE: The dev version will be in effect!
go install github.com/benammann/git-secrets@latest
```

## Getting started

Expand Down Expand Up @@ -133,6 +138,24 @@ git secrets render env --dry-run
git secrets render env -c prod
````

### Scan for plain secrets

`Git-Secrets` provides a simple command to scan for plain secrets in the project files.

![](img/git-secrets-scan-demo.png)

````bash
# scan all files added to git
git secrets scan -a

# scan staged files only
git secrets scan

# hint: add -v to show all the scanned file names
````

You should use this command to setup a pre-commit git-hook in your project. You can use Husky (https://typicode.github.io/husky/#/) to automatically install and setup the hook.


### Custom Template Functions

Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"description": "",
"main": "index.js",
"scripts": {
"prepare": "husky install",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
},
"author": "",
"license": "MIT",
"dependencies": {
"vuepress": "^2.0.0-beta.46"
},
"devDependencies": {
"husky": "^8.0.1"
}
}
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ git secrets render env --dry-run
git secrets render env -c prod
````

### Scan for plain secrets

`Git-Secrets` provides a simple command to scan for plain secrets in the project files.

![](docs/img/git-secrets-scan-demo.png)

````bash
# scan all files added to git
git secrets scan -a

# scan staged files only
git secrets scan

# hint: add -v to show all the scanned file names
````

You should use this command to setup a pre-commit git-hook in your project. You can use Husky (https://typicode.github.io/husky/#/) to automatically install and setup the hook.


### Custom Template Functions

Expand Down

0 comments on commit b12b7b2

Please sign in to comment.