Skip to content

Commit 5e83c49

Browse files
Relu808claude
andcommitted
Merge origin/main into belay_main
Brings forward 16 commits from main while preserving the Belay-specific EPSS fetching changes that keep the deploy-time validation working. Adopted from main: - Migrate justfile/Makefile -> Taskfile.yml (commit f7832d0). Daily command is now `task build` instead of `just build`. Same lddflags, same outputs. Task additionally tracks sources/generates so rebuilds skip when nothing changed. - Bump go.mod from 1.22.1 -> 1.23.0 (toolchain go1.23.3). Side benefit: fixes the macOS Tahoe LC_UUID issue. No more GOTOOLCHAIN override needed when building locally on Darwin 25. - EPSS dataModel + modelDateLayout fixes (commit 3206bd1). Both branches independently arrived at v2025.03.14 / "2006-01-02T15:04:05Z", so the auto-merge handled these cleanly. - New CI workflows: test + lint (run-test.yaml, .golangci.yaml). - Bundle/lcov/validate package improvements. - New docs: cli-reference.md, examples.md, library-usage.md. cli-refactor.md removed. Preserved from belay_main (Belay webhook integration depends on these): - defaultEPSSBaseURL = empiricalsecurity.com (NOT main's cyentia.com). Cyentia is the old host that returns 403 without a User-Agent. Belay_main's commits c6c756a (URL migration) and 85263ec (User-Agent header) + 5c690ee (retry logic for today/yesterday fallback) are all kept. Dropped main's unused defaultEPSSURL constant. - .custom-gatecheck.yml with CVE metadata tag examples (eb0f811). - portage_user permission grants in Dockerfile (3eb6cd3). - "more intuitive" webhook auth env var name (a630025). Built and tested locally with `task build` + `task test`. Binary loads cleanly on macOS Tahoe with no toolchain override. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2 parents eb0f811 + 5c51756 commit 5e83c49

34 files changed

Lines changed: 681 additions & 437 deletions

.github/workflows/run-test.yaml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
1-
name: CICD
1+
name: Test and Lint
2+
23
on:
34
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
49
jobs:
5-
Describe:
10+
lint:
611
runs-on: ubuntu-latest
712
steps:
8-
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
9-
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
10-
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
11-
- name: Check out repository code
12-
uses: actions/checkout@v3
13-
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
14-
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
15-
- name: List files in the repository
16-
run: |
17-
ls ${{ github.workspace }}
18-
- run: echo "🍏 This job's status is ${{ job.status }}."
19-
test-unix:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: "1.23"
17+
cache: true
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v8
20+
- name: Install Task
21+
uses: arduino/setup-task@v2
22+
with:
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Run lint
25+
run: task lint
26+
27+
test:
2028
strategy:
2129
fail-fast: false
2230
matrix:
23-
platform:
24-
- ubuntu
25-
- macOS
26-
go:
27-
- 21
28-
name: '${{ matrix.platform }} | 1.${{ matrix.go }}.x'
29-
runs-on: ${{ matrix.platform }}-latest
31+
os: [ubuntu-latest, macos-latest, windows-latest]
32+
go: ["1.23"]
33+
name: "${{ matrix.os }} | ${{ matrix.go }}"
34+
runs-on: ${{ matrix.os }}
3035
steps:
31-
- uses: actions/checkout@v3
32-
- uses: actions/setup-go@v3
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-go@v5
3338
with:
34-
go-version: 1.${{ matrix.go }}.x
39+
go-version: ${{ matrix.go }}
3540
cache: true
36-
- run: |
37-
export GOBIN=$HOME/go/bin
38-
case "${{ matrix.go }}" in
39-
14|15) _version='';;
40-
*) _version='@latest';;
41-
esac
42-
go install github.com/kyoh86/richgo"${_version}"
43-
go install github.com/mitchellh/gox"${_version}"
44-
- run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin/:$PATH make test
41+
- name: Install Task
42+
uses: arduino/setup-task@v2
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Run tests
46+
run: task test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ book/
44
cover.cov
55
artifacts/
66
.env.local
7+
.task/

.golangci.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
linters:
2-
enable:
3-
- tagalign
4-
- gofumpt
5-
- gosimple
6-
- govet
7-
- ineffassign
1+
version: "2"

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [UNRELEASED]
99

10+
## [0.9.3] - 2026-03-21
11+
12+
* Merged upstream main
13+
* Minor build task fix
14+
15+
## [0.9.2] - 2025-03-29
16+
17+
* Enabled portage code scan
18+
* Switch to just recording the default (origin) remote URL, instead of 'owner'
19+
* added the owner or user of the submission so it can be validated against the jwt git info on the belay side
20+
* added logging for git context. Added config files for running portage on gatecheck.
21+
1022
## [0.9.1] - 2025-02-14
1123

1224
* portage config cleanup
@@ -18,11 +30,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1830
* added logging for git context. Added config files for running portage on gatecheck. (#5)
1931
* Improved Bundle Management (#4)
2032

33+
## [0.8.1] - 2025-04-09
34+
35+
### Fixed
36+
37+
- Updated EPSS schema to work with 3.14.2025
38+
2139
## [0.8.0] - 2024-10-23
2240

2341
* Fixed a bug where validation failures were not resulting in a non-zero exit code
2442
* Renamed the --file / -f CLI argument to --config / -f for consistency with other tools
25-
* improvements to validate output
43+
* improvements to validate output
2644
These "improvements" are short term hacks. There is a need for a fundamental
2745
overhaul of how output is generated to improve usability
2846
* Implemented code coverage support.

Makefile

Lines changed: 0 additions & 41 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Go Reference](https://pkg.go.dev/badge/github.com/gatecheckdev/gatecheck.svg)](https://pkg.go.dev/github.com/gatecheckdev/gatecheck)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/gatecheckdev/gatecheck)](https://goreportcard.com/report/github.com/gatecheckdev/gatecheck)
55

6-
76
![Gatecheck Logo](https://static.gatecheck.dev/gatecheck-logo-splash-dark.png)
87

98
Gatecheck automates report validation in a CI/CD Pipeline by comparing security findings to pre-determined thresholds.

RELEASE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ Releasing is done by maintainers with permissions to bypass the PR only rule.
44
By pushing a tag to the main repository, the release action is triggered which
55
packages the app and releases it to the GitHub UI.
66

7-
1. Run `just upgrade` to update dependencies and tidy modules
8-
1. Run `just test` to make sure unit testing still passes after upgrading
7+
1. Run `task upgrade` to update dependencies and tidy modules
8+
1. Run `task test` to make sure unit testing still passes after upgrading
99
1. Commit the changes `git commit -am "chore: upgrade dependencies"`
1010
1. Update CHANGELOG.md
11-
1. Release commit (optional) `git commit -m "release: vx.x.x" && git push`
12-
1. Wait for unit testing action to pass `gh run watch`
11+
1. Release commit (optional) `git commit -m "release: vx.x.x && git push`
1312
1. Release tag `git tag -s -a vX.X.X -m "Release version X.X.X"`
1413
1. git push tag `git push vX.X.X`
1514

Taskfile.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: "3"
2+
3+
env:
4+
INSTALL_DIR:
5+
sh: "echo ${INSTALL_DIR:-/usr/local/bin}"
6+
IMAGE_TAG: "gatecheck:latest"
7+
8+
tasks:
9+
build:
10+
desc: "Build the gatecheck binary"
11+
vars:
12+
BUILD_DATE: '{{dateInZone "2006-01-02T15:04:05Z" now "UTC"}}'
13+
CLI_VERSION:
14+
sh: git describe --tags || git rev-parse --short HEAD || "v0.0.0-unknown"
15+
GIT_COMMIT:
16+
sh: git rev-parse HEAD
17+
GIT_DESCRIPTION:
18+
sh: git log -1 --pretty=%B | sed "s/'//g"
19+
cmds:
20+
- mkdir -p bin
21+
- go build -ldflags="-X 'main.cliVersion={{.CLI_VERSION}}' -X 'main.gitCommit={{.GIT_COMMIT}}' -X 'main.buildDate={{.BUILD_DATE}}' -X 'main.gitDescription={{.GIT_DESCRIPTION}}'" -o ./bin ./cmd/gatecheck
22+
sources:
23+
- cmd/**/*
24+
- pkg/**/*
25+
- go.*
26+
generates:
27+
- bin/gatecheck
28+
29+
install:
30+
desc: "Install the gatecheck binary"
31+
prompt: 'Install gatecheck binary to {{joinPath .INSTALL_DIR "gatecheck"}} ...Continue?'
32+
deps:
33+
- build
34+
cmds:
35+
- cp ./bin/gatecheck {{joinPath .INSTALL_DIR "gatecheck"}}
36+
sources:
37+
- ./bin/gatecheck
38+
generates:
39+
- '{{joinPath .INSTALL_DIR "gatecheck"}}'
40+
41+
uninstall:
42+
desc: "Uninstall the gatecheck binary"
43+
prompt: 'Will remove binary {{joinPath .INSTALL_DIR "gatecheck"}}'
44+
cmds:
45+
- rm '{{joinPath .INSTALL_DIR "gatecheck"}}'
46+
47+
test:
48+
desc: "Run unit tests with coverage"
49+
cmds:
50+
- go test -cover ./...
51+
52+
lint:
53+
desc: "Run golangci-lint in view-only mode"
54+
cmds:
55+
- golangci-lint run
56+
57+
fix:
58+
desc: "Fix linting errors and format code"
59+
cmds:
60+
- golangci-lint run --fix
61+
62+
format:
63+
desc: "Check code formatting"
64+
cmds:
65+
- |
66+
if [ -n "$(gofmt -l .)" ]; then
67+
gofmt -d .
68+
exit 1
69+
fi
70+
71+
coverage:
72+
desc: "Generate test coverage"
73+
cmds:
74+
- go test -coverprofile=coverage.out ./...
75+
76+
open-coverage:
77+
desc: "Open coverage report in browser"
78+
deps: [coverage]
79+
cmds:
80+
- go tool cover -html=coverage.out
81+
82+
dependencies:
83+
desc: "Download dependencies"
84+
cmds:
85+
- go mod download
86+
87+
upgrade:
88+
desc: "Upgrade package dependencies"
89+
preconditions:
90+
- sh: git diff --quiet && git diff --cached --quiet
91+
msg: "Repository is dirty, commit changes before upgrading."
92+
cmds:
93+
- go get -u ./...
94+
- go mod tidy
95+
96+
serve-docs:
97+
desc: "Serve documentation locally"
98+
cmds:
99+
- mdbook serve
100+
101+
all:
102+
desc: "Run format, test, and build"
103+
deps: [format, test, build]
104+
105+
release-snapshot:
106+
desc: "Create a snapshot release"
107+
cmds:
108+
- goreleaser release --snapshot --rm-dist
109+
110+
release:
111+
desc: "Create a release"
112+
cmds:
113+
- goreleaser release --rm-dist
114+
115+
clean:
116+
desc: "Clean up build artifacts"
117+
cmds:
118+
- rm -rf ./bin coverage.out

cmd/cli-config.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ import (
1313
var (
1414
metadataFlagUsage = "flag_usage"
1515
metadataFieldType = "field_type"
16-
metadataRequired = "required"
1716
metadataActionInputName = "action_input_name"
17+
// metadataRequired = "required"
1818
)
1919

2020
type metaConfig struct {
21-
BundleTag configkit.MetaField
22-
EPSSURL configkit.MetaField
23-
KEVURL configkit.MetaField
24-
EPSSFilename configkit.MetaField
25-
KEVFilename configkit.MetaField
26-
Verbose configkit.MetaField
27-
Silent configkit.MetaField
28-
ConfigFilename configkit.MetaField
29-
Audit configkit.MetaField
30-
BundleTagValue []string
31-
bundleFile *os.File
32-
targetFile *os.File
33-
epssFile *os.File
34-
kevFile *os.File
35-
listSrcReader io.Reader
36-
listSrcName string
37-
listFormat string
38-
listAll bool
39-
configOutputWriter io.Writer
40-
configOutputFormat string
41-
gatecheckConfig *gatecheck.Config
21+
BundleTag configkit.MetaField
22+
EPSSURL configkit.MetaField
23+
KEVURL configkit.MetaField
24+
EPSSFilename configkit.MetaField
25+
KEVFilename configkit.MetaField
26+
Verbose configkit.MetaField
27+
Silent configkit.MetaField
28+
ConfigFilename configkit.MetaField
29+
Audit configkit.MetaField
30+
BundleTagValue []string
31+
bundleFile *os.File
32+
targetFile *os.File
33+
epssFile *os.File
34+
kevFile *os.File
35+
listSrcReader io.Reader
36+
listSrcName string
37+
listFormat string
38+
gatecheckConfig *gatecheck.Config
39+
// listAll bool
40+
// configOutputWriter io.Writer
41+
// configOutputFormat string
4242
}
4343

4444
var RuntimeConfig = metaConfig{

cmd/gatecheck/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717

1818
const (
1919
exitSystemFail int = -1
20-
exitOk = 0
21-
exitValidationFail = 1
22-
exitFileAccessFail = 2
20+
exitOk int = 0
21+
exitValidationFail int = 1
22+
exitFileAccessFail int = 2
2323
)
2424

2525
// GatecheckVersion see CHANGELOG.md
@@ -55,7 +55,7 @@ func run() int {
5555
command := cmd.NewGatecheckCommand()
5656

5757
err := command.Execute()
58-
if errors.Is(gatecheck.ErrValidationFailure, err) {
58+
if errors.Is(err, gatecheck.ErrValidationFailure) {
5959
return exitValidationFail
6060
}
6161
if err != nil {

0 commit comments

Comments
 (0)