Skip to content

Commit 2f40fa4

Browse files
committed
fix: block windows absolute paths in validate_target
1 parent 6a67e50 commit 2f40fa4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arcada/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ def _validate_target(target: str) -> str:
8282
# Allow URLs
8383
if target.startswith(("http://", "https://")):
8484
return target
85-
85+
# Detect Windows absolute paths like C:\ or D:\
86+
if re.match(r"^[a-zA-Z]:\\", target):
87+
raise HTTPException(
88+
status_code=400,
89+
detail="Windows absolute paths are not allowed. Use a GitHub URL or paste code directly.",
90+
)
8691
# Reject absolute paths
8792
if os.path.isabs(target) or target.startswith("/") or target.startswith("\\"):
8893
raise HTTPException(

0 commit comments

Comments
 (0)