diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..3722779f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +#Define code owners for the branches +#Approval from code owners should be requested before each pull request not made by a code owner + +* @Giraud-Pierre diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..e1054960 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,116 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + + - package-ecosystem: npm + directory: / + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-csp-nonce/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-csp-nonce/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-csp-nonce/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-csp/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-csp/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-csp/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-csrf/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-csrf/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-csrf/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-jsonp/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-jsonp/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-jsonp/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-jwt-oauth/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-jwt-oauth/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-jwt-oauth/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-sca/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-sca/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-sca/server/src/main/docker + schedule: + interval: daily + + - package-ecosystem: npm + directory: /pw/pw-xss/client + schedule: + interval: daily + + - package-ecosystem: maven + directory: /pw/pw-xss/server + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pw/pw-xss/server/src/main/docker + schedule: + interval: daily diff --git a/.github/workflows/SecretTest.yaml b/.github/workflows/SecretTest.yaml new file mode 100644 index 00000000..7685b442 --- /dev/null +++ b/.github/workflows/SecretTest.yaml @@ -0,0 +1,21 @@ +name: SecretTest. +run-name: ${{ github.actor }} is learning GitHub Actions +on: [pull_request] +jobs: + default-env-variables: + runs-on: ubuntu-latest + steps: + - name: Test secret + env : + title: ${{ github.event.pull_request.title }} + + run: | + + echo ${{secrets.MYFIRSTSECRET}} #Get the secret and try to show it but you can't because it is encrypted + if [ $title == ${{secrets.MYFIRSTSECRET}} ]; then #compare the secret to the pull request title. It is not supposed to be used like that but just to show what you can do. + echo "You got the secret !" + exit 0 + else + echo "Secret error!" + exit 1 + fi diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..985b5f0d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,78 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: ["main"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["main"] + schedule: + - cron: "0 0 * * 1" + +permissions: + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["java", "javascript", "typescript"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Harden Runner + uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - name: Checkout repository + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..adaecc2e --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,25 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - name: 'Checkout Repository' + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/deploy-pages-action.yml b/.github/workflows/deploy-pages-action.yml deleted file mode 100644 index 78bdc7a9..00000000 --- a/.github/workflows/deploy-pages-action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build and Deploy to github pages - -on: - push: - branches: - - main -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout đŸ›Žī¸ - uses: actions/checkout@v3.0.0 - - - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. - run: | - cd docs - npm ci - npm run docs:build - - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.2.5 - with: - branch: gh-pages # The branch the action should deploy to. - folder: docs/.vuepress/dist # The folder the action should deploy. - single-commit: true diff --git a/.github/workflows/injection.yml b/.github/workflows/injection.yml new file mode 100644 index 00000000..09b386ba --- /dev/null +++ b/.github/workflows/injection.yml @@ -0,0 +1,17 @@ +name: test-action +run-name: ${{ github.actor }} is learning GitHub Actions +on: [pull_request] +jobs: + check-bats-version: + runs-on: ubuntu-latest + steps: + - name: Check PR title + run: | + title="${{ github.event.pull_request.title }}" + if [[ $title =~ ^test ]]; then + echo $title + exit 0 + else + echo "Pas content" + exit 1 + fi diff --git a/.github/workflows/injection_corrected.yaml b/.github/workflows/injection_corrected.yaml new file mode 100644 index 00000000..872bc891 --- /dev/null +++ b/.github/workflows/injection_corrected.yaml @@ -0,0 +1,18 @@ +name: injection_corrected +run-name: ${{ github.actor }} is learning GitHub Actions +on: [pull_request] +jobs: + check-bats-version: + runs-on: ubuntu-latest + steps: + - name: injection_corrected + env : + title: "${{ github.event.pull_request.title }}" #le titre est mis en tant que variable d'environement! + run: | + if [[ $title =~ ^test ]]; then + echo $title + exit 0 + else + echo "Pas content" + exit 1 + fi diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 00000000..f6fa25a7 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,77 @@ +# 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. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '28 10 * * 0' + push: + branches: [ "main" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: Harden Runner + uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - name: "Checkout code" + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27 + with: + sarif_file: results.sarif diff --git a/pw/pw-csp-nonce/server/src/main/docker/Dockerfile b/pw/pw-csp-nonce/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-csp-nonce/server/src/main/docker/Dockerfile +++ b/pw/pw-csp-nonce/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-csp/server/src/main/docker/Dockerfile b/pw/pw-csp/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-csp/server/src/main/docker/Dockerfile +++ b/pw/pw-csp/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-csrf/server/src/main/docker/Dockerfile b/pw/pw-csrf/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-csrf/server/src/main/docker/Dockerfile +++ b/pw/pw-csrf/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-jsonp/server/src/main/docker/Dockerfile b/pw/pw-jsonp/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-jsonp/server/src/main/docker/Dockerfile +++ b/pw/pw-jsonp/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile +++ b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-sca/server/src/main/docker/Dockerfile b/pw/pw-sca/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-sca/server/src/main/docker/Dockerfile +++ b/pw/pw-sca/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 diff --git a/pw/pw-xss/server/src/main/docker/Dockerfile b/pw/pw-xss/server/src/main/docker/Dockerfile index 66991b29..adef4e67 100644 --- a/pw/pw-xss/server/src/main/docker/Dockerfile +++ b/pw/pw-xss/server/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0