Add regression tests preventing committed tool binaries - #52540
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove committed actionlint and gosec binaries flagged out-of-context
Add regression tests preventing committed tool binaries
Aug 13, 2026
pelikhan
marked this pull request as ready for review
August 13, 2026 18:23
Contributor
There was a problem hiding this comment.
Pull request overview
Adds regression tests to prevent build-time tool binaries from being committed again.
Changes:
- Detects tracked tool binaries by basename.
- Verifies existing
.gitignoreprotections remain present.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/tracked_binaries_test.go |
Adds binary-tracking and ignore-entry regression tests. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| byName := make(map[string]string) | ||
| for file := range strings.SplitSeq(strings.TrimSuffix(string(output), "\x00"), "\x00") { | ||
| if file != "" { | ||
| byName[filepath.Base(file)] = file |
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CodeQL alert #653 (
workflow-out-of-context) flagged pre-builtactionlint(~8MB) andgosec(~69MB) binaries committed to git history — assessed as accidental local build artifacts. Verification shows the remediation is already in place; what was missing is anything preventing it from recurring.Current state (verified, no changes needed)
git ls-filesreturns no match, in the root or any subdirectory..gitignorealready lists/actionlintand/gosec.toolstarget runsgo install github.com/rhysd/actionlint/cmd/actionlintandgo install github.com/securego/gosec/v2/cmd/gosec;security-gosecrunsgo tool gosec;make actionlintshells out to./gh-aw compile --actionlint.Added:
pkg/cli/tracked_binaries_test.goTestNoToolBinariesTracked— enumerates tracked paths viagit ls-files -zand fails if any basename matches a build-time tool (actionlint,gosec,govulncheck,golangci-lint,gopls). Basename matching catches a binary dropped in a subdirectory, not just the repo root.TestToolBinariesGitignored— asserts the/actionlintand/gosecentries survive future.gitignoreedits.Both follow existing conventions in the package:
//go:build !integration,testify, and skip (rather than fail) when git or the repo root is unavailable.Out of scope
Purging the blobs from historical commits requires a history rewrite and force-push to
main, which is a maintainer decision and cannot be done from this PR. The alert's threat assessment (4/10, accidental, provenance matches upstreamgosec v2.27.1) suggests removal from the tree is likely sufficient, but that call is yours.