Skip to content

ci: cost/correctness cleanup, security scanning, multi-arch image - #12

Merged
psimaker merged 3 commits into
mainfrom
ci/workflow-hardening
May 31, 2026
Merged

ci: cost/correctness cleanup, security scanning, multi-arch image#12
psimaker merged 3 commits into
mainfrom
ci/workflow-hardening

Conversation

@psimaker

@psimaker psimaker commented May 31, 2026

Copy link
Copy Markdown
Owner

CI cost & correctness (ci.yml)

  • Remove the redundant bridge-schema-regression job (its tests already run in go-tests) and drop it from build.needs.
  • Make vendor-patch.sh sed portable; move go-tests to ubuntu-latest (pure Go, ~10x cheaper).
  • Add timeout-minutes to every job; skip pipeline for docs-only changes; cache gomobile toolchain.

Security (security.yml + dependabot.yml, new)

  • gofmt + go vet gate; govulncheck for the go bridge (after make patch, sees the vendored Syncthing fork) and notify; weekly Trivy image scan.
  • Dependabot for go modules, GitHub Actions, and the notify Docker base. Patched syncthing/go-stun forks are ignored (2.x pseudo-version).
  • go/patches/README.md documents the upstream-advisory watch process for the gitignored, replace-shadowed forks.

Docker (docker.yml)

  • Multi-arch amd64+arm64, max provenance + SBOM attestations, Trivy scan of the built image by digest.

First CI run is the real integration test for the ubuntu/make-patch move and govulncheck.

This PR enhances CI/security infrastructure and Docker build pipelines without affecting runtime sync behavior.

Security & Vulnerability Scanning

  • Adds security workflow with static analysis gates (gofmt, go vet) and govulncheck scanning for Go code post-vendoring to catch vulnerabilities in patched dependencies
  • Introduces weekly Trivy image scans and post-build Trivy scanning of Docker images, failing on unfixed HIGH/CRITICAL vulnerabilities
  • Configures Dependabot to check Go modules, GitHub Actions, and Docker dependencies weekly, with exclusions for patched forks (syncthing/go-stun)
  • Documents upstream security advisory monitoring process for vendored/patched forks in go/patches/README.md

CI/Build Improvements

  • Moves Go tests to ubuntu-latest (cost reduction for pure Go tests while macOS/iOS tests remain on macOS)
  • Adds timeout-minutes to all jobs for resource protection
  • Caches gomobile toolchain to reduce build time
  • Makes vendor-patch.sh sed operations portable across Linux and macOS
  • Skips entire pipeline for documentation-only changes
  • Removes redundant bridge-schema-regression job dependency

Docker

  • Enables multi-architecture builds (linux/amd64 + linux/arm64) via QEMU and Buildx
  • Adds maximum provenance and SBOM attestations for built images

No changes to user-facing sync functionality or runtime behavior. Changes are infrastructure-focused with emphasis on supply chain security and cost optimization.

psimaker added 3 commits May 31, 2026 10:13
- Delete the bridge-schema-regression job: its six -run tests already run
  as part of `go test ./bridge` in go-tests, so it was a second 10x-priced
  macOS runner sitting on the critical path for zero added coverage.
- Make vendor-patch.sh sed portable (BSD `sed -i ''` -> grep -v temp file)
  so `make patch` runs on Linux as well as macOS.
- Move go-tests onto ubuntu-latest now that the patch step is portable and
  the bridge package is pure Go.
- Add timeout-minutes to every job (build 45) so a hung simulator/xcodebuild
  can't burn the 360-minute default at macOS pricing.
- Skip the pipeline for docs/markdown-only changes.
- Cache the gomobile toolchain in the build job.
- New Security workflow: a gofmt + go vet gate, govulncheck for the go
  bridge (run after `make patch` so it scans the vendored Syncthing fork)
  and for notify, plus a weekly Trivy scan of the published image.
- Dependabot for go modules, GitHub Actions, and the notify Docker base.
  The patched syncthing/go-stun forks are ignored (local replace-shadowed
  copies pinned to a 2.x pseudo-version Dependabot can't reason about).
- Document the upstream-advisory watch process for the gitignored,
  replace-shadowed forks (go/patches/README.md).
- gofmt the two files the new gate flags.
- Build linux/amd64 + linux/arm64 (pure CGO_ENABLED=0 Go, arm64 self-host
  is a real deploy target) via setup-qemu/buildx.
- Attach max build provenance + SBOM attestations (id-token/attestations).
- Scan the freshly built image by digest, failing on fixable HIGH/CRITICAL.
- Add timeout-minutes to both jobs.
@psimaker
psimaker merged commit b3ba00b into main May 31, 2026
5 of 7 checks passed
@psimaker
psimaker deleted the ci/workflow-hardening branch May 31, 2026 08:17
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b05e4f9-70b9-4862-a49b-f171ca5c1ca5

📥 Commits

Reviewing files that changed from the base of the PR and between d0b4364 and 6c44fb9.

📒 Files selected for processing (8)
  • .github/dependabot.yml
  • .github/workflows/ci.yml
  • .github/workflows/docker.yml
  • .github/workflows/security.yml
  • go/bridge/pendingfolders.go
  • go/patches/README.md
  • go/vendor-patch.sh
  • notify/main_test.go

📝 Walkthrough

Walkthrough

This PR establishes infrastructure for automated security scanning, CI/CD optimization, and dependency management. It adds Dependabot, fixes the vendor-patch script for cross-platform use, creates a comprehensive security workflow with gofmt/vet/govulncheck checks, optimizes the CI pipeline to skip doc-only changes and cache gomobile, and hardens Docker builds with provenance attestation, SBOM generation, and Trivy vulnerability scanning.

Changes

Security, CI/CD, and Dependency Management Infrastructure

Layer / File(s) Summary
Dependency management and patching workflow
.github/dependabot.yml, go/vendor-patch.sh, go/patches/README.md
Dependabot configuration for Go modules, GitHub Actions, and Docker at weekly intervals; vendor-patch.sh made cross-platform portable via temp-file rewrite instead of BSD sed -i ''; patched-module vendoring documented with release checklist and manual security review guidance.
CI pipeline optimization for Go testing
.github/workflows/ci.yml
Docs-only changes skip entire pipeline via paths-ignore; Go tests moved to ubuntu-latest and given explicit timeout; iOS/macOS build job simplified to depend only on go-tests; gomobile/gobind toolchain cached and installed conditionally.
Docker build security: provenance, SBOM, and image scanning
.github/workflows/docker.yml
Workflow permissions extended for attestation; notify-guard and build-and-push jobs gain timeouts and dependency ordering; QEMU and Buildx setup for multi-arch builds; Docker build enables provenance attestation and SBOM generation; Trivy scan added for published image digest with HIGH/CRITICAL gating.
Security workflow: gofmt, vet, govulncheck, and image scanning
.github/workflows/security.yml
New workflow triggers on push/PR/weekly schedule; gofmt gate for go/bridge, go vet for notify, two-job govulncheck coverage (with patched-dependency materialization for bridge); optional Trivy scan of GHCR image with HIGH/CRITICAL gating for non-PR events.
Code formatting and test spacing
go/bridge/pendingfolders.go, notify/main_test.go
PendingFolderInfo fields realigned for consistency; test file spacing adjusted between functions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes


Poem

🔐 Workflows now scan the depths below,
Patching scripts that cross platforms flow,
Dependencies tracked, from root to shore,
Security gates stand at every door! 🚀

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/workflow-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant