Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ cli-docs
site
/pipeleak
/pipeleak.exe
/pipeleak-gitlab
/pipeleak-gitlab.exe
/pipeleak-github
/pipeleak-github.exe
/pipeleak-bitbucket
/pipeleak-bitbucket.exe
/pipeleak-devops
/pipeleak-devops.exe
/pipeleak-gitea
/pipeleak-gitea.exe
coverage.out
coverage.html
.vscode
Expand Down
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The fastest way to start contributing is using GitHub Codespaces:
3. Click "Create codespace on main" (or your branch)

The codespace will automatically:

- Set up Go 1.24+ environment
- Install golangci-lint for code linting
- Install Python and MkDocs for documentation
Expand All @@ -32,22 +33,31 @@ If you prefer local development:
### Setup Steps

1. Clone the repository:

```bash
git clone https://github.com/CompassSecurity/pipeleak.git
cd pipeleak
```

2. Install golangci-lint:

```bash
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
```

3. Download dependencies:

```bash
go mod download
```

4. Build the binary:
4. Run it:

```bash
go run cmd/pipeleak/main.go
```

5. Optional: Build the binary:
```bash
make build
```
Expand Down
64 changes: 52 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,60 @@
.PHONY: help build test test-unit test-e2e lint clean coverage coverage-html serve-docs
.PHONY: help build build-all build-gitlab build-github build-bitbucket build-devops build-gitea test test-unit test-e2e lint clean coverage coverage-html serve-docs

# Default target
help:
@echo "Pipeleak Makefile"
@echo ""
@echo "Available targets:"
@echo " make build - Build the pipeleak binary"
@echo " make test - Run all tests (unit + e2e)"
@echo " make test-unit - Run unit tests only"
@echo " make test-e2e - Run e2e tests (builds binary first)"
@echo " make coverage - Generate test coverage report"
@echo " make coverage-html - Generate and open HTML coverage report"
@echo " make lint - Run golangci-lint"
@echo " make serve-docs - Generate and serve CLI documentation"
@echo " make clean - Remove built artifacts"

# Build the pipeleak binary
@echo " make build - Build the main pipeleak binary"
@echo " make build-all - Build all binaries (main + platform-specific)"
@echo " make build-gitlab - Build GitLab-specific binary"
@echo " make build-github - Build GitHub-specific binary"
@echo " make build-bitbucket - Build BitBucket-specific binary"
@echo " make build-devops - Build Azure DevOps-specific binary"
@echo " make build-gitea - Build Gitea-specific binary"
@echo " make test - Run all tests (unit + e2e)"
@echo " make test-unit - Run unit tests only"
@echo " make test-e2e - Run e2e tests (builds binary first)"
@echo " make coverage - Generate test coverage report"
@echo " make coverage-html - Generate and open HTML coverage report"
@echo " make lint - Run golangci-lint"
@echo " make serve-docs - Generate and serve CLI documentation"
@echo " make clean - Remove built artifacts"

# Build the main pipeleak binary
build:
@echo "Building pipeleak..."
go build -o pipeleak ./cmd/pipeleak

# Build GitLab-specific binary
build-gitlab:
@echo "Building pipeleak-gitlab..."
go build -o pipeleak-gitlab ./cmd/pipeleak-gitlab

# Build GitHub-specific binary
build-github:
@echo "Building pipeleak-github..."
go build -o pipeleak-github ./cmd/pipeleak-github

# Build BitBucket-specific binary
build-bitbucket:
@echo "Building pipeleak-bitbucket..."
go build -o pipeleak-bitbucket ./cmd/pipeleak-bitbucket

# Build Azure DevOps-specific binary
build-devops:
@echo "Building pipeleak-devops..."
go build -o pipeleak-devops ./cmd/pipeleak-devops

# Build Gitea-specific binary
build-gitea:
@echo "Building pipeleak-gitea..."
go build -o pipeleak-gitea ./cmd/pipeleak-gitea

# Build all binaries
build-all: build build-gitlab build-github build-bitbucket build-devops build-gitea
@echo "All binaries built successfully"

# Run all tests
test: test-unit test-e2e

Expand Down Expand Up @@ -96,4 +131,9 @@ serve-docs: build
clean:
@echo "Cleaning up..."
rm -f pipeleak pipeleak.exe coverage.out coverage.html
rm -f pipeleak-gitlab pipeleak-gitlab.exe
rm -f pipeleak-github pipeleak-github.exe
rm -f pipeleak-bitbucket pipeleak-bitbucket.exe
rm -f pipeleak-devops pipeleak-devops.exe
rm -f pipeleak-gitea pipeleak-gitea.exe
go clean -cache -testcache
28 changes: 28 additions & 0 deletions cmd/pipeleak-bitbucket/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/CompassSecurity/pipeleak/internal/cmd/bitbucket"
"github.com/CompassSecurity/pipeleak/internal/cmd/common"
"github.com/spf13/cobra"
)

func main() {
common.Run(newRootCmd())
}

func newRootCmd() *cobra.Command {
bbCmd := bitbucket.NewBitBucketRootCmd()
bbCmd.Use = "pipeleak-bitbucket"
bbCmd.Short = "Scan BitBucket Pipelines logs and artifacts for secrets"
bbCmd.Long = `Pipeleak-BitBucket scans CI/CD logs and artifacts to detect leaked secrets and pivot from them.`
bbCmd.Version = common.Version
bbCmd.GroupID = ""

common.SetupPersistentPreRun(bbCmd)
common.AddCommonFlags(bbCmd)

bbCmd.SetVersionTemplate(`{{.Version}}
`)

return bbCmd
}
28 changes: 28 additions & 0 deletions cmd/pipeleak-devops/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/CompassSecurity/pipeleak/internal/cmd/common"
"github.com/CompassSecurity/pipeleak/internal/cmd/devops"
"github.com/spf13/cobra"
)

func main() {
common.Run(newRootCmd())
}

func newRootCmd() *cobra.Command {
adCmd := devops.NewAzureDevOpsRootCmd()
adCmd.Use = "pipeleak-devops"
adCmd.Short = "Scan Azure DevOps Pipelines logs and artifacts for secrets"
adCmd.Long = `Pipeleak-DevOps scans CI/CD logs and artifacts to detect leaked secrets and pivot from them.`
adCmd.Version = common.Version
adCmd.GroupID = ""

common.SetupPersistentPreRun(adCmd)
common.AddCommonFlags(adCmd)

adCmd.SetVersionTemplate(`{{.Version}}
`)

return adCmd
}
28 changes: 28 additions & 0 deletions cmd/pipeleak-gitea/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/CompassSecurity/pipeleak/internal/cmd/common"
"github.com/CompassSecurity/pipeleak/internal/cmd/gitea"
"github.com/spf13/cobra"
)

func main() {
common.Run(newRootCmd())
}

func newRootCmd() *cobra.Command {
giteaCmd := gitea.NewGiteaRootCmd()
giteaCmd.Use = "pipeleak-gitea"
giteaCmd.Short = "Scan Gitea Actions logs and artifacts for secrets"
giteaCmd.Long = `Pipeleak-Gitea scans CI/CD logs and artifacts to detect leaked secrets and pivot from them.`
giteaCmd.Version = common.Version
giteaCmd.GroupID = ""

common.SetupPersistentPreRun(giteaCmd)
common.AddCommonFlags(giteaCmd)

giteaCmd.SetVersionTemplate(`{{.Version}}
`)

return giteaCmd
}
28 changes: 28 additions & 0 deletions cmd/pipeleak-github/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/CompassSecurity/pipeleak/internal/cmd/common"
"github.com/CompassSecurity/pipeleak/internal/cmd/github"
"github.com/spf13/cobra"
)

func main() {
common.Run(newRootCmd())
}

func newRootCmd() *cobra.Command {
ghCmd := github.NewGitHubRootCmd()
ghCmd.Use = "pipeleak-github"
ghCmd.Short = "Scan GitHub Actions logs and artifacts for secrets"
ghCmd.Long = `Pipeleak-GitHub scans CI/CD logs and artifacts to detect leaked secrets and pivot from them.`
ghCmd.Version = common.Version
ghCmd.GroupID = ""

common.SetupPersistentPreRun(ghCmd)
common.AddCommonFlags(ghCmd)

ghCmd.SetVersionTemplate(`{{.Version}}
`)

return ghCmd
}
28 changes: 28 additions & 0 deletions cmd/pipeleak-gitlab/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/CompassSecurity/pipeleak/internal/cmd/common"
"github.com/CompassSecurity/pipeleak/internal/cmd/gitlab"
"github.com/spf13/cobra"
)

func main() {
common.Run(newRootCmd())
}

func newRootCmd() *cobra.Command {
glCmd := gitlab.NewGitLabRootCmd()
glCmd.Use = "pipeleak-gitlab"
glCmd.Short = "Scan GitLab CI/CD logs and artifacts for secrets"
glCmd.Long = `Pipeleak-GitLab scans CI/CD logs and artifacts to detect leaked secrets and pivot from them.`
glCmd.Version = common.Version
glCmd.GroupID = ""

common.SetupPersistentPreRun(glCmd)
common.AddCommonFlags(glCmd)

glCmd.SetVersionTemplate(`{{.Version}}
`)

return glCmd
}
81 changes: 78 additions & 3 deletions goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: 2
project_name: pipeleak
builds:
-
id: "pipeleak"
- id: "pipeleak"
main: ./cmd/pipeleak
binary: pipeleak
goos:
Expand All @@ -15,4 +14,80 @@ builds:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd.Date={{.Date}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd.Date={{.Date}}
# Platform-specific builds - only built on release (tagged builds)
- id: "pipeleak-gitlab"
skip: "{{ .IsSnapshot }}"
main: ./cmd/pipeleak-gitlab
binary: pipeleak-gitlab
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Date={{.Date}}
- id: "pipeleak-github"
skip: "{{ .IsSnapshot }}"
main: ./cmd/pipeleak-github
binary: pipeleak-github
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Date={{.Date}}
- id: "pipeleak-bitbucket"
skip: "{{ .IsSnapshot }}"
main: ./cmd/pipeleak-bitbucket
binary: pipeleak-bitbucket
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Date={{.Date}}
- id: "pipeleak-devops"
skip: "{{ .IsSnapshot }}"
main: ./cmd/pipeleak-devops
binary: pipeleak-devops
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Date={{.Date}}
- id: "pipeleak-gitea"
skip: "{{ .IsSnapshot }}"
main: ./cmd/pipeleak-gitea
binary: pipeleak-gitea
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Version={{.Version}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Commit={{.Commit}}
- -X github.com/CompassSecurity/pipeleak/internal/cmd/common.Date={{.Date}}
Loading