Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Trufflehog Accepting already parsed files #1834

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions bbot/modules/trufflehog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
from pathlib import Path
from bbot.modules.base import BaseModule


Expand Down Expand Up @@ -65,7 +64,6 @@ async def setup(self):
if not self.github_token:
self.deleted_forks = False
return None, "A github api_key must be provided to the github modules for deleted forks to be scanned"
self.processed = set()
return True

async def filter_event(self, event):
Expand All @@ -78,12 +76,8 @@ async def filter_event(self, event):
else:
return False, "Deleted forks is not enabled"
else:
path = event.data["path"]
for processed in self.processed:
processed_path = Path(processed)
new_path = Path(path)
if new_path.is_relative_to(processed_path):
return False, "Parent folder has already been processed"
if "parsed-folder" in event.tags:
return False, "Not accepting parsed-folder events"
return True

async def handle_event(self, event):
Expand All @@ -94,7 +88,6 @@ async def handle_event(self, event):
module = "github-experimental"
else:
path = event.data["path"]
self.processed.add(path)
if "git" in event.tags:
module = "git"
elif "docker" in event.tags:
Expand Down
Loading