Skip to content

Commit ff3d5a3

Browse files
Merge pull request #2 from step-security-bot/stepsecurity_remediation_1732627808
[StepSecurity] Apply security best practices
2 parents bd95655 + 10bee0d commit ff3d5a3

File tree

11 files changed

+269
-14
lines changed

11 files changed

+269
-14
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
8+
- package-ecosystem: docker
9+
directory: /
10+
schedule:
11+
interval: daily
12+
13+
- package-ecosystem: npm
14+
directory: /
15+
schedule:
16+
interval: daily

.github/workflows/codeql.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: "0 0 * * 1"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: ["javascript"]
39+
# CodeQL supports [ $supported-codeql-languages ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
42+
steps:
43+
- name: Harden Runner
44+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
45+
with:
46+
egress-policy: audit
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
54+
with:
55+
languages: ${{ matrix.language }}
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
60+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
61+
# If this step fails, then you should remove it and run the build manually (see below)
62+
- name: Autobuild
63+
uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
64+
65+
# ℹ️ Command-line programs to run using the OS shell.
66+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
67+
68+
# If the Autobuild fails above, remove it and uncomment the following three lines.
69+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70+
71+
# - run: |
72+
# echo "Run, Build Application using script"
73+
# ./location_of_script_within_repo/buildscript.sh
74+
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
77+
with:
78+
category: "/language:${{matrix.language}}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ jobs:
1212
mongodb-version: ['4.0', '4.2', '4.4', '5.0', '6.0']
1313

1414
steps:
15+
- name: Harden Runner
16+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
17+
with:
18+
egress-policy: audit
19+
1520
- name: Checkout
16-
uses: actions/checkout@v4
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1722

1823
- name: Start MongoDB Server
1924
uses: ./

.github/workflows/scorecards.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '20 7 * * 2'
14+
push:
15+
branches: ["main"]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
contents: read
30+
actions: read
31+
# To allow GraphQL ListCommits to work
32+
issues: read
33+
pull-requests: read
34+
# To detect SAST tools
35+
checks: read
36+
37+
steps:
38+
- name: Harden Runner
39+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
40+
with:
41+
egress-policy: audit
42+
43+
- name: "Checkout code"
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
with:
46+
persist-credentials: false
47+
48+
- name: "Run analysis"
49+
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
50+
with:
51+
results_file: results.sarif
52+
results_format: sarif
53+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
54+
# - you want to enable the Branch-Protection check on a *public* repository, or
55+
# - you are installing Scorecards on a *private* repository
56+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
57+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
58+
59+
# Public repositories:
60+
# - Publish results to OpenSSF REST API for easy access by consumers
61+
# - Allows the repository to include the Scorecard badge.
62+
# - See https://github.com/ossf/scorecard-action#publishing-results.
63+
# For private repositories:
64+
# - `publish_results` will always be set to `false`, regardless
65+
# of the value entered here.
66+
publish_results: true
67+
68+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
69+
# format to the repository Actions tab.
70+
- name: "Upload artifact"
71+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
72+
with:
73+
name: SARIF file
74+
path: results.sarif
75+
retention-days: 5
76+
77+
# Upload the results to GitHub's code scanning dashboard.
78+
- name: "Upload to code-scanning"
79+
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
80+
with:
81+
sarif_file: results.sarif

.github/workflows/test-auth.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ jobs:
1616
mongodb-password: ['ci']
1717

1818
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
21+
with:
22+
egress-policy: audit
23+
1924
- name: Checkout
20-
uses: actions/checkout@v4
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2126

2227
- name: Start MongoDB Server v${{ matrix.mongodb-version }}
2328
uses: ./
@@ -28,7 +33,7 @@ jobs:
2833
mongodb-password: ${{ matrix.mongodb-password }}
2934

3035
- name: Use Node.js ${{ matrix.node-version }}
31-
uses: actions/setup-node@v4
36+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
3237
with:
3338
node-version: ${{ matrix.node-version }}
3439

.github/workflows/test-replica-set.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ jobs:
1313
mongodb-version: ['4.4', '5.0', '6.0']
1414

1515
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
18+
with:
19+
egress-policy: audit
20+
1621
- name: Checkout
17-
uses: actions/checkout@v4
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1823

1924
- name: Start MongoDB Server v${{ matrix.mongodb-version }}
2025
uses: ./
@@ -23,7 +28,7 @@ jobs:
2328
mongodb-replica-set: mongodb-test-rs
2429

2530
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
2732
with:
2833
node-version: ${{ matrix.node-version }}
2934

@@ -46,8 +51,13 @@ jobs:
4651

4752
name: MongoDB v${{ matrix.mongodb-version }} RS, Port ${{ matrix.mongodb-port }} — Node.js v${{ matrix.node-version }}
4853
steps:
54+
- name: Harden Runner
55+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
56+
with:
57+
egress-policy: audit
58+
4959
- name: Checkout
50-
uses: actions/checkout@v4
60+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5161

5262
- name: Start MongoDB Server v${{ matrix.mongodb-version }}
5363
uses: ./
@@ -57,7 +67,7 @@ jobs:
5767
mongodb-replica-set: mongodb-test-rs
5868

5969
- name: Use Node.js ${{ matrix.node-version }}
60-
uses: actions/setup-node@v4
70+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
6171
with:
6272
node-version: ${{ matrix.node-version }}
6373

.github/workflows/test-single-instance.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ jobs:
1313
mongodb-version: ['4.4', '5.0', '6.0']
1414

1515
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
18+
with:
19+
egress-policy: audit
20+
1621
- name: Checkout
17-
uses: actions/checkout@v4
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1823

1924
- name: Start MongoDB Server v${{ matrix.mongodb-version }}
2025
uses: ./
2126
with:
2227
mongodb-version: ${{ matrix.mongodb-version }}
2328

2429
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
30+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
2631
with:
2732
node-version: ${{ matrix.node-version }}
2833

@@ -46,8 +51,13 @@ jobs:
4651

4752
name: MongoDB v${{ matrix.mongodb-version }}, Port ${{ matrix.mongodb-port }} — Node.js v${{ matrix.node-version }}
4853
steps:
54+
- name: Harden Runner
55+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
56+
with:
57+
egress-policy: audit
58+
4959
- name: Checkout
50-
uses: actions/checkout@v4
60+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5161

5262
- name: Start MongoDB Server v${{ matrix.mongodb-version }}
5363
uses: ./
@@ -56,7 +66,7 @@ jobs:
5666
mongodb-port: ${{ matrix.mongodb-port }}
5767

5868
- name: Use Node.js ${{ matrix.node-version }}
59-
uses: actions/setup-node@v4
69+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
6070
with:
6171
node-version: ${{ matrix.node-version }}
6272

.github/workflows/validate-action-typings.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ jobs:
1010
validate-typings:
1111
runs-on: "ubuntu-latest"
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: krzema12/github-actions-typing@v1
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
15+
with:
16+
egress-policy: audit
17+
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- uses: krzema12/github-actions-typing@d97e69a656cfb72a621da91005dd17616bc8b69e # v1.0.5

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/gitleaks/gitleaks
3+
rev: v8.16.3
4+
hooks:
5+
- id: gitleaks
6+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
7+
rev: 3.0.0
8+
hooks:
9+
- id: shellcheck
10+
- repo: https://github.com/pre-commit/mirrors-eslint
11+
rev: v8.38.0
12+
hooks:
13+
- id: eslint
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.4.0
16+
hooks:
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace

0 commit comments

Comments
 (0)