Skip to content

Commit

Permalink
fix(config): prevent path traversal manipulation of target changelog …
Browse files Browse the repository at this point in the history
…location
  • Loading branch information
codejedi365 committed Jul 4, 2024
1 parent be4919c commit 43e35d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions semantic_release/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,15 +568,15 @@ def from_raw_config( # noqa: C901
)

# changelog_file
changelog_file = Path(raw.changelog.changelog_file).resolve()
changelog_file = Path(raw.changelog.changelog_file).expanduser().resolve()

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

template_dir = (raw.repo_dir / raw.changelog.template_dir).resolve()
template_dir = Path(raw.changelog.template_dir).expanduser().resolve()

# Prevent path traversal attacks
if raw.repo_dir not in template_dir.parents:
Expand Down

0 comments on commit 43e35d0

Please sign in to comment.