暫無描述

trivy-dashboard.yml 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # This workflow uses actions that are not certified by GitHub.
  2. # They are provided by a third-party and are governed by
  3. # separate terms of service, privacy policy, and support
  4. # documentation.
  5. name: Trivy scan Wazuh dashboard
  6. on:
  7. release:
  8. types:
  9. - published
  10. pull_request:
  11. branches:
  12. - main
  13. schedule:
  14. - cron: '34 2 * * 1'
  15. workflow_dispatch:
  16. permissions:
  17. contents: read
  18. jobs:
  19. build:
  20. permissions:
  21. contents: read # for actions/checkout to fetch code
  22. security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
  23. name: Build images and upload Trivy results
  24. runs-on: "ubuntu-22.04"
  25. steps:
  26. - name: Checkout code
  27. uses: actions/checkout@v3
  28. - name: Installing dependencies
  29. run: |
  30. sudo apt-get update
  31. sudo apt-get install -y jq
  32. - name: Checkout latest tag
  33. run: |
  34. latest=$(curl -s "https://api.github.com/repos/wazuh/wazuh-docker/releases/latest" | jq -r '.tag_name')
  35. git fetch origin
  36. git checkout $latest
  37. - name: Build Wazuh images
  38. run: build-docker-images/build-images.sh
  39. - name: Create enviroment variables
  40. run: |
  41. cat .env > $GITHUB_ENV
  42. echo "GITHUB_REF_NAME="${GITHUB_REF_NAME%/*} >> $GITHUB_ENV
  43. - name: Run Trivy vulnerability scanner for Wazuh dashboard
  44. uses: aquasecurity/trivy-action@2a2157eb22c08c9a1fac99263430307b8d1bc7a2
  45. with:
  46. image-ref: 'wazuh/wazuh-dashboard:${{env.WAZUH_IMAGE_VERSION}}'
  47. format: 'template'
  48. template: '@/contrib/sarif.tpl'
  49. output: 'trivy-results-dashboard.sarif'
  50. severity: 'LOW,MEDIUM,CRITICAL,HIGH'
  51. - name: Upload Trivy scan results to GitHub Security tab
  52. uses: github/codeql-action/upload-sarif@v2
  53. with:
  54. sarif_file: 'trivy-results-dashboard.sarif'
  55. - name: Slack notification
  56. uses: rtCamp/action-slack-notify@v2
  57. env:
  58. SLACK_CHANNEL: cicd-monitoring
  59. SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
  60. #SLACK_ICON: https://github.com/rtCamp.png?size=48
  61. SLACK_MESSAGE: "Check the results: https://github.com/wazuh/wazuh-docker/security/code-scanning?query=is%3Aopen+branch%3A${{ env.GITHUB_REF_NAME }}"
  62. SLACK_TITLE: Wazuh docker Trivy vulnerability scan finished.
  63. SLACK_USERNAME: github_actions
  64. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}