Refactor S3 versioning type usage in bucket tests #12
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
| # Security Scanning Workflow | |
| # Runs comprehensive security scans on a schedule and PR | |
| name: Security | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| # Run daily at 3 AM UTC | |
| - cron: "0 3 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| dependency-scan: | |
| name: Dependency Scan | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: Run govulncheck | |
| run: | | |
| go install golang.org/x/vuln/cmd/govulncheck@latest | |
| govulncheck -format json ./... > govulncheck-results.json || true | |
| - name: Convert to SARIF (govulncheck) | |
| if: always() | |
| run: | | |
| cat > convert_govulncheck.py << 'EOF' | |
| import json | |
| import sys | |
| data = {"version": "2.1.0", "runs": [{"tool": {"driver": {"name": "govulncheck"}}, "results": []}]} | |
| try: | |
| with open('govulncheck-results.json') as f: | |
| result = json.load(f) | |
| if result and result.get('Vulnerabilities'): | |
| for vuln in result['Vulnerabilities']: | |
| data["runs"][0]["results"].append({ | |
| "message": {"text": vuln.get('Advisory', 'Unknown vulnerability')}, | |
| "level": "warning" | |
| }) | |
| except: | |
| pass | |
| with open('govulncheck-results.sarif', 'w') as f: | |
| json.dump(data, f) | |
| EOF | |
| python3 convert_govulncheck.py | |
| - name: Upload govulncheck results | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: govulncheck-results.sarif | |
| category: govulncheck | |
| wait-for-processing: false | |
| sast: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Gosec | |
| continue-on-error: true | |
| run: | | |
| go install github.com/securego/gosec/v2/cmd/gosec@latest | |
| gosec -fmt sarif -out gosec-results.sarif -exclude-generated ./... || true | |
| - name: Upload Gosec results | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: gosec-results.sarif | |
| category: gosec | |
| wait-for-processing: false | |
| secrets-scan: | |
| name: Secrets Scan | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run TruffleHog | |
| continue-on-error: true | |
| uses: trufflesecurity/trufflehog@main | |
| with: | |
| path: ./ | |
| base: ${{ github.event.repository.default_branch }} | |
| extra_args: --only-verified | |
| container-scan: | |
| name: Container Scan | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build image | |
| run: docker build -t alexander:scan . || true | |
| - name: Run Trivy vulnerability scanner | |
| continue-on-error: true | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| image-ref: "alexander:scan" | |
| format: "sarif" | |
| output: "trivy-container-results.sarif" | |
| severity: "CRITICAL,HIGH,MEDIUM" | |
| vuln-type: "os,library" | |
| - name: Upload Trivy scan results | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: trivy-container-results.sarif | |
| category: trivy-container | |
| wait-for-processing: false | |
| iac-scan: | |
| name: Infrastructure as Code Scan | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Checkov | |
| continue-on-error: true | |
| uses: bridgecrewio/checkov-action@master | |
| with: | |
| directory: deploy/ | |
| framework: kubernetes,helm,terraform | |
| skip_check: "CKV_AWS_79,CKV_AWS_88,CKV_AWS_337,CKV_AWS_290,CKV_AWS_355,CKV_AWS_382,CKV_AWS_23,CKV_TF_1,CKV_HELM_35,CKV_K8S_27" | |
| soft_fail: true | |
| license-scan: | |
| name: License Compliance | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: Run go-licenses | |
| continue-on-error: true | |
| run: | | |
| go install github.com/google/go-licenses@latest | |
| go-licenses check ./... --disallowed_types=forbidden,restricted || true | |
| go-licenses report ./... > licenses.csv || true | |
| - name: Upload license report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: license-report | |
| path: licenses.csv | |
| report: | |
| name: Security Report | |
| runs-on: ubuntu-latest | |
| needs: [dependency-scan, sast, secrets-scan, container-scan, iac-scan, license-scan] | |
| if: always() | |
| steps: | |
| - name: Generate summary | |
| run: | | |
| echo "## Security Scan Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Scan | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Dependency Scan | ✅ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| SAST (Gosec) | ✅ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Secrets Scan (TruffleHog) | ✅ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Container Scan (Trivy) | ✅ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| IaC Scan (Checkov) | ✅ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| License Compliance | ✅ |" >> $GITHUB_STEP_SUMMARY |