diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..2b4adae43 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,91 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + + - package-ecosystem: pip + directory: /api_docs + schedule: + interval: daily + + - package-ecosystem: docker + directory: /connectors/prometheus_metrics + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cueadmin + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cuebot + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cuegui + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cueman + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cuesubmit + schedule: + interval: daily + + - package-ecosystem: docker + directory: /cueweb + schedule: + interval: daily + + - package-ecosystem: npm + directory: /cueweb + schedule: + interval: daily + + - package-ecosystem: bundler + directory: /docs + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pycue + schedule: + interval: daily + + - package-ecosystem: docker + directory: /pyoutline + schedule: + interval: daily + + - package-ecosystem: docker + directory: /rest_gateway + schedule: + interval: daily + + - package-ecosystem: docker + directory: /rqd + schedule: + interval: daily + + - package-ecosystem: cargo + directory: /rust + schedule: + interval: daily + + - package-ecosystem: docker + directory: /samples/rqd/blender + schedule: + interval: daily + + - package-ecosystem: docker + directory: /samples/rqd/cuda + schedule: + interval: daily diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..fa389e425 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -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: ["master"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["master"] + 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", "go", "java", "javascript", "python", "typescript"] + # CodeQL supports [ $supported-codeql-languages ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + 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@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + + # â„šī¸ 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@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 000000000..f615da316 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -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 the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1167a61fe..14ec925b4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -44,8 +44,13 @@ jobs: # path: 'v1.11' steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: fetch-depth: 0 # Fetch all history for git metadata @@ -56,7 +61,7 @@ jobs: git checkout tags/$VERSION_TAG -b docs-$VERSION_TAG - name: Setup Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 with: ruby-version: '3.2' bundler-cache: true @@ -92,7 +97,7 @@ jobs: - name: Setup Pages id: pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0 if: github.event_name != 'pull_request' - name: Create _data directory and version file @@ -161,7 +166,7 @@ jobs: EOF - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 if: github.event_name != 'pull_request' with: path: ./docs/_site @@ -175,6 +180,11 @@ jobs: needs: build if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 \ No newline at end of file diff --git a/.github/workflows/post-release-pipeline.yml b/.github/workflows/post-release-pipeline.yml index f2ecbba38..1cf878226 100644 --- a/.github/workflows/post-release-pipeline.yml +++ b/.github/workflows/post-release-pipeline.yml @@ -6,11 +6,19 @@ on: release: types: [ published ] +permissions: + contents: read + jobs: create_blog_post: runs-on: ubuntu-22.04 name: Create Blog Post steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + - name: Trigger blog post workflow env: DOCS_REPO: AcademySoftwareFoundation/opencue.io diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9069d0c7d..c48a72965 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,12 +9,20 @@ on: env: CARGO_TERM_COLOR: always +permissions: + contents: read + jobs: build: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Install X11 dev libs run: | sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler @@ -33,7 +41,12 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Install X11 dev libs run: | sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 000000000..e2dd5da35 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,81 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '20 7 * * 2' + push: + branches: ["master"] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + contents: read + actions: read + # To allow GraphQL ListCommits to work + issues: read + pull-requests: read + # To detect SAST tools + checks: read + + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - name: "Checkout code" + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + with: + sarif_file: results.sarif diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..c477f4f89 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +repos: +- repo: https://github.com/gherynos/pre-commit-java + rev: v0.2.4 + hooks: + - id: Checkstyle +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks +- repo: https://github.com/golangci/golangci-lint + rev: v1.52.2 + hooks: + - id: golangci-lint +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: shellcheck +- repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: cpplint +- repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.38.0 + hooks: + - id: eslint +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/pylint-dev/pylint + rev: v2.17.2 + hooks: + - id: pylint diff --git a/connectors/prometheus_metrics/Dockerfile b/connectors/prometheus_metrics/Dockerfile index 357b5a0bf..e42b5f2f3 100644 --- a/connectors/prometheus_metrics/Dockerfile +++ b/connectors/prometheus_metrics/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:7 +FROM centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4 ENV PYTHONUNBUFFERED 1 WORKDIR /opt/opencue diff --git a/cueadmin/Dockerfile b/cueadmin/Dockerfile index fef2bd36a..6b622e98e 100644 --- a/cueadmin/Dockerfile +++ b/cueadmin/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.9@sha256:10c3875a6435af5b2461c6f99c52bfa11716aae0ca8b27b77f81df9faab93b16 WORKDIR /opt/opencue diff --git a/cuebot/Dockerfile b/cuebot/Dockerfile index 5da95a004..aea2c4813 100644 --- a/cuebot/Dockerfile +++ b/cuebot/Dockerfile @@ -1,7 +1,7 @@ # ----------------- # BUILD # ----------------- -FROM gradle:7.6.4-jdk17 AS build +FROM gradle:7.6.4-jdk17@sha256:0aa0a8521188366a1426ee5f3f13df5bac48184b5f6e7a21ddbfa495efb4e611 AS build USER gradle @@ -22,7 +22,7 @@ RUN mv ./build/libs/cuebot.jar ./build/libs/cuebot-$(cat ./VERSION)-all.jar # ----------------- # RPM # ----------------- -FROM jc21/rpmbuild-centos7:latest AS rpm +FROM jc21/rpmbuild-centos7:latest@sha256:23fa5311bde4d2dec8125fe238a287368df2c245b9548c2a7c79a133a2c85502 AS rpm USER rpmbuilder @@ -44,7 +44,7 @@ RUN chmod +x create_rpm.sh && ./create_rpm.sh cuebot "$(cat VERSION)" # ----------------- # RUN # ----------------- -FROM openjdk:18-slim-bullseye +FROM openjdk:18-slim-bullseye@sha256:8e17383576d7e71988ee5927473a32e8461381c7a29eefa9a0c24b3a28926272 # Install curl for healthchecking RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* diff --git a/cuegui/Dockerfile b/cuegui/Dockerfile index b2d894ece..f0d9f2222 100644 --- a/cuegui/Dockerfile +++ b/cuegui/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/x86_64 rockylinux:9.3 +FROM --platform=linux/x86_64 rockylinux:9.3@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 WORKDIR /opt/opencue diff --git a/cueman/Dockerfile b/cueman/Dockerfile index c8c1be5b5..7e292cc9a 100644 --- a/cueman/Dockerfile +++ b/cueman/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.9@sha256:10c3875a6435af5b2461c6f99c52bfa11716aae0ca8b27b77f81df9faab93b16 WORKDIR /opt/opencue diff --git a/cuesubmit/Dockerfile b/cuesubmit/Dockerfile index ac1cd37f9..27b01dfed 100644 --- a/cuesubmit/Dockerfile +++ b/cuesubmit/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/x86_64 rockylinux:9.3 +FROM --platform=linux/x86_64 rockylinux:9.3@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 WORKDIR /opt/opencue diff --git a/cueweb/Dockerfile b/cueweb/Dockerfile index 0b8314f6e..761df0ead 100644 --- a/cueweb/Dockerfile +++ b/cueweb/Dockerfile @@ -1,4 +1,4 @@ -FROM node:21-alpine +FROM node:21-alpine@sha256:78c45726ea205bbe2f23889470f03b46ac988d14b6d813d095e2e9909f586f93 WORKDIR /opt/cueweb diff --git a/pycue/Dockerfile b/pycue/Dockerfile index 2ff1b3da1..e15e421f6 100644 --- a/pycue/Dockerfile +++ b/pycue/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.9@sha256:10c3875a6435af5b2461c6f99c52bfa11716aae0ca8b27b77f81df9faab93b16 WORKDIR /opt/opencue diff --git a/pyoutline/Dockerfile b/pyoutline/Dockerfile index e963e262d..5cc83fc0c 100644 --- a/pyoutline/Dockerfile +++ b/pyoutline/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.9@sha256:10c3875a6435af5b2461c6f99c52bfa11716aae0ca8b27b77f81df9faab93b16 WORKDIR /opt/opencue diff --git a/rqd/Dockerfile b/rqd/Dockerfile index 29ec73339..cf227e7f7 100644 --- a/rqd/Dockerfile +++ b/rqd/Dockerfile @@ -1,4 +1,4 @@ -FROM rockylinux:8.9 +FROM rockylinux:8.9@sha256:9794037624aaa6212aeada1d28861ef5e0a935adaf93e4ef79837119f2a2d04c WORKDIR /opt/opencue diff --git a/samples/rqd/cuda/Dockerfile b/samples/rqd/cuda/Dockerfile index f59f84f76..1edb0dded 100644 --- a/samples/rqd/cuda/Dockerfile +++ b/samples/rqd/cuda/Dockerfile @@ -1,4 +1,4 @@ -FROM nvidia/cudagl:10.2-base-centos7 +FROM nvidia/cudagl:10.2-base-centos7@sha256:48c7b190ab62908ab5ec9945d5f5475ba21b8b6691b7aeece4a9ddad991fd2d2 WORKDIR /opt/opencue