-
Notifications
You must be signed in to change notification settings - Fork 1
UID2-4528 Report faillures on scheduled vulnerability detection runs #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
caroline-ttd
merged 99 commits into
main
from
ccm-UID2-4528-report-faillures-on-scheduled-vulnerability-detection-runs
Mar 11, 2025
Merged
Changes from all commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
a8eadbf
test vulnerability_scan notification
caroline-ttd 80caef1
Test
caroline-ttd 2816229
test
caroline-ttd 5e81892
test
caroline-ttd c2e56ca
Test
caroline-ttd 1fa74e7
Test
caroline-ttd 6bd31e7
Remove slack_webhook required
caroline-ttd a705781
Test
caroline-ttd 6b110e5
Test
caroline-ttd 57f9ff1
test
caroline-ttd d7f630d
test
caroline-ttd 8d269f7
Test
caroline-ttd e3f2d68
temporary remove unit test section
caroline-ttd c065be3
Test
caroline-ttd 82b2970
Test
caroline-ttd 88438f3
Test
caroline-ttd 43c607c
Test
caroline-ttd b98349d
Test
caroline-ttd 96a1372
Test
caroline-ttd fcd168c
Test
caroline-ttd f7217d6
Test
caroline-ttd 7c67c79
Test
caroline-ttd f4f488e
Test
caroline-ttd a9b3b28
Test
caroline-ttd d95d549
Test
caroline-ttd 54ab9a5
Test
caroline-ttd 5b846d0
Test
caroline-ttd f020ccf
Test
caroline-ttd 98aa1d4
Test
caroline-ttd 0ab9d2e
Test
caroline-ttd 4502a2b
Test
caroline-ttd 0227dc0
Test
caroline-ttd 4e49295
Test
caroline-ttd abd0ec4
Test
caroline-ttd 7e5e268
Test
caroline-ttd ec11662
Test
caroline-ttd 383463c
Test
caroline-ttd 29f9ff9
Test
caroline-ttd b6cf603
Test
caroline-ttd 42eb047
Test
caroline-ttd 2dfc98c
Test
caroline-ttd 0e9c0a3
Test
caroline-ttd ac36165
Test
caroline-ttd face50b
Revert changes
caroline-ttd c80a679
Test
caroline-ttd e9372cb
Test
caroline-ttd 679dd9f
Test
caroline-ttd ded61fc
Test
caroline-ttd 811e4dd
Test
caroline-ttd 5ef77c6
Test
caroline-ttd 9dca2c3
Test
caroline-ttd d87481b
Test
caroline-ttd f3bb41f
Test
caroline-ttd 46ac416
Test
caroline-ttd 996b81b
Test
caroline-ttd 3bd8741
Test
caroline-ttd d7fafe1
Test
caroline-ttd a5a437d
Test
caroline-ttd 39c0d6d
Test
caroline-ttd 68124c6
Test
caroline-ttd ae6d3a6
Test
caroline-ttd da18ab5
Test
caroline-ttd 5e0f968
Test
caroline-ttd 7d707c8
Test
caroline-ttd 047e9fc
Test
caroline-ttd c4d8dc0
Test
caroline-ttd 074ac1d
Test
caroline-ttd 36e15d9
Test
caroline-ttd e4658f2
Test
caroline-ttd fc35df4
Test
caroline-ttd d05bbc0
Test
caroline-ttd c29f3c6
Test
caroline-ttd a1d6961
Test
caroline-ttd 67a6803
Test
caroline-ttd 70037ac
Test
caroline-ttd 0dc1ad7
Test
caroline-ttd 728ecf5
Test
caroline-ttd 911c4b3
Test
caroline-ttd 50468f5
Test
caroline-ttd 0e35248
Test
caroline-ttd e5ab91a
Test
caroline-ttd 4fe1add
Test
caroline-ttd f9c1bf6
Test
caroline-ttd 414bb49
Test
caroline-ttd 1729ebe
Test
caroline-ttd c1bd671
Test
caroline-ttd a23270e
Test
caroline-ttd 25980af
Test
caroline-ttd 4e17877
Test
caroline-ttd d8495d1
Test
caroline-ttd d264090
Test
caroline-ttd f1a4785
Test
caroline-ttd eecf6e2
Test
caroline-ttd 6aed551
Test
caroline-ttd 567a419
Test
caroline-ttd c0e4815
Test
caroline-ttd 0639c61
Remove fs scan yaml
caroline-ttd f718dcd
Change scan_severity
caroline-ttd c6d49e3
Update slack message
caroline-ttd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
.github/workflows/shared-vulnerability-scan-failure-notify.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: Vulnerability Scan Failure Notification | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| java_version: | ||
| description: The version of Java to use to compile the JAR. Defaults to 11 | ||
| type: string | ||
| default: '11' | ||
| vulnerability_severity: | ||
| description: The severity that will cause the action to fail if a vulnerability at that level is detected. UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL | ||
| default: CRITICAL,HIGH | ||
| type: string | ||
| publish_vulnerabilities: | ||
| description: If true, will attempt to publish the results to the GitHub security tab | ||
| default: 'false' | ||
| type: string | ||
| scan_type: | ||
| description: The scan-type for aquasecurity/trivy-action action. Default to a fs scan. | ||
| default: fs | ||
| type: string | ||
| platform: | ||
| description: The OS runner to execute the vulnerability scan (e.g., ubuntu-latest, macos-latest, windows-latest). | ||
| default: 'ubuntu-latest' | ||
| type: string | ||
| skip_tests: | ||
| description: If true, will skip tests when packaging JAR. Defaults to false. Set to true for test-only repos. | ||
| type: boolean | ||
| default: false | ||
| working_dir: | ||
| description: The path to the pom.xml and Dockerfile. | ||
| type: string | ||
| default: '.' | ||
| secrets: | ||
| SLACK_WEBHOOK: | ||
| required: false | ||
|
|
||
| jobs: | ||
| vulnerability_scan: | ||
| runs-on: ${{ inputs.platform }} | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout uid2-shared-actions repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: v3 | ||
| repository: IABTechLab/uid2-shared-actions | ||
| path: uid2-shared-actions | ||
|
|
||
| - name: Set up JDK | ||
| if: inputs.scan_type == 'image' | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: ${{ inputs.java_version }} | ||
|
|
||
| - name: Package JAR | ||
| if: inputs.scan_type == 'image' | ||
| id: package | ||
| run: | | ||
| pushd ${{ inputs.working_dir }} | ||
| if [[ "${{ inputs.skip_tests }}" == "false" ]]; then | ||
| mvn -B package -P default | ||
| else | ||
| mvn -B package -P default -DskipTests | ||
| fi | ||
| echo "jar_version=$(mvn help:evaluate -Dexpression=project.version | grep -e '^[1-9][^\[]')" >> $GITHUB_OUTPUT | ||
| echo "git_commit=$(git show --format="%h" --no-patch)" >> $GITHUB_OUTPUT | ||
| popd | ||
|
|
||
| - name: Extract metadata for Docker | ||
| if: inputs.scan_type == 'image' | ||
| id: meta | ||
| run: echo "tags=${{ steps.package.outputs.jar_version }}-${{ steps.package.outputs.git_commit }}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build Docker image | ||
| if: inputs.scan_type == 'image' | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ${{inputs.working_dir}} | ||
| load: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| build-args: | | ||
| JAR_VERSION=${{ steps.package.outputs.jar_version }} | ||
| IMAGE_VERSION=${{ steps.package.outputs.jar_version }}-${{ steps.package.outputs.git_commit }} | ||
|
|
||
| - name: Vulnerability Scan | ||
| id: vulnerability-scan | ||
| uses: IABTechLab/uid2-shared-actions/actions/vulnerability_scan@v3 | ||
| with: | ||
| scan_severity: ${{ inputs.vulnerability_severity }} | ||
| failure_severity: ${{ inputs.vulnerability_severity }} | ||
| publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }} | ||
| image_ref: ${{ steps.meta.outputs.tags }} | ||
| scan_type: ${{ inputs.scan_type }} | ||
| continue-on-error: true | ||
|
|
||
| - name: Notify Slack on Vulnerability Scan Failure | ||
| if: ${{ steps.vulnerability-scan.outcome == 'failure' }} | ||
| env: | ||
| SLACK_COLOR: danger | ||
| SLACK_MESSAGE: ':x: Vulnerability scan failed. Please review details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}. Check past alerts before acting and log new actions to avoid duplicate efforts.' | ||
| SLACK_TITLE: Vulnerability Scan Failure | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
| uses: rtCamp/action-slack-notify@v2 | ||
|
|
||
| - name: Fail Workflow if Vulnerability Scan step Fails | ||
| if: ${{ steps.vulnerability-scan.outcome == 'failure' }} | ||
| shell: bash | ||
| run: | | ||
| echo "Failing the workflow due to vulnerability scan failure" | ||
| exit 1 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.