Skip to content

Commit f12da43

Browse files
authored
Merge pull request #128 from step-security-bot/stepsecurity_remediation_1728662180
[StepSecurity] Apply security best practices
2 parents 797c940 + 176034e commit f12da43

File tree

5 files changed

+175
-76
lines changed

5 files changed

+175
-76
lines changed

.github/dependabot.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
61
version: 2
72
updates:
8-
9-
- package-ecosystem: "github-actions"
10-
directory: "/"
3+
- package-ecosystem: github-actions
4+
directory: /
115
schedule:
12-
interval: "daily"
13-
14-
- package-ecosystem: "npm"
15-
directory: "/"
6+
interval: daily
7+
8+
- package-ecosystem: npm
9+
directory: /
1610
schedule:
17-
interval: "daily"
11+
interval: daily

.github/workflows/codeql.yml

+46-63
Original file line numberDiff line numberDiff line change
@@ -10,86 +10,69 @@
1010
# supported CodeQL languages.
1111
#
1212
name: "CodeQL"
13+
1314
on:
1415
push:
15-
branches: [ "main" ]
16+
branches: ["main"]
1617
pull_request:
17-
branches: [ "main" ]
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
1820
schedule:
19-
- cron: '33 12 * * 2'
21+
- cron: "0 0 * * 1"
22+
2023
permissions:
2124
contents: read
2225

2326
jobs:
2427
analyze:
25-
name: Analyze (${{ matrix.language }})
26-
# Runner size impacts CodeQL analysis time. To learn more, please see:
27-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28-
# - https://gh.io/supported-runners-and-hardware-resources
29-
# - https://gh.io/using-larger-runners (GitHub.com only)
30-
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
31-
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32-
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
28+
name: Analyze
29+
runs-on: ubuntu-latest
3330
permissions:
34-
# required for all workflows
35-
security-events: write
36-
37-
# required to fetch internal or private CodeQL packs
38-
packages: read
39-
40-
# only required for workflows in private repositories
4131
actions: read
4232
contents: read
33+
security-events: write
4334

4435
strategy:
4536
fail-fast: false
4637
matrix:
47-
include:
48-
- language: javascript-typescript
49-
build-mode: none
50-
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
51-
# Use `c-cpp` to analyze code written in C, C++ or both
52-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
53-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
54-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
55-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
56-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
57-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
38+
language: ["javascript", "typescript"]
39+
# CodeQL supports [ $supported-codeql-languages ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
5842
steps:
59-
- name: Checkout repository
60-
uses: actions/checkout@v4
43+
- name: Harden Runner
44+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
45+
with:
46+
egress-policy: audit
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
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@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
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
6167

62-
# Initializes the CodeQL tools for scanning.
63-
- name: Initialize CodeQL
64-
uses: github/codeql-action/init@v3
65-
with:
66-
languages: ${{ matrix.language }}
67-
build-mode: ${{ matrix.build-mode }}
68-
# If you wish to specify custom queries, you can do so here or in a config file.
69-
# By default, queries listed here will override any specified in a config file.
70-
# Prefix the list here with "+" to use these queries and those in the config file.
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.
7170

72-
# For more 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
73-
# queries: security-extended,security-and-quality
74-
config: |
75-
paths-ignore:
76-
- dist/**
77-
# If the analyze step fails for one of the languages you are analyzing with
78-
# "We were unable to automatically build your code", modify the matrix above
79-
# to set the build mode to "manual" for that language. Then modify this step
80-
# to build your code.
81-
# ℹ️ Command-line programs to run using the OS shell.
82-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
83-
- if: matrix.build-mode == 'manual'
84-
run: |
85-
echo 'If you are using a "manual" build mode for one or more of the' \
86-
'languages you are analyzing, replace this with the commands to build' \
87-
'your code, for example:'
88-
echo ' make bootstrap'
89-
echo ' make release'
90-
exit 1
71+
# - run: |
72+
# echo "Run, Build Application using script"
73+
# ./location_of_script_within_repo/buildscript.sh
9174

92-
- name: Perform CodeQL Analysis
93-
uses: github/codeql-action/analyze@v3
94-
with:
95-
category: "/language:${{matrix.language}}"
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
77+
with:
78+
category: "/language:${{matrix.language}}"
+27
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@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4

.github/workflows/scorecards.yml

+81
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@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
40+
with:
41+
egress-policy: audit
42+
43+
- name: "Checkout code"
44+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
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@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
80+
with:
81+
sarif_file: results.sarif

.pre-commit-config.yaml

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

0 commit comments

Comments
 (0)