我正在尝试使用松露Pig凭证扫描仪每次我运行一个提交。下面是我的。precommit配置文件和终端中的错误。
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
- repo: local
hooks:
- id: pytest-check
name: pytest-check
stages: [commit]
types: [python]
entry: pytest
language: system
pass_filenames: false
always_run: true
repos:
- repo: local
hooks:
- id: trufflehog
name: TruffleHog
description: Detect secrets in your data.
entry: bash -c 'docker run -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///jonas_asad --only-verified --fail'
language: system
stages: ["commit", "push"]
错误是:
pre-commit install && git add . && git commit -m "test"
pre-commit installed at .git\hooks\pre-commit
[WARNING] Unexpected key(s) present on local => pytest-check: repos
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
black................................................(no files to check)Skipped
pytest-check.............................................................Passed
TruffleHog...............................................................Failed
- hook id: trufflehog
- exit code: 1
time="2022-09-22T13:16:38Z" level=fatal msg="Failed to scan Git." error="could open repo: /jonas_asad: repository does not exist"
我不能弄清楚这一点-如果你有一个工作的配置文件,请展示你的工作原理。
不胜感激,
2条答案
按热度按时间pw9qyyiw1#
我遇到了同样的问题--Docker卷Map的问题,它扫描容器内的内容,所以你必须将git根目录Map到容器内的内容,然后将工具指向该Map:
在本例中,本地存储库位于本地机器上的
/home/spherulitic/xerafin3
;它被Map到容器中的/repo
,然后我在/repo
处扫描repo。rryofs0p2#
我发现这很有效