git-proxy icon indicating copy to clipboard operation
git-proxy copied to clipboard

Scan for leaked credentials in PRs and code diff using TruffleHog OSS 🐷

Open JamieSlome opened this issue 1 year ago • 4 comments

Although GitHub's native secret detection is in place, there are various ways secrets can end up in files and commits. Plus, an extra layer of protection never hurts! 👍

To ensure the capture of leaked credentials, an assessment should occur at the pull request level, with PRs blocked if TruffleHog returns any results. Moreover, pull requests should only be mergeable if TruffleHog returns empty.

### Tasks
- [ ] On all pull requests, run secret detection against the source branch
- [ ] Use [TruffleHog OSS](https://github.com/marketplace/actions/trufflehog-oss)
- [ ] Enable TruffleHog OSS as a required status check for PR merge
- [ ] On a code push via Git Proxy, run secret detection against generated diff

JamieSlome avatar Jan 24 '24 19:01 JamieSlome

@abinash2512 - want to take this one on?

JamieSlome avatar Mar 28 '24 12:03 JamieSlome

@abinash2512 - I've updated the scope of this ticket to include:

  1. Running TruffleHog as a pull request check on our GitHub repository, via GitHub Actions
  2. Assess code pushed through Git Proxy for secrets using TruffleHog as a new push processor

JamieSlome avatar Apr 05 '24 10:04 JamieSlome

@maoo - after our community discussion today, we recognised that TruffleHog uses the AGPL-3.0 license. Do you think this would be a problem running it as a status check when pull requests are opened?

@coopernetes mentioned that running it as an embeddable plugin or assessment layer in Git Proxy itself may be problematic but wanted to see what you think about running it as a GitHub Action?

JamieSlome avatar Apr 08 '24 16:04 JamieSlome

@maoo - after our community discussion today, we recognised that TruffleHog uses the AGPL-3.0 license. Do you think this would be a problem running it as a status check when pull requests are opened?

Yes, I believe so; there are actually 2 things that concern me:

  • The "GPL" part of it, which would force all our derived code (eg, a GitProxy plugin that uses TruffleHog) to be released as GPL; assuming we would build the code based on the 2.x architecture, we could host the plugin as a separate FINOS project, and release it as GPL, though I'm not sure if you would be able to run it on your end
  • The "A" part, which could affect the license of GitProxy

I can seek legal advice, though it could take some time.

@coopernetes mentioned that running it as an embeddable plugin or assessment layer in Git Proxy itself may be problematic but wanted to see what you think about running it as a GitHub Action?

I think that leaked credentials is a crucial use case for GitProxy, and we should provide it as a plugin that adheres to the GitProxy 2.x architecture.

I also think that we should consider evaluating TruffleHog alternatives; from a quick seach I found https://github.com/GitGuardian , but I'm sure there are way more.

maoo avatar Apr 08 '24 17:04 maoo

@maoo - I've spoken with @tt-gideonaryeetey and @divinetettey today about running a design jam for us to come up with new plugin and push protection ideas. I will close this ticket in the meantime as it looks like we would have issues with the license here. I will follow up with an e-mail to our contributors to schedule a 1-2 hour session.

JamieSlome avatar Jul 01 '24 15:07 JamieSlome

I will close this ticket in the meantime as it looks like we would have issues with the license here.

I asked the TruffleHog team for clarification or a potential resolution regarding the licensing. Unfortunately, I didn't receive a response.

I will follow up with an e-mail to our contributors to schedule a 1-2 hour session.

Can I be included in this session?

rgmz avatar Jul 01 '24 17:07 rgmz

@rgmz - absolutely! 💯

JamieSlome avatar Jul 01 '24 18:07 JamieSlome