Skip to content

Commit 06b9072

Browse files
shahidhkclaude
andcommitted
Add security scan job for PRs and branch pushes
- New security-scan job runs on all PRs and branch pushes - Builds Docker image locally and scans with Trivy - Uploads results to Security Agent - Fails on HIGH/CRITICAL vulnerabilities Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1829371 commit 06b9072

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/ndc-python-lambda-connector.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,55 @@ jobs:
8585
path: ./connector-definition/dist
8686
compression-level: 0 # Already compressed
8787

88+
security-scan:
89+
name: Build and scan Docker image
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Set up Docker Buildx
95+
uses: docker/setup-buildx-action@v3
96+
97+
- name: Build Docker image
98+
uses: docker/build-push-action@v6
99+
with:
100+
context: .
101+
load: true
102+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}
103+
104+
- name: Run Trivy vulnerability scanner (json output)
105+
uses: aquasecurity/trivy-action@0.32.0
106+
with:
107+
image-ref: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}
108+
format: json
109+
output: trivy-results.json
110+
scanners: vuln
111+
112+
- name: Upload Trivy scan results to Security Agent
113+
uses: hasura/security-agent-tools/upload-file@v1
114+
with:
115+
file_path: trivy-results.json
116+
security_agent_api_key: ${{ secrets.SECURITY_AGENT_API_KEY }}
117+
tags: |
118+
service=ndc-python-lambda
119+
source_code_path=.
120+
docker_file_path=Dockerfile
121+
scanner=trivy
122+
image_name=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}
123+
product_domain=hasura-ddn-data-plane,promptql-data-plane
124+
team=engine
125+
126+
- name: Fail build on High/Critical Vulnerabilities
127+
uses: aquasecurity/trivy-action@0.32.0
128+
with:
129+
skip-setup-trivy: true
130+
image-ref: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}
131+
format: table
132+
severity: CRITICAL,HIGH
133+
scanners: vuln
134+
ignore-unfixed: true
135+
exit-code: 1
136+
88137
build-and-push-docker:
89138
name: Build and push Docker image
90139
needs: build-connector

0 commit comments

Comments
 (0)