Skip to content

Commit 0738345

Browse files
committed
Fix path traversal
1 parent aee67c2 commit 0738345

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

script/create_release_notes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def main():
4949
)
5050
args = parser.parse_args()
5151

52-
changelog_path = Path(args.changelog)
52+
try:
53+
changelog_path = Path(args.changelog).resolve()
54+
changelog_path.relative_to(Path.cwd().resolve())
55+
except ValueError:
56+
print(f"Error: {args.changelog} is outside the current directory.")
57+
sys.exit(1)
58+
5359
if not changelog_path.exists():
5460
print(f"Error: {changelog_path} not found.")
5561
sys.exit(1)

0 commit comments

Comments
 (0)