From 97b6b36362abad063b655079d129124c01f3626f Mon Sep 17 00:00:00 2001 From: jezd-axyl <97511864+jezd-axyl@users.noreply.github.com> Date: Wed, 21 Jun 2023 12:13:27 +0100 Subject: [PATCH] Adding support for log4shell (#37) ## Pull request checklist Please check if your PR fulfills the following requirements: - [x] I have read the [CONTRIBUTING](https://github.com/fabasoad/pre-commit-snyk/blob/main/CONTRIBUTING.md) doc. - [x] Tests for the changes have been added (for bug fixes / features). - [x] Docs have been reviewed and added / updated if needed (for bug fixes / features). ## Pull request type Please check the type of change your PR introduces: - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior ## What is the new behavior - Added support for testing for log4j - - ## Does this introduce a breaking change - [ ] Yes - [x] No ## Other information --- Closes #{IssueNumber} --- .pre-commit-hooks.yaml | 7 +++++++ README.md | 11 +++++++++++ hooks/snyk-log4shell.sh | 6 ++++++ 3 files changed, 24 insertions(+) create mode 100755 hooks/snyk-log4shell.sh diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index a08f15d..50c122d 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -21,3 +21,10 @@ entry: hooks/snyk-test.sh language: script pass_filenames: false + +- id: snyk-log4shell + name: Snyk log4shell + description: Runs 'snyk log4shell' command + entry: hooks/snyk-log4shell.sh + language: script + pass_filenames: false diff --git a/README.md b/README.md index 63e7a1c..ae2f05a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ 1. [snyk-container](#snyk-container) 2. [snyk-iac](#snyk-iac) 3. [snyk-test](#snyk-test) +4. [snyk-log4shell](#snyk-log4shell) ## Description @@ -69,3 +70,13 @@ repos: - id: snyk-test args: ["--severity-threshold=critical"] ``` + +### snyk-log4shell + +```yaml +repos: + - repo: https://github.com/fabasoad/pre-commit-snyk + rev: + hooks: + - id: snyk-log4shell +``` diff --git a/hooks/snyk-log4shell.sh b/hooks/snyk-log4shell.sh new file mode 100755 index 0000000..1fb9b95 --- /dev/null +++ b/hooks/snyk-log4shell.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -eu +SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" +bash "${SCRIPT_DIR}"/installation/main.sh + +snyk log4shell "$@"