Skip to content

Commit

Permalink
Update safe_extractor.py fix lint errors
Browse files Browse the repository at this point in the history
additionally converted `_is_within_directory` to static method
  • Loading branch information
Ali-Razmjoo authored Sep 5, 2024
1 parent 0c415ca commit f0d4944
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions luigi/safe_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#

"""
This module provides a class `SafeExtractor` that offers a secure way to extract tar files while
mitigating path traversal vulnerabilities, which can occur when files inside the archive are
This module provides a class `SafeExtractor` that offers a secure way to extract tar files while
mitigating path traversal vulnerabilities, which can occur when files inside the archive are
crafted to escape the intended extraction directory.
The `SafeExtractor` ensures that the extracted file paths are validated before extraction to
The `SafeExtractor` ensures that the extracted file paths are validated before extraction to
prevent malicious archives from extracting files outside the intended directory.
Classes:
Expand Down Expand Up @@ -60,7 +60,8 @@ def __init__(self, path="."):
"""
self.path = path

def _is_within_directory(self, directory, target):
@staticmethod
def _is_within_directory(directory, target):
"""
Checks if a target path is within a given directory.
Expand Down

0 comments on commit f0d4944

Please sign in to comment.