Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Python Security scan
push:
branches:
- main
- private/harsh/soc2-scan
pull_request:

jobs:
Expand Down Expand Up @@ -81,6 +80,17 @@ jobs:
base: ${{ github.ref_name }}
delete-branch: true

- name: Close Stale Vulnerability PR (if clean)
if: ${{ github.event_name == 'push' && steps.scan.outputs.bandit_high_found == 'false' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="auto/bandit-scan/${{ env.SAFE_REF_NAME }}"
PR_NUMBER=$(gh pr list --repo "${{ github.repository }}" --head "$BRANCH" --state open --json number --jq '.[0].number // empty')
if [[ -n "$PR_NUMBER" ]]; then
gh pr close "$PR_NUMBER" --repo "${{ github.repository }}" --comment "No HIGH/CRITICAL vulnerabilities found in latest scan on \`${{ github.ref_name }}\`. Closing report."
fi

- name: Fail Job If Vulnerabilities Found
if: ${{ steps.scan.outputs.bandit_high_found == 'true' }}
run: exit 1
Expand All @@ -100,7 +110,7 @@ jobs:

- name: Install Trivy
env:
TRIVY_VERSION: 0.69.3
TRIVY_VERSION: 0.70.0
run: |
wget -qO trivy.deb "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.deb"
sudo dpkg -i trivy.deb
Expand Down Expand Up @@ -167,6 +177,17 @@ jobs:
base: ${{ github.ref_name }}
delete-branch: true

- name: Close Stale Vulnerability PR (if clean)
if: ${{ github.event_name == 'push' && steps.scan.outputs.trivy_issues_found == 'false' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="auto/trivy-scan/${{ env.SAFE_REF_NAME }}"
PR_NUMBER=$(gh pr list --repo "${{ github.repository }}" --head "$BRANCH" --state open --json number --jq '.[0].number // empty')
if [[ -n "$PR_NUMBER" ]]; then
gh pr close "$PR_NUMBER" --repo "${{ github.repository }}" --comment "No HIGH/CRITICAL vulnerabilities found in latest scan on \`${{ github.ref_name }}\`. Closing report."
fi

- name: Fail Job If Vulnerabilities Found
if: ${{ steps.scan.outputs.trivy_issues_found == 'true' }}
run: exit 1
Loading