Skip to content

Commit 43e35d0

Browse files
committed
fix(config): prevent path traversal manipulation of target changelog location
1 parent be4919c commit 43e35d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

semantic_release/cli/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,15 @@ def from_raw_config( # noqa: C901
568568
)
569569

570570
# changelog_file
571-
changelog_file = Path(raw.changelog.changelog_file).resolve()
571+
changelog_file = Path(raw.changelog.changelog_file).expanduser().resolve()
572572

573573
# Prevent path traversal attacks
574574
if raw.repo_dir not in changelog_file.parents:
575575
raise InvalidConfiguration(
576576
"Changelog file destination must be inside of the repository directory."
577577
)
578578

579-
template_dir = (raw.repo_dir / raw.changelog.template_dir).resolve()
579+
template_dir = Path(raw.changelog.template_dir).expanduser().resolve()
580580

581581
# Prevent path traversal attacks
582582
if raw.repo_dir not in template_dir.parents:

0 commit comments

Comments
 (0)