Skip to content

Commit eeb9bf9

Browse files
workflow: introduce openssf scorecard (#15)
1 parent db411d6 commit eeb9bf9

File tree

5 files changed

+175
-0
lines changed

5 files changed

+175
-0
lines changed

.github/workflows/codeql.yml

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

.github/workflows/scorecard.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Scorecard supply-chain security
4+
on:
5+
# For Branch-Protection check. Only the default branch is supported. See
6+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
7+
branch_protection_rule:
8+
# To guarantee Maintained check is occasionally updated. See
9+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
10+
schedule:
11+
- cron: '35 6 * * 1'
12+
push:
13+
branches: [ "main" ]
14+
15+
# Declare default permissions as read only.
16+
permissions: read-all
17+
18+
jobs:
19+
analysis:
20+
name: Scorecard analysis
21+
runs-on: ubuntu-latest
22+
permissions:
23+
# Needed to upload the results to code-scanning dashboard.
24+
security-events: write
25+
# Needed to publish results and get a badge (see publish_results below).
26+
id-token: write
27+
28+
steps:
29+
- name: Harden Runner
30+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
31+
with:
32+
egress-policy: audit
33+
34+
- name: "Checkout code"
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36+
with:
37+
persist-credentials: false
38+
39+
- name: "Run analysis"
40+
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
41+
with:
42+
results_file: results.sarif
43+
results_format: sarif
44+
publish_results: true
45+
46+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
47+
# format to the repository Actions tab.
48+
- name: "Upload artifact"
49+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
50+
with:
51+
name: SARIF file
52+
path: results.sarif
53+
retention-days: 5
54+
55+
# Upload the results to GitHub's code scanning dashboard (optional).
56+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
57+
- name: "Upload to code-scanning"
58+
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
59+
with:
60+
sarif_file: results.sarif

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# nodejs-loaders.github.io
22

3+
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/nodejs-loaders/nodejs-loaders.github.io/badge)](https://scorecard.dev/viewer/?uri=github.com/nodejs-loaders/nodejs-loaders.github.io)
4+
35
A showcase website for the `nodejs-loader` project
46

57
## Development

0 commit comments

Comments
 (0)