因此,我试图通过gitleaks
运行github-actions
,并在他们的yaml文件中使用。
我的目标是只在最后一次提交时运行git泄漏,这意味着如果有人因为代码中有泄漏而出错,那么他需要修复这个漏洞,然后再提交一次,它就能工作了。
现在,如果我像运行它一样运行它,查看所有提交历史并检查它(这并不好,因为如果我修复了泄漏,它应该会通过)
这是yaml:
name: gitleaks
on: [pull_request]
jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: gitleaks-action with defaults
uses: zricethezav/gitleaks-action@master
- name: gitleaks-action with config
uses: zricethezav/gitleaks-action@master
with:
config-path: .gitleaks.yml
读了几句之后,我试着用:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
但是“0”仍然给了我所有的承诺历史。试图更改为1或2,但现在它还是通过了(如果代码中有漏洞),我得到了:
time="2021-12-21T13:52:58Z“level=info msg=提交扫描: 0”
我怎么能只在最后一次提交时才能运行呢?
发布于 2022-08-17 11:09:14
PierreBis是正确的,但是该命令不会带来任何结果。
您还应该在-log参数中添加-p。下面这一行应该行得通:
gitleaks detect --source . --log-opts "-p -n 1"
发布于 2022-01-07 12:58:32
您可以使用“--日志选择”选项来设置提交限制(吉特利兹医生)。
因此,为了只获得最后一次提交,您应该使用‘-n1’来将提交的次数限制在一个。
完整的git优劣命令看起来像:gitleaks detect --source . --log-opts "-n 1"
注:这并不限制github行动,但会影响github的泄漏
Notes2:这将只测试上一次提交的差异(即:git log -p -n 1
命令的结果)
https://stackoverflow.com/questions/70436593
复制相似问题