Security #358
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
| name: Security | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| - "LICENSE" | |
| - ".github/copilot-instructions.md" | |
| - ".github/dependabot.yml" | |
| pull_request: | |
| # Run lightweight security checks on PRs; heavy checks run on main only | |
| types: [opened, synchronize, reopened] | |
| schedule: | |
| # Weekly security sweep (Monday 03:00 UTC) | |
| - cron: "0 3 * * 1" | |
| permissions: | |
| contents: read | |
| env: | |
| GOFLAGS: -buildvcs=false | |
| jobs: | |
| security: | |
| name: Govulncheck + Gosec (light) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| ZTAP_SECURITY_SKIP_TESTS: "1" | |
| ZTAP_SECURITY_SKIP_VET: "1" | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Cache security tools | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/bin | |
| key: security-tools-${{ runner.os }}-govulncheck-v1.1.4-gosec-v2.22.11 | |
| - name: Run scripted security checks | |
| run: | | |
| chmod +x scripts/security_check.sh | |
| ./scripts/security_check.sh | |
| security-deep: | |
| name: Trivy + SARIF upload (main only) | |
| runs-on: ubuntu-24.04 | |
| if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') | |
| timeout-minutes: 20 | |
| permissions: | |
| security-events: write | |
| contents: read | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Run Trivy filesystem scan and upload SARIF | |
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 | |
| with: | |
| scan-type: fs | |
| scan-ref: . | |
| format: sarif | |
| output: trivy-results.sarif | |
| continue-on-error: true | |
| - name: Upload SARIF to GitHub | |
| uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 | |
| with: | |
| sarif_file: trivy-results.sarif | |
| continue-on-error: true |