From 43a622ec82dfb3fdf0051c0a455c1b43b70ca076 Mon Sep 17 00:00:00 2001 From: StepSecurity Bot Date: Sun, 15 Jan 2023 19:54:28 +0000 Subject: [PATCH 1/4] [StepSecurity] Apply security best practices Signed-off-by: StepSecurity Bot --- .github/dependabot.yml | 11 ++++ .github/workflows/actionlint.yml | 3 + .github/workflows/build.yml | 6 +- .github/workflows/codeql.yml | 76 ++++++++++++++++++++++++++ .github/workflows/publishing.yml | 12 ++-- .github/workflows/testing-on-issue.yml | 2 +- .github/workflows/testing.yml | 4 +- 7 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c54fde7..716e7c6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,3 +12,14 @@ updates: directory: / schedule: interval: monthly + + + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + + - package-ecosystem: npm + directory: / + schedule: + interval: daily diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 7843abb..f25c3e8 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -1,6 +1,9 @@ name: Lint GitHub Actions workflows on: [push, pull_request] +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: actionlint: runs-on: ubuntu-latest diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35b48b2..90302e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: build: # make sure build/ci work properly runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - run: npm ci - run: npm run all @@ -17,7 +17,7 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 + uses: actions/dependency-review-action@c090f4e553673e6e505ea70d6a95362ee12adb94 # v3.0.3 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..e873ca6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# 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: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["javascript", "typescript"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@515828d97454b8354517688ddc5b48402b723750 # v2.1.38 + 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. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # 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@515828d97454b8354517688ddc5b48402b723750 # v2.1.38 + + # â„šī¸ 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@515828d97454b8354517688ddc5b48402b723750 # v2.1.38 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 85886f0..5927311 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -9,7 +9,7 @@ jobs: build: # make sure build/ci work properly runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - run: npm ci - run: npm run all @@ -17,7 +17,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 # execute the action locally for testing if anything breaks - uses: ./ @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: # get code - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 # build it - run: | @@ -44,10 +44,10 @@ jobs: # get tag for this release - name: Get tag value id: tag - uses: rajbos-actions/action-get-tag@v1 + uses: rajbos-actions/action-get-tag@12319896edaa290b27558e34a177804e9b8d077b # v1 # publish a release with the build assets - - uses: rajbos-actions/action-gh-release@v1 + - uses: rajbos-actions/action-gh-release@6034af24fba4e5a8e975aaa6056554efe4c794d0 # v1 id: publish with: name: Release ${{ steps.tag.outputs.tag }} @@ -61,7 +61,7 @@ jobs: env: url: ${{ steps.publish.outputs.url }} - - uses: rajbos-actions/slack@v1 + - uses: rajbos-actions/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 with: status: ${{ job.status }} env: diff --git a/.github/workflows/testing-on-issue.yml b/.github/workflows/testing-on-issue.yml index 79dd682..e8855cb 100644 --- a/.github/workflows/testing-on-issue.yml +++ b/.github/workflows/testing-on-issue.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest #if: github.ref == 'refs/heads/main' # don't run on PRs or branches steps: - - uses: actions/checkout@v3 # this will checkout the compiled Typescript + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 # this will checkout the compiled Typescript #- uses: hmarr/debug-action@v2 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 5d2a52e..ba92e64 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest #if: github.ref == 'refs/heads/main' # don't run on PRs steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - run: npm ci - run: npm run all @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest #if: github.ref == 'refs/heads/main' # don't run on PRs or branches steps: - - uses: actions/checkout@v3 # this will checkout the compiled Typescript + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 # this will checkout the compiled Typescript #- uses: hmarr/debug-action@v2 From 929e675790573b536a161d6c2c071bb5b43b0ef2 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 15 Jan 2023 21:06:19 +0100 Subject: [PATCH 2/4] Update .github/dependabot.yml --- .github/dependabot.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 716e7c6..87dbc12 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,14 +12,14 @@ updates: directory: / schedule: interval: monthly - - - - package-ecosystem: github-actions - directory: / - schedule: - interval: daily - - - package-ecosystem: npm - directory: / - schedule: - interval: daily + + + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + + - package-ecosystem: npm + directory: / + schedule: + interval: daily From deaa8063ff49d423e44035c3f1ff5ae468871067 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 15 Jan 2023 21:06:28 +0100 Subject: [PATCH 3/4] Update .github/workflows/actionlint.yml --- .github/workflows/actionlint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index f25c3e8..24eca5e 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -1,7 +1,7 @@ name: Lint GitHub Actions workflows on: [push, pull_request] -permissions: # added using https://github.com/step-security/secure-workflows +permissions: contents: read jobs: From 8177342beefa8fd1822284bdd71cd75762b945f3 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 15 Jan 2023 21:07:40 +0100 Subject: [PATCH 4/4] Update .github/dependabot.yml --- .github/dependabot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 87dbc12..2e0a911 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,4 +22,5 @@ updates: - package-ecosystem: npm directory: / schedule: - interval: daily + interval: monthly +