Skip to content

Commit 028a7f1

Browse files
north-echoclaude
andcommitted
feat: fluxgate v0.1.0 — CI/CD pipeline security scanner
Static analysis tool for GitHub Actions workflows detecting dangerous security patterns including the Pwn Request misconfiguration (FG-001) that enabled the Trivy supply chain compromise. - 5 detection rules (FG-001 through FG-005) - Local, remote, and batch scanning modes - JSON, SARIF, and table output formats - SQLite storage for batch research with resume support - Markdown report generation for aggregate findings - Exponential backoff retry for GitHub API rate limits Signed-off-by: Christopher Lusk <christopherdlusk@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit 028a7f1

33 files changed

+2713
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
21+
with:
22+
go-version-file: go.mod
23+
24+
- name: Run tests
25+
run: go test ./...
26+
27+
- name: Run vet
28+
run: go vet ./...
29+
30+
- name: Build
31+
run: go build ./cmd/fluxgate

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Binary
2+
fluxgate
3+
dist/
4+
5+
# SQLite databases
6+
*.db
7+
*.db-wal
8+
*.db-shm
9+
10+
# Editor/OS
11+
.DS_Store
12+
*.swp
13+
*.swo
14+
*~
15+
.idea/
16+
.vscode/
17+
18+
# Test artifacts
19+
test-report.md
20+
test-repos.txt

.goreleaser.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: 2
2+
3+
builds:
4+
- id: fluxgate
5+
main: ./cmd/fluxgate
6+
binary: fluxgate
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
- darwin
12+
goarch:
13+
- amd64
14+
- arm64
15+
ldflags:
16+
- -s -w
17+
- -X main.version={{.Version}}
18+
- -X main.commit={{.Commit}}
19+
- -X main.date={{.Date}}
20+
21+
archives:
22+
- id: fluxgate
23+
format: tar.gz
24+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
25+
26+
checksum:
27+
name_template: "checksums.txt"
28+
29+
changelog:
30+
sort: asc
31+
filters:
32+
exclude:
33+
- "^docs:"
34+
- "^test:"
35+
- "^chore:"

CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing to Fluxgate
2+
3+
Thank you for your interest in contributing to Fluxgate.
4+
5+
## Getting Started
6+
7+
1. Fork the repository and clone your fork.
8+
2. Ensure you have Go 1.22 or later installed.
9+
3. Run `go mod download` to fetch dependencies.
10+
11+
## Development Workflow
12+
13+
### Run Tests
14+
15+
```bash
16+
go test ./...
17+
```
18+
19+
### Format Code
20+
21+
```bash
22+
gofmt -w .
23+
```
24+
25+
### Vet Code
26+
27+
```bash
28+
go vet ./...
29+
```
30+
31+
### Build
32+
33+
```bash
34+
go build ./cmd/fluxgate
35+
```
36+
37+
## Submitting Changes
38+
39+
1. Create a feature branch from `main`.
40+
2. Make your changes, ensuring all tests pass.
41+
3. Format your code with `gofmt`.
42+
4. Write clear commit messages.
43+
5. Open a pull request against `main`.
44+
45+
## Adding Detection Rules
46+
47+
New rules should:
48+
- Follow the existing rule function signature in `internal/scanner/rules.go`.
49+
- Include a unique rule ID (e.g., `FG-006`).
50+
- Have corresponding test fixtures in `test/fixtures/`.
51+
- Include unit tests in `internal/scanner/rules_test.go`.
52+
53+
## Code of Conduct
54+
55+
Be respectful and constructive. We are all working toward safer CI/CD pipelines.
56+
57+
## License
58+
59+
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.

Containerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM docker.io/library/golang:1.22-bookworm AS builder
2+
WORKDIR /build
3+
COPY go.mod go.sum ./
4+
RUN go mod download
5+
COPY . .
6+
RUN CGO_ENABLED=1 go build -o fluxgate ./cmd/fluxgate
7+
8+
FROM docker.io/library/debian:bookworm-slim
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
ca-certificates sqlite3 && rm -rf /var/lib/apt/lists/*
11+
COPY --from=builder /build/fluxgate /usr/local/bin/fluxgate
12+
ENTRYPOINT ["fluxgate"]

DISCLOSURE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Fluxgate Responsible Disclosure Protocol
2+
3+
When Fluxgate's batch scanning identifies vulnerable workflows in
4+
public repositories, we follow this responsible disclosure process:
5+
6+
## Timeline
7+
1. **Day 0:** Finding identified during batch scan
8+
2. **Day 1-3:** Finding verified manually (not a false positive)
9+
3. **Day 3-7:** Maintainer contacted via:
10+
- Repository SECURITY.md contact (preferred)
11+
- Security advisory on the repository (if enabled)
12+
- Direct email to listed maintainers (fallback)
13+
4. **Day 7:** Confirmation of receipt requested
14+
5. **Day 37:** If no response, second notification attempt
15+
6. **Day 67:** Public disclosure of aggregate statistics
16+
(vulnerable repos are NOT named if unpatched)
17+
18+
## What We Disclose Publicly
19+
- Aggregate statistics (X of Y repos affected)
20+
- Rule descriptions and detection logic
21+
- Example vulnerable patterns (synthetic, not from real repos)
22+
- Remediation guidance
23+
24+
## What We Do NOT Disclose Publicly
25+
- Names of affected repositories (until patched or 90-day window expires)
26+
- Specific workflow file contents from unpatched repos
27+
- Details that would enable exploitation
28+
29+
## Exceptions
30+
- If a vulnerability is already being actively exploited in the wild
31+
(as with the Trivy compromise), we may accelerate the timeline
32+
- If a maintainer requests extended time, we will accommodate up to
33+
180 days for complex remediations
34+
35+
## Contact
36+
If you believe Fluxgate has identified a vulnerability in your
37+
repository and you'd like to coordinate, contact:
38+
christopherdlusk@gmail.com or open a GitHub Security Advisory.

0 commit comments

Comments
 (0)