diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f33a02cd16..1eaf7a5cfa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,54 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for more information: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# https://containers.dev/guide/dependabot +# Dependabot configuration for automated dependency updates +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates version: 2 updates: - - package-ecosystem: "devcontainers" - directory: "/" - schedule: - interval: weekly + # NuGet (.NET packages) + - package-ecosystem: nuget + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + labels: + - dependencies + - .net + commit-message: + prefix: "chore(deps)" + + # npm (frontend) + - package-ecosystem: npm + directory: /frontend + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + labels: + - dependencies + - frontend + commit-message: + prefix: "chore(deps)" + + # Docker (base images) + - package-ecosystem: docker + directory: / + schedule: + interval: weekly + day: monday + labels: + - dependencies + - docker + commit-message: + prefix: "chore(deps)" + + # GitHub Actions + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + labels: + - dependencies + - ci + commit-message: + prefix: "ci(deps)" diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0f2ef9e2ca..8cb2ce9f52 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,67 +1,50 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow helps you trigger a SonarCloud analysis of your code and populates -# GitHub Code Scanning alerts with the vulnerabilities found. -# Free for open source project. - -# 1. Login to SonarCloud.io using your GitHub account - -# 2. Import your project on SonarCloud -# * Add your GitHub organization first, then add your repository as a new project. -# * Please note that many languages are eligible for automatic analysis, -# which means that the analysis will start automatically without the need to set up GitHub Actions. -# * This behavior can be changed in Administration > Analysis Method. +# SonarCloud analysis for code quality and security # -# 3. Follow the SonarCloud in-product tutorial -# * a. Copy/paste the Project Key and the Organization Key into the args parameter below -# (You'll find this information in SonarCloud. Click on "Information" at the bottom left) -# -# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN -# (On SonarCloud, click on your avatar on top-right > My account > Security -# or go directly to https://sonarcloud.io/account/security/) +# Setup required: +# 1. Create project at sonarcloud.io using your GitHub account +# 2. Add SONAR_TOKEN secret to repository (Settings > Secrets > Actions) +# 3. Update projectKey and organization below -# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) -# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) - -name: SonarCloud analysis +name: SonarCloud on: push: - branches: [ "develop", "Core" ] + branches: [develop, main] pull_request: - branches: [ "develop" ] + branches: [develop] workflow_dispatch: permissions: - pull-requests: read # allows SonarCloud to decorate PRs with analysis results + pull-requests: read jobs: - Analysis: + analyze: runs-on: ubuntu-latest - steps: - - name: Analyze with SonarCloud + - name: Check for SONAR_TOKEN + id: check-secret + run: | + if [ -n "${{ secrets.SONAR_TOKEN }}" ]; then + echo "available=true" >> $GITHUB_OUTPUT + else + echo "available=false" >> $GITHUB_OUTPUT + echo "::warning::SONAR_TOKEN not configured - skipping SonarCloud scan" + fi - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@v2.2.0 - uses: SonarSource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) + - name: Checkout + if: steps.check-secret.outputs.available == 'true' + uses: actions/checkout@v4 with: - # Additional arguments for the SonarScanner CLI - args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - -Dsonar.projectKey= - -Dsonar.organization= - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false - # When you need the analysis to take place in a directory other than the one from which it was launched, default is . - projectBaseDir: . + fetch-depth: 0 + + - name: SonarCloud Scan + if: steps.check-secret.outputs.available == 'true' + uses: SonarSource/sonarcloud-github-action@v2 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.projectKey=cheir-mneme_aletheia + -Dsonar.organization=cheir-mneme + -Dsonar.sources=src + -Dsonar.exclusions=**/node_modules/**,**/bin/**,**/obj/**,**/*.min.js diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index ac124ceead..24dcbfe7b7 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -1,29 +1,38 @@ -# This workflow executes several linters on changed files based on languages used in your code base whenever -# you push a code or open a pull request. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/github/super-linter +# Super Linter for code quality checks on changed files +# https://github.com/super-linter/super-linter + name: Lint Code Base on: push: - branches: [ "develop" ] + branches: [develop, main] pull_request: - branches: [ "develop" ] + branches: [develop] + +permissions: + contents: read + statuses: write + jobs: - run-lint: + lint: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 with: - # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - name: Lint Code Base - uses: github/super-linter@v4 + uses: super-linter/super-linter/slim@v6 env: - VALIDATE_ALL_CODEBASE: false - DEFAULT_BRANCH: "develop" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DEFAULT_BRANCH: develop + VALIDATE_ALL_CODEBASE: false + # Disable linters not needed or handled elsewhere + VALIDATE_CSHARP: false + VALIDATE_JSCPD: false + VALIDATE_NATURAL_LANGUAGE: false + VALIDATE_MARKDOWN: false + VALIDATE_GITLEAKS: false + VALIDATE_CHECKOV: false + VALIDATE_GITHUB_ACTIONS: false diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 1ebbef4531..449e322476 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -1,48 +1,41 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. +# Trivy vulnerability scanner +# Scans for CVEs in filesystem/dependencies and uploads to GitHub Security tab +# Note: Image scanning requires built artifacts, use release workflow for that -name: trivy +name: Trivy Security Scan on: push: - branches: [ "develop", "Core" ] + branches: [develop, main] pull_request: - # The branches below must be a subset of the branches above - branches: [ "develop" ] + branches: [develop] schedule: - - cron: '19 12 * * 3' + - cron: '0 6 * * 1' # Weekly on Monday at 6am UTC permissions: contents: read + security-events: write + actions: read jobs: - build: - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status - name: Build + scan: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 - - name: Build an image from Dockerfile - run: | - docker build -t docker.io/my-organization/my-app:${{ github.sha }} . - - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe + - name: Run Trivy filesystem scanner + uses: aquasecurity/trivy-action@master with: - image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' - format: 'template' - template: '@/contrib/sarif.tpl' + scan-type: 'fs' + scan-ref: '.' + format: 'sarif' output: 'trivy-results.sarif' severity: 'CRITICAL,HIGH' + ignore-unfixed: true - - name: Upload Trivy scan results to GitHub Security tab + - name: Upload Trivy results to GitHub Security uses: github/codeql-action/upload-sarif@v3 + if: always() with: sarif_file: 'trivy-results.sarif'