diff --git a/.github/workflows/devsecops.yml b/.github/workflows/devsecops.yml new file mode 100644 index 00000000..e9acb818 --- /dev/null +++ b/.github/workflows/devsecops.yml @@ -0,0 +1,561 @@ +name: Complete DevSecOps workflow with Trivy security scanning + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + workflow_dispatch: + inputs: + scan_severity: + description: 'Severity levels to scan' + required: false + default: 'LOW,MEDIUM,HIGH,CRITICAL' + type: string + +env: + IMAGE_NAME: breakableflask + TRIVY_VERSION: "0.50.0" + +jobs: + # ============================================ + # JOB 1: Scan des dépendances + # ============================================ + Dependances: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create reports directory + run: mkdir -p reports + + - name: Run Trivy vulnerability scanner on filesystem + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + scan-ref: '.' + format: 'json' + output: 'reports/trivy-fs-report.json' + severity: 'LOW,MEDIUM,HIGH,CRITICAL' + scanners: 'vuln,secret,config' + continue-on-error: true + + - name: Generate HTML report for dependencies + run: | + cat > reports/trivy-fs-report.html << 'EOF' + + +
+ + +Projet: ${{ github.repository }}
+Branche: ${{ github.ref_name }}
+Commit: ${{ github.sha }}
+Scanner: Trivy - Filesystem Scan
+ +Ce rapport contient les resultats de l'analyse des dependances du projet.
+Consultez le fichier JSON associe pour les details complets.
+ + +Analyse complete des vulnerabilites avec Trivy
+Les statistiques detaillees sont disponibles dans les fichiers JSON joints a cet artefact.
+trivy-image-report.json - Rapport complet au format JSONtrivy-image-report.txt - Rapport en tableau lisibletrivy-image-report.html - Ce rapport HTMLtrivy-config-report.json - Analyse de configuration Dockerfiletrivy-image-results.sarif - Format SARIF pour integrationAnalyse complete des vulnerabilites - Pipeline CI/CD
+