Skip to content

Commit

Permalink
Merge pull request #75 from SirTeggun/patch-1
Browse files Browse the repository at this point in the history
Update cli.py
  • Loading branch information
cccs-rs authored Dec 30, 2024
2 parents ec011b3 + c51c5ec commit 0c8da7c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions maco/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ def process_filesystem(
logger.error(f"not file or folder: {path_samples}")
exit(2)
try:
for path, dirs, files in walker:
base_directory = os.path.abspath(path_samples)
for path, _, files in walker:
for file in files:
num_analysed += 1
path_file = os.path.join(path, file)
path_file = os.path.abspath(os.path.join(path, file))
if not path_file.startswith(base_directory):
logger.error(f"Attempted path traversal detected: {path_file}")
continue

try:
with open(path_file, "rb") as stream:
resp = process_file(
Expand Down

0 comments on commit 0c8da7c

Please sign in to comment.