Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e1d18ca
feat: add Slack, Discord, Telegram, Azure, and PAT token detectors
StephenJarso Jun 15, 2026
e5ca638
feat: add more patterns to secrets detector
StephenJarso Jun 15, 2026
402d71a
feat: add SARIF output format reporter for CI/CD integration
StephenJarso Jun 15, 2026
363b397
feat: add .env.* file detection to config detector
StephenJarso Jun 15, 2026
27884eb
feat: add .envrc and .env.sample detection to env detector
StephenJarso Jun 15, 2026
1a04d32
test: add more test cases for secrets detector
StephenJarso Jun 15, 2026
9d9816d
test: add more test cases for auth detector
StephenJarso Jun 15, 2026
152b59c
test: add more test cases for config detector
StephenJarso Jun 15, 2026
39e2892
test: add more test cases for env detector
StephenJarso Jun 15, 2026
c4e4f98
test: add more edge case tests for config detector
StephenJarso Jun 15, 2026
7fc3372
test: add benchmark tests for detectors
StephenJarso Jun 15, 2026
59fe3df
feat: add Homebrew tap formula
StephenJarso Jun 15, 2026
fcc8645
feat: add VS Code extension manifest
StephenJarso Jun 15, 2026
e38bcf1
docs: update CHANGELOG with new features
StephenJarso Jun 15, 2026
623f4a4
docs: update detectors documentation
StephenJarso Jun 15, 2026
2009192
docs: add SARIF output format documentation
StephenJarso Jun 15, 2026
0199e27
ci: add GitHub Actions workflow for security scanning
StephenJarso Jun 15, 2026
5bc9869
ci: add release workflow
StephenJarso Jun 15, 2026
fa95f90
docs: add output_format configuration option
StephenJarso Jun 15, 2026
ad0398d
docs: update CHANGELOG with release workflow and fixes
StephenJarso Jun 15, 2026
ee288a3
chore: add additional linters to golangci config
StephenJarso Jun 15, 2026
144d514
perf: add semaphore to limit concurrent goroutines in scanner
StephenJarso Jun 15, 2026
e000c73
perf: add sync.Pool for buffer reuse in binary file detection
StephenJarso Jun 15, 2026
913ccbc
perf: add GetFileInfo helper function for file info reuse
StephenJarso Jun 15, 2026
04ff777
test: add test for GetFileInfo function
StephenJarso Jun 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
goarch: [amd64, arm64]
goos: [linux, darwin, windows]
exclude:
- goos: windows
goarch: arm64
- goos: darwin
goarch: arm64
os: ubuntu-latest
- goos: linux
goarch: arm64
os: macos-latest
- goos: darwin
goarch: amd64
os: ubuntu-latest
- goos: linux
goarch: amd64
os: macos-latest

steps:
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
with-cache: true

- name: Build
run: |
EXT=''
if [ "${{ matrix.goos }}" = "windows" ]; then
EXT='.exe'
fi
go build -o secure-push${EXT} ./cmd/secure-push

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: secure-push-${{ matrix.goos }}-${{ matrix.goarch }}
path: secure-push${{ matrix.goos === 'windows' && '.exe' || '' }}

release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +10 to +55
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/secure-push-linux-amd64/secure-push
artifacts/secure-push-darwin-amd64/secure-push
artifacts/secure-push-windows-amd64/secure-push.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/scanner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Security Scanner

on:
push:
branches: [main, develop]
pull_request:
branches: [main]

jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Secure Push Scanner
uses: secure-push/secure-push-action@v1
with:
path: '.'
output: 'sarif'
sarif_file: 'results.sarif'

- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'results.sarif'
category: 'secure-push'

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +11 to +28
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ linters:
- unused
- varcheck
- whitespace
- wsl
- wrapcheck
- zerologlint

issues:
exclude-rules:
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GitHub Actions CI workflow
- golangci-lint configuration
- Makefile with testing and building targets
- Slack token detector (xoxb, xoxa, xoxp, xoxr, xoxs)
- Discord webhook URL detector
- Telegram bot token detector
- Azure Key Vault detector
- Personal access token detector
- Hardcoded password pattern detection
- Connection string pattern detection
- API key header pattern detection
- Authorization header pattern detection
- Webhook URL pattern detection
- .envrc file detection
- .env.sample file detection
- SARIF output format reporter for CI/CD integration
- Homebrew tap formula for installation
- VS Code extension manifest

### Changed
- Improved env.go with additional .env patterns and edge cases
- Enhanced scanner with config integration
- Updated main.go to support sarif output format
- Added GitHub Actions release workflow

### Fixed
- Fixed .env.* file detection in config detector
- Fixed duplicate test cases in env_test.go
- Fixed integration test for multiple detectors

### Security
- Added comprehensive test coverage for all detectors
41 changes: 41 additions & 0 deletions Formula/secure-push.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# typed: false
# frozen_string_literal: true

class SecurePush < Formula
desc "Security scanner for your codebase"
homepage "https://github.com/secure-push/secure-push"
version "0.1.0"
license "MIT"

depends_on "go" => :build

on_macos do
on_intel do
url "https://github.com/secure-push/secure-push/releases/download/v0.1.0/secure-push_0.1.0_darwin_amd64.tar.gz"
sha256 "PLACEHOLDER"
end
on_arm do
url "https://github.com/secure-push/secure-push/releases/download/v0.1.0/secure-push_0.1.0_darwin_arm64.tar.gz"
sha256 "PLACEHOLDER"
end
end

on_linux do
on_intel do
url "https://github.com/secure-push/secure-push/releases/download/v0.1.0/secure-push_0.1.0_linux_amd64.tar.gz"
sha256 "PLACEHOLDER"
end
on_arm do
url "https://github.com/secure-push/secure-push/releases/download/v0.1.0/secure-push_0.1.0_linux_arm64.tar.gz"
sha256 "PLACEHOLDER"
end
end

def install
bin.install "secure-push"
end

test do
assert_match "secure-push version", shell_output("#{bin}/secure-push version")
end
end
4 changes: 3 additions & 1 deletion cmd/secure-push/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"os/exec"
"strings"

"secure-push/internal/config"

Check failure on line 10 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

import 'secure-push/internal/config' is not allowed from list 'Main' (depguard)
"secure-push/internal/detectors"

Check failure on line 11 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

import 'secure-push/internal/detectors' is not allowed from list 'Main' (depguard)
"secure-push/internal/logger"

Check failure on line 12 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

import 'secure-push/internal/logger' is not allowed from list 'Main' (depguard)
"secure-push/internal/reporters"

Check failure on line 13 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

import 'secure-push/internal/reporters' is not allowed from list 'Main' (depguard)
"secure-push/internal/scanner"

Check failure on line 14 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

import 'secure-push/internal/scanner' is not allowed from list 'Main' (depguard)
)

func main() {
Expand Down Expand Up @@ -53,7 +53,7 @@
fmt.Fprintln(os.Stderr, " -config string")
fmt.Fprintln(os.Stderr, " Path to configuration file")
fmt.Fprintln(os.Stderr, " -output string")
fmt.Fprintln(os.Stderr, " Output format: console, json, github (default \"console\")")
fmt.Fprintln(os.Stderr, " Output format: console, json, github, sarif, csv (default \"console\")")
fmt.Fprintln(os.Stderr, " -verbose")
fmt.Fprintln(os.Stderr, " Enable verbose logging")
}
Expand All @@ -63,7 +63,7 @@
configPath := scanFlags.String("config", "", "Path to configuration file")
outputFormat := scanFlags.String("output", "console", "Output format: console, json, github")
verbose := scanFlags.Bool("verbose", false, "Enable verbose logging")
scanFlags.Parse(args)

Check failure on line 66 in cmd/secure-push/main.go

View workflow job for this annotation

GitHub Actions / test (1.21)

Error return value of `scanFlags.Parse` is not checked (errcheck)

remainingArgs := scanFlags.Args()
if len(remainingArgs) == 0 {
Expand Down Expand Up @@ -108,6 +108,8 @@
reporter = &reporters.JSONReporter{}
case "github":
reporter = &reporters.GitHubReporter{}
case "sarif":
reporter = &reporters.SARIFReporter{}
case "csv":
reporter = reporters.NewCSVReporter("findings.csv")
default:
Expand Down
13 changes: 13 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ disable_detectors:
- CONFIG_FILE
```

### output_format

Output format for scan results.

- `console` - Human-readable console output (default)
- `json` - JSON format for programmatic processing
- `csv` - CSV format for spreadsheet import
- `sarif` - SARIF format for CI/CD integration

```yaml
output_format: sarif
```

## Environment Variables

| Variable | Description | Default |
Expand Down
33 changes: 32 additions & 1 deletion docs/detectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,44 @@ type Detector interface {

| Detector | Severity | Description |
|----------|----------|-------------|
| ENV_FILE | CRITICAL | Detects committed `.env` files |
| ENV_FILE | CRITICAL | Detects committed `.env` files and `.envrc` files |
| AWS_SECRET_KEY | CRITICAL | Detects AWS secret keys |
| GENERIC_API_KEY | HIGH | Detects generic API keys |
| HARDCODED_PASSWORD | CRITICAL | Detects hardcoded passwords |
| AUTH_CREDENTIALS | CRITICAL | Detects various auth credentials (GitHub tokens, SSH keys, etc.) |
| CONFIG_FILE | HIGH | Detects config files that may contain sensitive data |

### Auth Credentials Detector

The `AUTH_CREDENTIALS` detector identifies various authentication tokens and credentials:

- **AWS Access Keys**: `AKIAIOSFODNN7EXAMPLE`
- **GitHub Tokens**: `ghp_...`, `gho_...`, `ghu_...`, `ghs_...`, `ghr_...`
- **GitLab Tokens**: `glpat-...`
- **Google API Keys**: `AIza...`
- **Slack Tokens**: `xoxb-...`, `xoxa-...`, `xoxp-...`, `xoxr-...`, `xoxs-...`
- **Discord Webhooks**: `https://discord.com/api/webhooks/...`
- **Telegram Bot Tokens**: `1234567890:...`
- **Azure Key Vault**: `-----BEGIN AZURE KEY VAULT-----`
- **Personal Access Tokens**: Various formats
- **SSH/PGP Keys**: Private key headers
- **JWT Tokens**: JSON Web Tokens
- **Bearer Tokens**: Authorization headers
- **Basic Auth**: Base64 encoded credentials

### Secrets Detector

The `SECRETS` detector identifies:

- **Passwords**: `password = '...'`, `passwd = '...'`, `pwd = '...'`
- **API Keys**: `api_key = '...'`, `apikey = '...'`
- **Tokens**: `token = '...'`, `access_token = '...'`
- **Secrets**: `secret = '...'`, `client_secret = '...'`
- **Database URLs**: `postgres://...`, `mysql://...`, `mongodb://...`, `redis://...`, `mssql://...`, `oracle://...`
- **Connection Strings**: `server = '...'`, `data source = '...'`
- **High Entropy Strings**: Base64-like strings that may be secrets
- **Webhooks**: `webhook = 'https://...'`

## Creating a Custom Detector

1. Create a new file in `internal/detectors/`
Expand Down
55 changes: 55 additions & 0 deletions docs/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Reporter interface {
| JSON | Machine-readable JSON | CI/CD pipelines |
| GitHub | GitHub Actions annotation format | GitHub Actions |
| CSV | Comma-separated values | Data analysis, spreadsheets |
| SARIF | Static Analysis Results Interchange Format | CI/CD, GitHub Code Scanning, IDEs |

## Creating a Custom Reporter

Expand Down Expand Up @@ -119,3 +120,57 @@ func (r *CSVReporter) Report(findings []detectors.Finding) error {
```csv
Rule,Severity,File,Line,Message
ENV_FILE,CRITICAL,.env,1,.env file should not be committed
```

### SARIF Output

```json
{
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "Secure Push",
"version": "0.1.0",
"rules": [
{
"id": "ENV_FILE",
"shortDescription": {
"text": "ENV_FILE security issue detected"
},
"defaultConfiguration": {
"level": "error"
}
}
]
}
},
"results": [
{
"ruleId": "ENV_FILE",
"message": {
"text": ".env file should not be committed"
},
"locations": [
{
"id": 1,
"uri": ".env",
"properties": {
"line": 1
}
}
]
}
]
}
]
}
```

SARIF is the industry standard format for static analysis tools. It's supported by:
- GitHub Code Scanning
- Azure DevOps
- GitLab
- VS Code
- Many other CI/CD and IDE tools
Loading
Loading