-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from bloXroute-Labs/TCS-4727
Add gitleaks
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: gitleaks | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 4 * * *" | ||
jobs: | ||
scan: | ||
name: gitleaks | ||
runs-on: ubuntu-latest | ||
environment: develop | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: gitleaks/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITLEAKS_LICENSE: "${{ secrets.GITLEAKS_LICENSE }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
repos: | ||
- repo: https://github.com/gitleaks/gitleaks | ||
rev: v8.21.1 | ||
hooks: | ||
- id: gitleaks | ||
name: Detect hardcoded secrets | ||
args: ["detect", "--source=."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Pre-commit Setup Guide | ||
|
||
## Overview | ||
|
||
This guide will help you set up `pre-commit` hooks for your project. Pre-commit hooks are useful for automatically running checks before committing code to ensure code quality, security, and consistency. | ||
TechOps has enabled general golang linters and gitleaks which should be enabled on each commit. | ||
|
||
## Prerequisites | ||
|
||
- Python 3.6 or higher | ||
- `pip` (Python package installer) | ||
- `git` installed and configured | ||
|
||
## Installation | ||
|
||
To install `pre-commit`, follow these steps: | ||
|
||
1. **Install pre-commit** | ||
You can install `pre-commit` using `pip`: | ||
|
||
``` | ||
pip install pre-commit | ||
``` | ||
|
||
## Sample Usage | ||
This is a sample run on a basic commit: | ||
``` | ||
$ git commit -m "add precommit" | ||
Check Yaml...........................................(no files to check)Skipped | ||
Fix End of Files.........................................................Passed | ||
Trim Trailing Whitespace.................................................Passed | ||
Check for added large files..............................................Passed | ||
go fmt...............................................(no files to check)Skipped | ||
go imports...........................................(no files to check)Skipped | ||
golangci-lint........................................(no files to check)Skipped | ||
Detect hardcoded secrets.................................................Passed | ||
``` | ||
|
||
You can also run `pre-commit` test on all files: | ||
``` | ||
pre-commit run --all-files | ||
``` |