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
5 changes: 5 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM gcr.io/oss-fuzz-base/base-builder-go@sha256:ca966088ca6123e9c28321807fe102f2a55f7bcbf71eb016959ff6dbaec37219
WORKDIR /src
COPY . /src
COPY .clusterfuzzlite/build.sh /build.sh
RUN chmod +x /build.sh
8 changes: 8 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -eu
# ClusterFuzzLite build scaffolding for LEP Go fuzz targets.
# Fuzz targets are `FuzzXxx` in implementations/go/lep/*_test.go.
# Locally, `go test -fuzz=FuzzValidate -fuzztime=30s ./lep` works in
# implementations/go. OSS-Fuzz/ClusterFuzzLite Go builds use the gofuzz
# builder; this is scaffolding, not a verified remote CFL run.
cd /src/implementations/go
# `go test -fuzz=FuzzValidate -fuzztime=30s ./lep` works locally.
5 changes: 5 additions & 0 deletions .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: go
fuzzing_engines:
- libfuzzer
sanitizers:
- address
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ updates:
directory: /implementations/go
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /tools/genvectors
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,42 @@ jobs:
run:
working-directory: implementations/go
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
go-version: '1.26.x'
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.27.x'
cache-dependency-path: implementations/go/go.sum
- name: gofmt check
run: test -z "$(gofmt -l .)"
- run: go vet ./...
- run: go test ./...

genvectors:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tools/genvectors
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.27.x'
cache-dependency-path: tools/genvectors/go.sum
- name: gofmt check
run: test -z "$(gofmt -l .)"
- run: go vet ./...
- run: go test ./...

conformance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.12'
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ on:
schedule:
- cron: '23 4 * * 1'

# Least privilege: read-only by default; only this job may write security events.
permissions:
contents: read
security-events: write

jobs:
analyze:
if: github.event.repository.private == false
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
language: [go, python]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: github/codeql-action/init@v3
# Pinned to a full commit SHA. No untrusted checkout on pull_request_target
# (pull_request_target is not used here). persist-credentials: false.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
with:
languages: ${{ matrix.language }}
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
- uses: github/codeql-action/autobuild@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
- uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
4 changes: 3 additions & 1 deletion .github/workflows/consumer-vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
verify-vendored:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.12'
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Package

# Packaging scaffolding for the Go module. Does NOT publish to a registry.
# Go modules are distributed by git tags. See PACKAGING.md.
on:
push:
tags: ['v*', 'implementations/go/v*']

permissions:
contents: read

jobs:
package:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.27.x'
cache-dependency-path: implementations/go/go.sum
- name: Verify module
working-directory: implementations/go
run: |
go vet ./...
go test ./...
go mod verify
- name: Package scaffolding (no registry publish)
run: |
echo "Go module: github.com/laststate/protocol/implementations/go"
echo "Distribute via git tag vX.Y.Z and implementations/go/vX.Y.Z."
echo "No package registry publish in this scaffolding job."
102 changes: 97 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ name: Release
on:
push:
tags: ['v*']

# Least privilege by default; only specific jobs elevate.
permissions:
contents: read

jobs:
verify-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.26.x'
go-version: '1.27.x'
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.12'
Expand All @@ -30,26 +34,41 @@ jobs:
- name: Run reference codec tests
working-directory: implementations/go
run: go test ./...
- name: Run genvectors tests
working-directory: tools/genvectors
run: go test ./...

test:
needs: verify-tag
uses: ./.github/workflows/ci.yml

publish:
needs: [verify-tag, test]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Bundle vectors and spec
shell: bash
run: |
mkdir -p dist
tar -czf "dist/lep-${GITHUB_REF_NAME}-vectors.tar.gz" \
VERSION test-vectors spec registry
(cd dist && sha256sum * > checksums.sha256)
(cd dist && sha256sum lep-*.tar.gz > checksums.sha256)
- name: Compute base64 subjects for SLSA provenance
id: hash
shell: bash
run: |
cd dist
HASHES=$(sha256sum lep-*.tar.gz checksums.sha256 | base64 -w0)
echo "hashes=$HASHES" >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v2
with:
Expand All @@ -63,3 +82,76 @@ jobs:
dist/checksums.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# SBOM generation + attach-to-release scaffolding. anchore/sbom-action pinned.
# Produces CycloneDX + SPDX. Local `syft` output sbom.cdx.json/sbom.spdx.json
# is already generated in-repo; this job reproduces it in CI and attaches it
# to the release. Not verified remote; scaffolding only.
sbom:
needs: [verify-tag, test]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
format: cyclonedx-json
output-file: sbom.cdx.json
- uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
format: spdx-json
output-file: sbom.spdx.json
- name: Attach SBOM to release (scaffolding)
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v2
with:
tag_name: ${{ github.ref_name }}
files: |
sbom.cdx.json
sbom.spdx.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# SLSA build provenance. slsa-github-generator is pinned to a full commit SHA.
# NOTE: SLSA level canNOT be earned locally; it requires a real remote run on
# a pushed tag. This job produces signed in-toto provenance as an artifact and
# uploads it to the release when run remotely. We do not claim any level here.
# See SIGNING.md and BEST-PRACTICES-EVIDENCE.md.
provenance:
needs: [verify-tag, test, publish]
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a # v2.1.0
with:
base64-subjects: ${{ needs.publish.outputs.hashes }}
upload-assets: true
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Sigstore keyless signing scaffolding for release artifacts. No key is
# committed; signing requires a remote run with id-token: write. We do NOT
# claim signed releases from a local run.
sign:
needs: [publish]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4
- name: Sign release artifacts (scaffolding)
shell: bash
run: |
set -euo pipefail
echo "Scaffolding: download release artifacts, then for each artifact:"
echo " cosign sign-blob --yes --output-signature <artifact>.sig <artifact>"
echo "Signed tags: create with 'git tag -s v<version>' or gitsign; verify with"
echo " git verify-tag v<version> or cosign verify-blob ..."
echo "No key material is committed; keyless sigstore uses id-token OIDC."
47 changes: 47 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Scorecard

# OpenSSF Scorecard. Runs on push to main + schedule.
# NOTE: `pull_request_target` is intentionally NOT added; it is unsafe with
# untrusted checkout. `pull_request` is not added either so results are only
# produced from the trusted main branch.

on:
push:
branches: [main]
schedule:
- cron: '23 7 * * 1'

# Least privilege. Scorecard's own docs suggest `read-all`; we scope explicitly.
permissions: read-all

jobs:
scorecard:
name: Scorecard
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
security-events: write
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Pinned to a full commit SHA (v2.6.0).
- uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.sarif
results_format: sarif
# publish_results publishes the Scorecard badge/results to the
# OpenSSF API. It requires a remote run on `main` with
# `id-token: write` AND `publish_results: true`, and the workflow must
# not be named `scorecard` in a way that blocks OIDC. Local
# `scorecard --local` CANNOT publish a badge; we keep this false here
# and do not claim any earned badge. To publish, set true in a real
# pushed run. See BEST-PRACTICES-EVIDENCE.md.
publish_results: false

- uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
- cron: '13 7 * * 0'
workflow_dispatch:
permissions:
contents: read
issues: write
pull-requests: write
jobs:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ implementations/go/vendor/
*.test
coverage
*.out

# build outputs / CI artifacts
dist/
results.sarif
*.sarif

7 changes: 7 additions & 0 deletions .well-known/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Contact: https://github.com/laststate/protocol/security/advisories/new
Expires: 2027-12-03T00:00:00.000Z
Preferred-Languages: en
# NOTE: This file is committed for completeness. This repository does not
# itself serve a web site; if a web site is served, publish this at
# https://<domain>/.well-known/security.txt. A `security@` contact requires a
# valid MX record and a human responder (org-gated; not asserted here).
Loading