Skip to content

Commit ea0e60e

Browse files
committed
fix: fix security issue
1 parent 04a555d commit ea0e60e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

yigesamo/server.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ def make_file_response(cls, text_content):
6969

7070
@classmethod
7171
def get_file_response(cls, q):
72-
if not os.path.exists(q):
72+
# prevent internal file
73+
if any(
74+
'/' in q,
75+
not q.endswith('ris'),
76+
not os.path.exists(q)
77+
):
7378
return HTTPException(404, 'file not found')
7479

7580
return FileResponse(

0 commit comments

Comments
 (0)