Skip to content

Commit 4b8adb7

Browse files
committed
Including check for root directory
1 parent a7a0563 commit 4b8adb7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sagemaker-core/src/sagemaker/core/common_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ def _validate_source_directory(source_directory):
641641

642642
# Check if the source path is under any sensitive directory
643643
for sensitive_path in _SENSITIVE_SYSTEM_PATHS:
644-
if abs_source.startswith(sensitive_path):
644+
if abs_source != "/" and abs_source.startswith(sensitive_path):
645645
raise ValueError(
646646
f"source_directory cannot access sensitive system paths. "
647647
f"Got: {source_directory} (resolved to {abs_source})"
@@ -667,7 +667,7 @@ def _validate_dependency_path(dependency):
667667

668668
# Check if the dependency path is under any sensitive directory
669669
for sensitive_path in _SENSITIVE_SYSTEM_PATHS:
670-
if abs_dependency.startswith(sensitive_path):
670+
if abs_dependency != "/" and abs_dependency.startswith(sensitive_path):
671671
raise ValueError(
672672
f"dependency path cannot access sensitive system paths. "
673673
f"Got: {dependency} (resolved to {abs_dependency})"

0 commit comments

Comments
 (0)