mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Be sure a user cannot server import crafty dir
This commit is contained in:
parent
17744b72ae
commit
55c527bfdb
@ -5,6 +5,7 @@ import time
|
||||
import tornado.web
|
||||
import tornado.escape
|
||||
import bleach
|
||||
from pathlib import Path
|
||||
|
||||
from app.classes.models.crafty_permissions import EnumPermissionsCrafty
|
||||
from app.classes.shared.helpers import Helpers
|
||||
@ -319,6 +320,13 @@ class ServerHandler(BaseHandler):
|
||||
return
|
||||
import_type = bleach.clean(self.get_argument("create_type", ""))
|
||||
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
||||
if Path(self.controller.project_root).is_relative_to(import_server_path):
|
||||
self.redirect(
|
||||
"/panel/error?error=Loop Error: The selected path will cause"
|
||||
" an infinite copy loop. Make sure Crafty's directory is not"
|
||||
" in your server path."
|
||||
)
|
||||
return
|
||||
import_server_jar = bleach.clean(self.get_argument("server_jar", ""))
|
||||
server_parts = server.split("|")
|
||||
captured_roles = []
|
||||
@ -468,6 +476,13 @@ class ServerHandler(BaseHandler):
|
||||
return
|
||||
import_type = bleach.clean(self.get_argument("create_type", ""))
|
||||
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
||||
if Path(self.controller.project_root).is_relative_to(import_server_path):
|
||||
self.redirect(
|
||||
"/panel/error?error=Loop Error: The selected path will cause"
|
||||
" an infinite copy loop. Make sure Crafty's directory is not"
|
||||
" in your server path."
|
||||
)
|
||||
return
|
||||
import_server_exe = bleach.clean(self.get_argument("server_jar", ""))
|
||||
server_parts = server.split("|")
|
||||
captured_roles = []
|
||||
|
Loading…
Reference in New Issue
Block a user