Skip to content

Commit 1dbaacd

Browse files
ci: apply security best practices (#141)
Co-authored-by: Ulises Gascón <[email protected]>
1 parent 0e8d46a commit 1dbaacd

File tree

3 files changed

+101
-3
lines changed

3 files changed

+101
-3
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
8+
- package-ecosystem: npm
9+
directory: /
10+
schedule:
11+
interval: monthly
12+
time: "23:00"
13+
timezone: Europe/London
14+
open-pull-requests-limit: 10
15+
ignore:
16+
- dependency-name: "*"
17+
update-types: ["version-update:semver-major"]

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ on:
1111
paths-ignore:
1212
- '*.md'
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
test:
19+
permissions:
20+
checks: write # for coverallsapp/github-action to create new checks
21+
contents: read # for actions/checkout to fetch code
1622
runs-on: ubuntu-latest
1723
strategy:
1824
matrix:
@@ -40,7 +46,7 @@ jobs:
4046
node-version: "22"
4147

4248
steps:
43-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4450

4551
- name: Install Node.js ${{ matrix.node-version }}
4652
shell: bash -eo pipefail -l {0}
@@ -90,19 +96,21 @@ jobs:
9096
run: npm run lint
9197

9298
- name: Collect code coverage
93-
uses: coverallsapp/github-action@master
99+
uses: coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master
94100
if: steps.list_env.outputs.nyc != ''
95101
with:
96102
github-token: ${{ secrets.GITHUB_TOKEN }}
97103
flag-name: run-${{ matrix.test_number }}
98104
parallel: true
99105

100106
coverage:
107+
permissions:
108+
checks: write # for coverallsapp/github-action to create new checks
101109
needs: test
102110
runs-on: ubuntu-latest
103111
steps:
104112
- name: Upload code coverage
105-
uses: coverallsapp/github-action@master
113+
uses: coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master
106114
with:
107115
github-token: ${{ secrets.github_token }}
108116
parallel-finished: true

.github/workflows/codeql.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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: ["master"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["master"]
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: Checkout repository
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
46+
# Initializes the CodeQL tools for scanning.
47+
- name: Initialize CodeQL
48+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
49+
with:
50+
languages: ${{ matrix.language }}
51+
# If you wish to specify custom queries, you can do so here or in a config file.
52+
# By default, queries listed here will override any specified in a config file.
53+
# Prefix the list here with "+" to use these queries and those in the config file.
54+
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
59+
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
72+
with:
73+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)