The tools [gitleaks](https://github.com/gitleaks/gitleaks) and [trufflehog](https://github.com/trufflesecurity/trufflehog) can catch secret keys before they're checked in in git, but they don't get triggered by secrets in notebooks. Theoretically it would be a perfect fit for nbQA to also run (one of) these tools, once the notebooks are already converted to `py` files. The only issue I can expect is that you don't install `gitleaks` with `pip` but would typically use with a container. Related issue on the `gitleaks`-side, missing notebook support: https://github.com/gitleaks/gitleaks/issues/914