diff --git a/.github/workflows/devsecops.yml b/.github/workflows/devsecops.yml index cb619677..fa2ebe35 100644 --- a/.github/workflows/devsecops.yml +++ b/.github/workflows/devsecops.yml @@ -1,23 +1,561 @@ -name: Automatisation des tests DevSecOps -on: push +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: Dependances + - 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: | - docker run --rm -v "$PWD":/project -v $HOME/.cache/trivy:/root/.cache/ aquasec/trivy:latest fs ./requirements.txt + 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
+