Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix(ci): scan every released GOOS with gosec, not just linux

Darshan Jain2a54f59ec8cf
diff --git a/.github/workflows/reusable-go.yml b/.github/workflows/reusable-go.yml
index e656332b..6f33a459 100644
--- a/.github/workflows/reusable-go.yml
+++ b/.github/workflows/reusable-go.yml
@@ -115,8 +115,17 @@ jobs:
version: v2.10.1
security:
- name: Security Scan
+ # gosec loads packages through go/packages, which honours build constraints, so a
+ # single linux run never parses a //go:build windows or //go:build darwin file. The
+ # only two G204 sites in this repo live in internal/bridge/cleanup_windows.go, which
+ # means the rule this job fails on could not see the code that trips it. Scan every
+ # GOOS this project releases binaries for.
+ name: Security Scan (${{ matrix.goos }})
runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ goos: [linux, darwin, windows]
steps:
- uses: actions/checkout@v6
with:
@@ -130,12 +139,14 @@ jobs:
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run gosec
+ env:
+ GOOS: ${{ matrix.goos }}
run: gosec -exclude=G301,G302,G304,G306,G404,G107,G115,G703,G704,G705,G706 -fmt=json -out=gosec-results.json ./... || true
- name: Check critical findings
run: |
ISSUES=$(cat gosec-results.json | jq '[.Issues[] | select(.rule_id == "G112" or .rule_id == "G204")] | length')
- echo "Critical issues: $ISSUES"
+ echo "Critical issues (GOOS=${{ matrix.goos }}): $ISSUES"
cat gosec-results.json | jq '.Stats'
if [ "$ISSUES" -gt 0 ]; then
cat gosec-results.json | jq '.Issues[] | select(.rule_id == "G112" or .rule_id == "G204")'
diff --git a/internal/bridge/cleanup_windows.go b/internal/bridge/cleanup_windows.go
index fd3817a9..ae0b7263 100644
--- a/internal/bridge/cleanup_windows.go
+++ b/internal/bridge/cleanup_windows.go
@@ -45,6 +45,7 @@ func findPIDsByPowerShell(needle string) []int {
func taskkillPIDs(pids []int) int {
killed := 0
for _, pid := range pids {
+ // #nosec G204 -- pid is an int, not user-controlled string
cmd := exec.Command("taskkill", "/F", "/T", "/PID", strconv.Itoa(pid))
if cmd.Run() == nil {
killed++
@@ -76,6 +77,7 @@ func terminateChromeByProfileDir(profileDir string) int {
return 0
}
for _, pid := range pids {
+ // #nosec G204 -- pid is an int, not user-controlled string
cmd := exec.Command("taskkill", "/PID", strconv.Itoa(pid))
if err := cmd.Run(); err == nil {
slog.Info("cleanup: taskkill chrome process", "pid", pid)