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
9 changes: 9 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ClusterFuzzLite builder image, pinned to an immutable digest.
# See https://google.github.io/clusterfuzzlite/
FROM gcr.io/oss-fuzz-base/base-builder-go@sha256:ca966088ca6123e9c28321807fe102f2a55f7bcbf71eb016959ff6dbaec37219

# Source is mounted/copied by the ClusterFuzzLite action.
COPY . "$SRC/trace"
WORKDIR "$SRC/trace"

COPY .clusterfuzzlite/build.sh "$SRC/build.sh"
15 changes: 15 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -eu
# Build native Go fuzzers for ClusterFuzzLite.
# https://google.github.io/clusterfuzzlite/

cd "$SRC/trace"

go mod download

MODULE="github.com/laststate/trace"

# Build every native Go fuzz target in the module.
# `compile_go_fuzzer` is provided by the CFL base-builder-go image.
compile_go_fuzzer "$MODULE/internal/lep" FuzzValidate lep-fuzz-validate
compile_go_fuzzer "$MODULE/internal/lep" FuzzPayload lep-fuzz-payload
compile_go_fuzzer "$MODULE/internal/lep" FuzzParseTLVs lep-fuzz-parsetlvs
1 change: 1 addition & 0 deletions .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: go
35 changes: 35 additions & 0 deletions .github/workflows/cflite-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ClusterFuzzLite cron

# Batch fuzzing on a schedule. Read-only; pinned actions.

on:
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
fuzz-cron:
name: Fuzz batch
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
persist-credentials: false

- name: Build fuzzers
uses: google/clusterfuzzlite/actions/build-fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
with:
language: go
sanitizer: address

- name: Run fuzzers
uses: google/clusterfuzzlite/actions/run-fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
with:
fuzz-seconds: 300
sanitizer: address
34 changes: 34 additions & 0 deletions .github/workflows/cflite-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: ClusterFuzzLite PR

# Continuous fuzzing on pull requests. Read-only; pinned actions.

on:
pull_request:
branches: [main, master]

permissions:
contents: read

jobs:
fuzz-pr:
name: Fuzz PR
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
persist-credentials: false

- name: Build fuzzers
uses: google/clusterfuzzlite/actions/build-fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
with:
language: go
sanitizer: address

- name: Run fuzzers
uses: google/clusterfuzzlite/actions/run-fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
with:
fuzz-seconds: 60
sanitizer: address
42 changes: 34 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ on:
branches: [main, master]
pull_request:

# Least privilege: read-only by default; individual jobs opt in only where
# strictly required. Never use write-all / pull_request_target.
permissions:
contents: read

jobs:
go:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:16-alpine
# Pinned to an immutable digest (Scorecard Pinned-Dependencies).
image: postgres:16-alpine@sha256:f2f98726820d0342055351c6e9d36e705f5bfffb3dd53ff556325114b08afb6d
env:
POSTGRES_USER: trace
POSTGRES_PASSWORD: trace
Expand All @@ -22,8 +29,10 @@ jobs:
--health-timeout 3s
--health-retries 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# Single source of truth: go.mod (matches Dockerfile golang:1.26).
# check-latest resolves the newest patch of that minor line, so CI
Expand All @@ -33,6 +42,8 @@ jobs:
check-latest: true
- name: Vet
run: go vet ./...
- name: Format check
run: test -z "$(gofmt -l .)"
- name: Protocol LEP goldens (vendored)
run: go test ./internal/lep -run TestProtocolVectors -count=1 -v
- name: Test
Expand All @@ -56,7 +67,7 @@ jobs:
run: go build -o /tmp/trace ./cmd/trace
- name: Build production image
run: docker build --tag trace:ci .
- name: E2E ingest→process (in-process)
- name: E2E ingestprocess (in-process)
env:
TRACE_DATABASE_URL: postgres://trace:trace@localhost:5432/trace?sslmode=disable
run: go test ./internal/worker -run 'TestProcess' -count=1 -timeout 120s -v
Expand All @@ -77,7 +88,8 @@ jobs:
export TRACE_SECRETS_KEY=$(openssl rand -hex 32)
set -euo pipefail
# Create isolated database via the service container
docker run --rm --network host -e PGPASSWORD=trace postgres:16-alpine \
docker run --rm --network host -e PGPASSWORD=trace \
postgres:16-alpine@sha256:f2f98726820d0342055351c6e9d36e705f5bfffb3dd53ff556325114b08afb6d \
psql -h 127.0.0.1 -U trace -d postgres \
-c "DROP DATABASE IF EXISTS trace_e2e;" \
-c "CREATE DATABASE trace_e2e;"
Expand Down Expand Up @@ -119,17 +131,31 @@ jobs:
if [ -f "${{ runner.temp }}/trace-e2e.log" ]; then tail -n 80 "${{ runner.temp }}/trace-e2e.log" || true; fi
- name: govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
go install golang.org/x/vuln/cmd/govulncheck@ef4cb2f7cae47fe3e21fc596455f694951867b29 # v1.10.0
govulncheck ./...
- name: SBOM (syft, SPDX-JSON)
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
format: spdx-json
output-file: sbom.spdx.json
artifact-name: sbom-spdx-json
- name: Secret scan (gitleaks)
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
env:
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

frontend:
runs-on: ubuntu-latest
timeout-minutes: 25
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: "20"
cache: npm
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CodeQL

# Static application security testing (SAST). Read-only; uploads results to
# the GitHub Security tab. All actions pinned to a full commit SHA.

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: '0 7 * * 1'

permissions:
contents: read

jobs:
analyze:
name: Analyze (Go)
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
# Required to upload SARIF results to the Security tab.
security-events: write
# `actions: read` is needed for CodeQL to read prior run results.
actions: read
strategy:
fail-fast: false
matrix:
language: [go]
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: go.mod
check-latest: true

- name: Initialize CodeQL
uses: github/codeql-action/init@74c1aea9df7c0f02e9b7bfe4a8935abf2e5e3aa6 # v3
with:
languages: ${{ matrix.language }}
# Use the default security queries; build-mode: manual so we control
# the Go build. `go vet`/`go test` are separate CI gates.
build-mode: manual
queries: security-extended

- name: Build
run: go build ./...

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@74c1aea9df7c0f02e9b7bfe4a8935abf2e5e3aa6 # v3
6 changes: 4 additions & 2 deletions .github/workflows/package-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
- cron: '27 3 * * 0'
workflow_dispatch:
permissions:
packages: write
contents: read
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
packages: write
steps:
- uses: actions/delete-package-versions@v5.0.0
- uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
with:
package-name: trace
package-type: container
Expand Down
Loading
Loading