gitleaks / gitleaks-action

Protect your secrets using Gitleaks-Action
https://gitleaks.io
Other
319 stars 122 forks source link

GitHub action on pull_request keep on scanning previous commits #130

Open Aneeshwara-Babu opened 8 months ago

Aneeshwara-Babu commented 8 months ago

Hi I have tried this workflow yaml in GitHub action name: gitleaks on: [pull_request, workflow_dispatch] jobs: scan: name: gitleaks runs-on: ubuntu-latest steps:

But this workflow keep on scanning previous commits and finding the secrets which I have already deleted in the previous commits. How to make above yaml to scan only the latest commit

bodgit commented 8 months ago

You need to rewrite your commit history to remove whatever commit added the offending secret. Adding an additional commit that removes the secrets again isn't enough as the secrets will still be in your git commit history.

Aneeshwara-Babu commented 8 months ago

I didn't get that I need to rewrite the commit history?

Aneeshwara-Babu commented 8 months ago

How to make gitleaks on pull request to scan only the latest commits