Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/alscan/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def parse_als(path: str | Path) -> Project:
path = Path(path).resolve()
if not path.exists():
raise FileNotFoundError(str(path))
file_size = path.stat().st_size
if file_size == 0:
raise ValueError(f"ALS file is empty: {path}")
if file_size < 50:
raise ValueError(f"ALS file is too small to be valid ({file_size} bytes): {path}")
raw = path.read_bytes()
if raw[:2] == b"\x1f\x8b":
buf = io.BytesIO(raw)
Expand Down
5 changes: 5 additions & 0 deletions src/alscan/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ def save_report(
dest: Path,
source_paths: list[Path] | None = None,
) -> Path:
"""Save a report to dest with safety validation.

validate_output_dest() includes validate_parent() which checks for
symlink/junction traversal in path components.
"""
sources = source_paths or []
try:
validate_output_dest(dest, sources)
Expand Down