Skip to content

Commit

Permalink
[StepSecurity] Apply security best practices
Browse files Browse the repository at this point in the history
Signed-off-by: StepSecurity Bot <[email protected]>
  • Loading branch information
step-security-bot committed Dec 7, 2024
1 parent d9c0bb5 commit d89b158
Show file tree
Hide file tree
Showing 8 changed files with 383 additions and 10 deletions.
146 changes: 146 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
version: 2
updates:
- package-ecosystem: bundler
directory: /
schedule:
interval: daily

- package-ecosystem: bundler
directory: /config/release
schedule:
interval: daily

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

- package-ecosystem: bundler
directory: /elasticgraph-admin
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-admin_lambda
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-apollo
schedule:
interval: daily

- package-ecosystem: docker
directory: /elasticgraph-apollo/apollo_tests_implementation
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-apollo/apollo_tests_implementation
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-datastore_core
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-elasticsearch
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-graphql
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-graphql_lambda
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-health_check
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-indexer
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-indexer_autoscaler_lambda
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-indexer_lambda
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-json_schema
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-lambda_support
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-local
schedule:
interval: daily

- package-ecosystem: docker
directory: /elasticgraph-local/lib/elastic_graph/local/elasticsearch
schedule:
interval: daily

- package-ecosystem: docker
directory: /elasticgraph-local/lib/elastic_graph/local/opensearch
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-opensearch
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-query_interceptor
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-query_registry
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-rack
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-schema_artifacts
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-schema_definition
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph-support
schedule:
interval: daily

- package-ecosystem: bundler
directory: /elasticgraph
schedule:
interval: daily
18 changes: 14 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@ jobs:
datastore: "elasticsearch:8.15.3"

steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- uses: actions/setup-node@v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "23.x"

- uses: KengoTODA/actions-setup-docker-compose@main
- uses: KengoTODA/actions-setup-docker-compose@2eec4b884e8cfa0d7310a4037b0ca789e5db12b2 # main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -78,6 +83,11 @@ jobs:
name: All CI Checks Passed
needs: [ci-check]
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- run: |
result="${{ needs.ci-check.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# 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: ["java", "javascript", "ruby"]
# 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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
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@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6

# ℹ️ 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@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
16 changes: 12 additions & 4 deletions .github/workflows/publish-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
publish-docs:
runs-on: ubuntu-latest
Expand All @@ -17,17 +20,22 @@ jobs:
group: ${{ github.workflow }}-${{ github.ref }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0
with:
ruby-version: "3.3"
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: "23.x"

Expand All @@ -36,7 +44,7 @@ jobs:

- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
# The GitHub Actions runner automatically creates this `GITHUB_TOKEN` secret
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push_gem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
# Note: this must come after we release the gem because it resets git back to the same SHA we started on
# (before bumping the version), but the RubyGems release depends on the version having been bumped.
- name: Create pull request for the version bump
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
branch: release-v${{ inputs.version }}
title: "Release v${{ inputs.version }}"
Expand All @@ -89,7 +89,7 @@ jobs:
- [ ] Review and edit the [GitHub Draft Release](https://github.com/${{ github.repository }}/releases) (can be done after this PR is merged)
- name: Create GitHub Release
uses: ncipollo/release-action@v1
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
draft: true
generateReleaseNotes: true
Expand Down
Loading

0 comments on commit d89b158

Please sign in to comment.