Skip to content

Commit

Permalink
[StepSecurity] Apply security best practices (#214)
Browse files Browse the repository at this point in the history
* [StepSecurity] Apply security best practices

Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
  • Loading branch information
step-security-bot authored Jul 14, 2023
1 parent b0de26f commit e2ea363
Show file tree
Hide file tree
Showing 8 changed files with 524 additions and 5 deletions.
276 changes: 276 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /1_hello_world/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /1_hello_world/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /1_hello_world/node-addon-api-addon-class
schedule:
interval: daily

- package-ecosystem: npm
directory: /1_hello_world/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /2_function_arguments/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /2_function_arguments/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /2_function_arguments/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /3_callbacks/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /3_callbacks/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /3_callbacks/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /4_object_factory/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /4_object_factory/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /4_object_factory/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /5_function_factory/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /5_function_factory/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /5_function_factory/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /6_object_wrap/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /6_object_wrap/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /6_object_wrap/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /7_factory_wrap/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /7_factory_wrap/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /7_factory_wrap/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /8_passing_wrapped/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /8_passing_wrapped/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /8_passing_wrapped/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /a-first-project/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /array_buffer_to_native/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /async-iterator/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /async_pi_estimate/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /async_pi_estimate/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /async_work_promise/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /async_work_promise/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /async_work_thread_safe_function/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /build_with_cmake/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /build_with_cmake/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /call-js-from-async-worker-execute/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /emit_event_from_cpp/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /function-reference-demo/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /inherits_from_event_emitter/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /multiple_load/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /multiple_load/node_10
schedule:
interval: daily

- package-ecosystem: npm
directory: /napi-asyncworker-example/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /object-template-demo/nan
schedule:
interval: daily

- package-ecosystem: npm
directory: /object-template-demo/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /object-wrap-demo/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /promise-callback-demo/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /thread_safe_function_counting/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /thread_safe_function_round_trip/napi
schedule:
interval: daily

- package-ecosystem: npm
directory: /threadsafe-async-iterator/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /typed_array_to_native/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /typed_threadsafe_function/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /typescript_with_addon/node-addon-api
schedule:
interval: daily

- package-ecosystem: npm
directory: /website
schedule:
interval: daily
89 changes: 89 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "0 0 * * 1"

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["cpp", "javascript", "typescript"]
# CodeQL supports [ $supported-codeql-languages ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@46ed16ded91731b2df79a2893d3aea8e9f03b5c4 # v2.20.3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@46ed16ded91731b2df79a2893d3aea8e9f03b5c4 # v2.20.3

- name: Use Node.js v18.x
if: matrix.language == 'cpp'
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 18.x

- name: Build cpp
if: matrix.language == 'cpp'
run: |
npm install -g cmake-js@6.3.2 && npm install && npm test
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@46ed16ded91731b2df79a2893d3aea8e9f03b5c4 # v2.20.3
with:
category: "/language:${{matrix.language}}"
27 changes: 27 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required,
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: 'Dependency Review'
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1
Loading

0 comments on commit e2ea363

Please sign in to comment.