File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import murfey .util .db as MurfeyDB
1414from murfey .server .api .auth import validate_instrument_token
1515from murfey .server .murfey_db import murfey_db
16+ from murfey .util import sanitise_path
1617from murfey .util .config import get_machine_config
1718from murfey .util .models import LamellaSiteInfo
1819
@@ -85,6 +86,12 @@ async def make_gif(
8586 machine_config = get_machine_config (instrument_name = instrument_name )[
8687 instrument_name
8788 ]
89+ rsync_basepath = machine_config .rsync_basepath or Path ("." ).resolve ()
90+
91+ # Sanitise and verify that the output directory is relative to rsync basepath
92+ output_dir = sanitise_path (gif_params .output_file .parent )
93+ if not output_dir .is_relative_to (rsync_basepath ):
94+ logger .error ("Output directory path is not permitted" )
8895
8996 # Create the directory structure
9097 if not (output_dir := gif_params .output_file .parent ).exists ():
You can’t perform that action at this time.
0 commit comments