Skip to content

ci: adding security scans #14

ci: adding security scans

ci: adding security scans #14

Workflow file for this run

name: Security
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '26 21 * * 3'
permissions:
contents: read
jobs:
# Static Application Security Testing (SAST) - gosec
gosec:
name: Go Security Check
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run gosec
run: gosec ./...
# Software Composition Analysis (SCA) - Go vulnerability check
govulncheck:
name: Go Vulnerability Check
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck
run: govulncheck ./...
# Secret scanning - Gitleaks
gitleaks:
name: Secret Scanning
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gitleaks
run: |
GITLEAKS_VERSION=$(curl -s https://api.github.com/repos/gitleaks/gitleaks/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//')
curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" | tar -xz
sudo mv gitleaks /usr/local/bin/
- name: Run Gitleaks
run: gitleaks detect --source . --verbose
# Binary artifact scanning - Trivy on built binary
trivy:
name: Binary Vulnerability Scan
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Build binary
run: go build -o terraform-provider-orynetwork .
- name: Run Trivy filesystem scan
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'table'
exit-code: '1'
severity: 'CRITICAL,HIGH'
scanners: 'vuln,secret,misconfig'
env:
TRIVY_SKIP_JAVA_DB_UPDATE: 'true'
TRIVY_DISABLE_VEX_NOTICE: 'true'
# Dependency license compliance
licenses:
name: License Check
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Install go-licenses
run: go install github.com/google/go-licenses@latest
- name: Check licenses
run: go-licenses check ./... --disallowed_types=forbidden,restricted