diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 7760258c90c..204fe569971 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,19 +1,23 @@ --- - # For use with pre-commit. # See usage instructions at http://pre-commit.com -- id: kics - name: Checkmarx Kics - description: This hook runs kics. - entry: kics scan -p . - language: golang - pass_filenames: false - always_run: false - types_or: - - terraform - - dockerfile - - yaml - - json - exclude: '^.*\.terraform.*$' - require_serial: true +# - id: kics +# name: Checkmarx Kics +# description: This hook runs kics. +# entry: kics scan -p . +# language: golang +# pass_filenames: false +# always_run: false +# types_or: +# - terraform +# - dockerfile +# - yaml +# - json +# exclude: '^.*\.terraform.*$' +# require_serial: true + +- id: kics-scan + name: Checkmarx Kics Scan + language: docker + entry: kics scan -p /src --no-progress diff --git a/docs/integrations_pre_commit.md b/docs/integrations_pre_commit.md index a1f50e91127..e24e0bd09f3 100644 --- a/docs/integrations_pre_commit.md +++ b/docs/integrations_pre_commit.md @@ -1,12 +1,12 @@ # Running Kics with pre-commmit -To use `kics` with [pre-commit](https://pre-commit.com) add the following hook to your local repo's `.pre-commit-config.yaml` file. +To use `kics` with [pre-commit](https://pre-commit.com) add the following hook to your local repo's `.pre-commit-config.yaml` file. ```yaml - repo: https://github.com/Checkmarx/kics - rev: '' # change to correct tag or sha + rev: "" # change to correct tag or sha hooks: - - id: kics + - id: kics-scan ``` ## How to pass extra arguments @@ -15,10 +15,26 @@ You can provide arguments to `kics` by providing the pre-commit `args` [property ```yaml repos: -- repo: https://github.com/Checkmarx/kics - rev: '' # change to correct tag or sha - hooks: - - id: kics - verbose: true - args: [--ignore-on-exit, 'all'] + - repo: https://github.com/Checkmarx/kics + rev: "" # change to correct tag or sha + hooks: + - id: kics-scan + verbose: true + args: [--ignore-on-exit, "all"] +``` + +## Create your own local pre-commit hook + +You can create your own local pre-commit hook using the [docker_image](https://pre-commit.com/#docker_image) language. +This is a more lightweight way to configure `kics` as a pre-commit hook. + +```yaml +repos: + - repo: local + hooks: + - id: kics-scan-local + name: Kics scan + language: docker_image + entry: checkmarx/kics scan -p /src --no-progress + verbose: true ```