Skip to content

Commit b8f80b0

Browse files
workflow: apply security best practices
Reference: nodejs/security-wg#859 Signed-off-by: StepSecurity Bot <[email protected]>
1 parent 51fa0fe commit b8f80b0

File tree

8 files changed

+135
-11
lines changed

8 files changed

+135
-11
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ updates:
1111
schedule:
1212
interval: "weekly"
1313
open-pull-requests-limit: 10
14+
15+
- package-ecosystem: docker
16+
directory: /build
17+
schedule:
18+
interval: daily
19+
20+
- package-ecosystem: pip
21+
directory: /test/wpt/tests/resources/test
22+
schedule:
23+
interval: daily

.github/workflows/bench.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ on:
33
- push
44
- pull_request
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
benchmark_current:
811
name: benchmark current
912
runs-on: ubuntu-latest
1013
steps:
1114
- name: Checkout Code
12-
uses: actions/checkout@v3
15+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
1316
with:
1417
persist-credentials: false
1518
ref: ${{ github.base_ref }}
1619
- name: Setup Node
17-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1821
with:
1922
node-version: lts/*
2023
- name: Install Modules
@@ -27,11 +30,11 @@ jobs:
2730
runs-on: ubuntu-latest
2831
steps:
2932
- name: Checkout Code
30-
uses: actions/checkout@v3
33+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
3134
with:
3235
persist-credentials: false
3336
- name: Setup Node
34-
uses: actions/setup-node@v3
37+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
3538
with:
3639
node-version: lts/*
3740
- name: Install Modules

.github/workflows/codeql.yml

+78
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", "python", "typescript"]
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@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
45+
with:
46+
egress-policy: audit
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
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@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
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@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
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@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1

.github/workflows/fuzz.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ name: Fuzzing
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
fuzzing:
710
name: Fuzz
811
runs-on: ubuntu-latest
912

1013
steps:
11-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
1215
with:
1316
persist-credentials: false
1417

1518
- name: Setup Node
16-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1720
with:
1821
node-version: lts/*
1922

@@ -26,7 +29,7 @@ jobs:
2629
run: |
2730
npm run fuzz
2831
29-
- uses: actions/upload-artifact@v3
32+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
3033
if: ${{ failure() }}
3134
with:
3235
name: undici-fuzz-results-${{ github.sha }}

.github/workflows/lint.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: Lint
22
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
36
jobs:
47
lint:
58
runs-on: ubuntu-latest
69
steps:
7-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
811
with:
912
persist-credentials: false
10-
- uses: actions/setup-node@v3
13+
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1114
with:
1215
node-version: lts/*
1316
- run: npm install

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
pull-requests: write
3333
contents: write
3434
steps:
35-
- uses: fastify/github-action-merge-dependabot@v3
35+
- uses: fastify/github-action-merge-dependabot@415548af92cebc9895bff7b30e3e89d8970a2576 # v3.7.0
3636
with:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}

build/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine
1+
FROM node:18-alpine@sha256:1ccc70acda680aa4ba47f53e7c40b2d4d6892de74817128e0662d32647dd7f4d
22

33
ARG UID=1000
44
ARG GID=1000

0 commit comments

Comments
 (0)