mirror of
https://github.com/lunchcat/sif.git
synced 2026-07-30 23:40:13 -07:00
ci: overhaul workflows - lint, security scanning, release hardening
- add golangci-lint job to go.yml (parallel with build+test) - add Go 1.23/1.24 version matrix, coverage only on 1.24 - upgrade setup-go@v4 to v5, codecov@v4 to v5 across all workflows - fix check-large-files bug (find|while never exits 1), exclude .git/ - add concurrency groups to push+PR workflows (no duplicate runs) - lowercase all workflow names to match project voice - add gosec, errorlint, gocognit, nilnil, wastedassign, usetesting linters - remove deprecated exportloopref (Go 1.22 fixed loop var capture) - new: govulncheck.yml - Go vuln scanner with call-graph analysis - new: scorecard.yml - OpenSSF supply chain scorecard - new: dependabot.yml - auto-update Go deps + Actions versions - release: SHA256 checksums + SBOM generation for all artifacts - add CODEOWNERS
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
* @vmfunc
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gomod
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
labels:
|
||||||
|
- deps
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
labels:
|
||||||
|
- deps
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Automatic Rebase
|
name: automatic rebase
|
||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Automatic Rebase
|
- name: automatic rebase
|
||||||
uses: cirrus-actions/rebase@1.8
|
uses: cirrus-actions/rebase@1.8
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,18 +1,26 @@
|
|||||||
name: Check Large Files
|
name: check large files
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-large-files:
|
check-large-files:
|
||||||
name: Check for large files
|
name: check for large files
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Check for large files
|
- name: check for large files
|
||||||
run: |
|
run: |
|
||||||
find . -type f -size +5M | while read file; do
|
large_files=$(find . -path ./.git -prune -o -type f -size +5M -print)
|
||||||
|
if [ -n "$large_files" ]; then
|
||||||
|
echo "$large_files" | while read -r file; do
|
||||||
echo "::error file=${file}::File ${file} is larger than 5MB"
|
echo "::error file=${file}::File ${file} is larger than 5MB"
|
||||||
done
|
done
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Qodana
|
name: qodana
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -6,6 +6,10 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
qodana:
|
qodana:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: "Dependency Review"
|
name: dependency review
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
@@ -7,16 +7,20 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dependency-review:
|
dependency-review:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout Repository"
|
- name: checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: "Dependency Review"
|
- name: dependency review
|
||||||
uses: actions/dependency-review-action@v4
|
uses: actions/dependency-review-action@v4
|
||||||
continue-on-error: ${{ github.event_name == 'push' }}
|
continue-on-error: ${{ github.event_name == 'push' }}
|
||||||
- name: "Check Dependency Review Outcome"
|
- name: check dependency review outcome
|
||||||
if: github.event_name == 'push' && failure()
|
if: github.event_name == 'push' && failure()
|
||||||
run: |
|
run: |
|
||||||
echo "::warning::Dependency review failed. Please check the dependencies for potential issues."
|
echo "::warning::Dependency review failed. Please check the dependencies for potential issues."
|
||||||
|
|||||||
@@ -1,24 +1,47 @@
|
|||||||
name: Go
|
name: go
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: set up go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.24"
|
go-version: "1.24"
|
||||||
- name: Build
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v6
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ["1.23", "1.24"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: set up go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: build
|
||||||
run: make
|
run: make
|
||||||
- name: Run tests with coverage
|
- name: run tests with coverage
|
||||||
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
||||||
- name: Upload coverage to Codecov
|
- name: upload coverage to codecov
|
||||||
uses: codecov/codecov-action@v4
|
if: matrix.go-version == '1.24'
|
||||||
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
files: ./coverage.out
|
files: ./coverage.out
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: false
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: govulncheck
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
schedule:
|
||||||
|
- cron: "0 6 * * 1" # monday 06:00 UTC
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
govulncheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: set up go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.24"
|
||||||
|
- name: install govulncheck
|
||||||
|
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
- name: run govulncheck
|
||||||
|
run: govulncheck ./...
|
||||||
|
continue-on-error: true
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Mind your language
|
name: mind your language
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types:
|
types:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Markdown Lint
|
name: markdown lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
name: Misspell Check
|
name: misspell check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
misspell:
|
misspell:
|
||||||
name: runner / misspell
|
name: runner / misspell
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Release
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -19,28 +19,28 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: set up go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.24"
|
go-version: "1.24"
|
||||||
|
|
||||||
- name: Build for Windows
|
- name: build for windows
|
||||||
run: |
|
run: |
|
||||||
GOOS=windows GOARCH=amd64 go build -o sif-windows-amd64.exe ./cmd/sif
|
GOOS=windows GOARCH=amd64 go build -o sif-windows-amd64.exe ./cmd/sif
|
||||||
GOOS=windows GOARCH=386 go build -o sif-windows-386.exe ./cmd/sif
|
GOOS=windows GOARCH=386 go build -o sif-windows-386.exe ./cmd/sif
|
||||||
|
|
||||||
- name: Build for macOS
|
- name: build for macOS
|
||||||
run: |
|
run: |
|
||||||
GOOS=darwin GOARCH=amd64 go build -o sif-macos-amd64 ./cmd/sif
|
GOOS=darwin GOARCH=amd64 go build -o sif-macos-amd64 ./cmd/sif
|
||||||
GOOS=darwin GOARCH=arm64 go build -o sif-macos-arm64 ./cmd/sif
|
GOOS=darwin GOARCH=arm64 go build -o sif-macos-arm64 ./cmd/sif
|
||||||
|
|
||||||
- name: Build for Linux
|
- name: build for linux
|
||||||
run: |
|
run: |
|
||||||
GOOS=linux GOARCH=amd64 go build -o sif-linux-amd64 ./cmd/sif
|
GOOS=linux GOARCH=amd64 go build -o sif-linux-amd64 ./cmd/sif
|
||||||
GOOS=linux GOARCH=386 go build -o sif-linux-386 ./cmd/sif
|
GOOS=linux GOARCH=386 go build -o sif-linux-386 ./cmd/sif
|
||||||
GOOS=linux GOARCH=arm64 go build -o sif-linux-arm64 ./cmd/sif
|
GOOS=linux GOARCH=arm64 go build -o sif-linux-arm64 ./cmd/sif
|
||||||
|
|
||||||
- name: Package releases with modules
|
- name: package releases with modules
|
||||||
run: |
|
run: |
|
||||||
for binary in sif-linux-amd64 sif-linux-386 sif-linux-arm64 sif-macos-amd64 sif-macos-arm64; do
|
for binary in sif-linux-amd64 sif-linux-386 sif-linux-arm64 sif-macos-amd64 sif-macos-arm64; do
|
||||||
mkdir -p "dist/${binary}"
|
mkdir -p "dist/${binary}"
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
cd dist && zip -r "../${binary}.zip" "${binary}" && cd ..
|
cd dist && zip -r "../${binary}.zip" "${binary}" && cd ..
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Build Debian packages
|
- name: build debian packages
|
||||||
run: |
|
run: |
|
||||||
VERSION="0.1.0-$(git rev-parse --short HEAD)"
|
VERSION="0.1.0-$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
@@ -94,10 +94,29 @@ jobs:
|
|||||||
dpkg-deb --build "${pkg_dir}"
|
dpkg-deb --build "${pkg_dir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Set release version
|
- name: generate checksums
|
||||||
|
run: |
|
||||||
|
sha256sum \
|
||||||
|
sif-windows-amd64.zip \
|
||||||
|
sif-windows-386.zip \
|
||||||
|
sif-macos-amd64.tar.gz \
|
||||||
|
sif-macos-arm64.tar.gz \
|
||||||
|
sif-linux-amd64.tar.gz \
|
||||||
|
sif-linux-386.tar.gz \
|
||||||
|
sif-linux-arm64.tar.gz \
|
||||||
|
sif_*.deb \
|
||||||
|
> checksums-sha256.txt
|
||||||
|
|
||||||
|
- name: generate SBOM
|
||||||
|
uses: anchore/sbom-action@v0
|
||||||
|
with:
|
||||||
|
artifact-name: sbom.spdx.json
|
||||||
|
output-file: sbom.spdx.json
|
||||||
|
|
||||||
|
- name: set release version
|
||||||
run: echo "RELEASE_VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Create Release and Upload Assets
|
- name: create release and upload assets
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: automated-release-${{ env.RELEASE_VERSION }}
|
tag_name: automated-release-${{ env.RELEASE_VERSION }}
|
||||||
@@ -120,12 +139,10 @@ jobs:
|
|||||||
- Debian/Ubuntu (32-bit): `sif_*_i386.deb`
|
- Debian/Ubuntu (32-bit): `sif_*_i386.deb`
|
||||||
- Debian/Ubuntu (64-bit ARM): `sif_*_arm64.deb`
|
- Debian/Ubuntu (64-bit ARM): `sif_*_arm64.deb`
|
||||||
|
|
||||||
## Installation
|
## Verification
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tar -xzf sif-linux-amd64.tar.gz
|
sha256sum -c checksums-sha256.txt
|
||||||
cd sif-linux-amd64
|
|
||||||
./sif -h
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For more details, check the [commit history](https://github.com/${{ github.repository }}/commits/main).
|
For more details, check the [commit history](https://github.com/${{ github.repository }}/commits/main).
|
||||||
@@ -142,10 +159,12 @@ jobs:
|
|||||||
sif_*_amd64.deb
|
sif_*_amd64.deb
|
||||||
sif_*_i386.deb
|
sif_*_i386.deb
|
||||||
sif_*_arm64.deb
|
sif_*_arm64.deb
|
||||||
|
checksums-sha256.txt
|
||||||
|
sbom.spdx.json
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Push to Cloudsmith
|
- name: push to cloudsmith
|
||||||
env:
|
env:
|
||||||
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
|
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Update Report Card
|
name: update report card
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -7,10 +7,14 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-report-card:
|
update-report-card:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Update Go Report Card
|
- name: update go report card
|
||||||
uses: creekorful/goreportcard-action@v1.0
|
uses: creekorful/goreportcard-action@v1.0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Functional Test
|
name: functional test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -12,13 +12,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: set up go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.24"
|
go-version: "1.24"
|
||||||
- name: Build Sif
|
- name: build sif
|
||||||
run: make
|
run: make
|
||||||
- name: Run Sif with features
|
- name: run sif with features
|
||||||
run: |
|
run: |
|
||||||
./sif -u https://example.com -dnslist small -dirlist small -dork -git -whois -cms -framework
|
./sif -u https://example.com -dnslist small -dirlist small -dork -git -whois -cms -framework
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Test module system
|
- name: test module system
|
||||||
run: |
|
run: |
|
||||||
echo "Listing modules..."
|
echo "Listing modules..."
|
||||||
./sif -lm
|
./sif -lm
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
name: scorecard
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
schedule:
|
||||||
|
- cron: "0 6 * * 1" # monday 06:00 UTC
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: run scorecard
|
||||||
|
uses: ossf/scorecard-action@v2.4.0
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
publish_results: true
|
||||||
|
- name: upload sarif results
|
||||||
|
uses: github/codeql-action/upload-sarif@v3
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Shell Check
|
name: shell check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: YAML Lint
|
name: yaml lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
+12
-1
@@ -13,7 +13,12 @@ linters:
|
|||||||
- prealloc # slice preallocation hints
|
- prealloc # slice preallocation hints
|
||||||
- bodyclose # http response body not closed
|
- bodyclose # http response body not closed
|
||||||
- noctx # http requests without context
|
- noctx # http requests without context
|
||||||
- exportloopref # loop variable capture
|
- gosec # security issues
|
||||||
|
- errorlint # error wrapping and comparison
|
||||||
|
- gocognit # cognitive complexity
|
||||||
|
- nilnil # return nil, nil
|
||||||
|
- wastedassign # assignments to variables never read
|
||||||
|
- usetesting # os.Setenv in tests instead of t.Setenv, etc.
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
govet:
|
govet:
|
||||||
@@ -29,6 +34,12 @@ linters-settings:
|
|||||||
- diagnostic
|
- diagnostic
|
||||||
- style
|
- style
|
||||||
- performance
|
- performance
|
||||||
|
gosec:
|
||||||
|
excludes:
|
||||||
|
- G104 # errcheck covers this
|
||||||
|
- G304 # sif reads user-supplied wordlist paths — intentional
|
||||||
|
gocognit:
|
||||||
|
min-complexity: 30
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
|
|||||||
Reference in New Issue
Block a user