Skip to content

Commit

Permalink
skipping large files >25Mb choice matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinabraham committed Feb 28, 2021
1 parent 6be3289 commit 687b2d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libsast/core_matcher/choice_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def choice_matcher(self, scan_paths, rule):
ext = sfile.suffix.lower()
if self.exts and ext not in self.exts:
continue
if sfile.stat().st_size / 1000 / 1000 > 25:
# Skip scanning files greater than 25 MB
print(f'Skipping large file {sfile.as_posix()}')
continue
data = sfile.read_text('utf-8', 'ignore')
if ext in ('.html', '.xml'):
data = strip_comments2(data)
Expand Down

0 comments on commit 687b2d8

Please sign in to comment.