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 <bot@stepsecurity.io>
  • Loading branch information
step-security-bot committed Oct 26, 2023
1 parent 748219c commit 0c3ae68
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 8 deletions.
17 changes: 16 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,19 @@ updates:
schedule:
interval: "monthly"
# Allow up to 15 open pull requests for github-actions dependencies
open-pull-requests-limit: 15
open-pull-requests-limit: 15

- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

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

- package-ecosystem: npm
directory: /frontend
schedule:
interval: daily
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- name: Set up JDK 11
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
language: [ 'java' ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2

Expand Down
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@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: 'Dependency Review'
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1
5 changes: 5 additions & 0 deletions .github/workflows/findbugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- name: Set up JDK 11
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/java-format-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ name: Check Java Format

on: [ push, pull_request ]

permissions:
contents: read

jobs:

formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # v2 minimum required
- uses: axel-op/googlejavaformat-action@v3
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: axel-op/googlejavaformat-action@dbff853fb823671ec5781365233bf86543b13215 # v3
with:
args: "--aosp --skip-javadoc-formatting --skip-reflowing-long-strings --skip-sorting-imports --replace"
skip-commit: true
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/publish-gh-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@ on:
push:
tags:
- 'v*'
permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: '11'
distribution: 'temurin'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
publish:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- name: Check out the repo
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
# actions: read

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- name: Set up JDK 11
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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/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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:18 AS frontend
FROM node:18@sha256:a6385a6bb2fdcb7c48fc871e35e32af8daaa82c518900be49b76d10c005864c2 AS frontend

WORKDIR /frontend
COPY frontend .
RUN npm install
RUN npm run build

# Base image for building lpvs lib
FROM openjdk:11 AS builder
FROM openjdk:11@sha256:99bac5bf83633e3c7399aed725c8415e7b569b54e03e4599e580fc9cdb7c21ab AS builder

# Install dependencies
RUN apt-get update && \
Expand All @@ -21,7 +21,7 @@ COPY . .
RUN mvn clean install

# Base image for running lpvs container
FROM openjdk:11
FROM openjdk:11@sha256:99bac5bf83633e3c7399aed725c8415e7b569b54e03e4599e580fc9cdb7c21ab

# Install dependencies and remove tmp files
RUN apt-get update && \
Expand Down

0 comments on commit 0c3ae68

Please sign in to comment.